modules_builders.py 810 B

123456789101112131415161718192021222324252627
  1. """Functions used to generate source files during build time
  2. All such functions are invoked in a subprocess on Windows to prevent build flakiness.
  3. """
  4. from platform_methods import subprocess_main
  5. def generate_modules_enabled(target, source, env):
  6. with open(target[0].path, "w") as f:
  7. for module in env.module_list:
  8. f.write("#define %s\n" % ("MODULE_" + module.upper() + "_ENABLED"))
  9. def generate_modules_tests(target, source, env):
  10. import os
  11. import glob
  12. with open(target[0].path, "w") as f:
  13. for name, path in env.module_list.items():
  14. headers = glob.glob(os.path.join(path, "tests", "*.h"))
  15. for h in headers:
  16. f.write('#include "%s"\n' % (os.path.normpath(h)))
  17. if __name__ == "__main__":
  18. subprocess_main(globals())