From b7297fb39ca7a55390f9390666bd29803adc827f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Thu, 6 Feb 2020 17:28:32 +0100 Subject: SCons: Generate header with info on which modules are enabled We already had `MODULE_*_ENABLED` defines but only in the modules environment, and a few custom `*_ENABLED` defines in the main env when we needed the information in core. Now this is defined in a single header which can be included in the files that need this information. --- modules/modules_builders.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 modules/modules_builders.py (limited to 'modules/modules_builders.py') diff --git a/modules/modules_builders.py b/modules/modules_builders.py new file mode 100644 index 0000000000..0e9cba2b0b --- /dev/null +++ b/modules/modules_builders.py @@ -0,0 +1,16 @@ +"""Functions used to generate source files during build time + +All such functions are invoked in a subprocess on Windows to prevent build flakiness. +""" + +from platform_methods import subprocess_main + + +def generate_modules_enabled(target, source, env): + with open(target[0].path, 'w') as f: + for module in env.module_list: + f.write('#define %s\n' % ("MODULE_" + module.upper() + "_ENABLED")) + + +if __name__ == '__main__': + subprocess_main(globals()) -- cgit v1.2.3