diff options
author | Fabio Alessandrelli <fabio.alessandrelli@gmail.com> | 2023-06-24 19:55:26 +0200 |
---|---|---|
committer | Fabio Alessandrelli <fabio.alessandrelli@gmail.com> | 2023-06-29 13:37:09 +0200 |
commit | 0771084b5475a560ccdc03e6fa0e3c30f95dd638 (patch) | |
tree | a6923c943d3e1a9bc988cc6a150c8900fbcfbe40 /tools/cmake.py | |
parent | ae0dd0626a025968a256ac659d6290eb66891c81 (diff) | |
download | fork-godot-webrtc-native-0771084b5475a560ccdc03e6fa0e3c30f95dd638.tar.gz fork-godot-webrtc-native-0771084b5475a560ccdc03e6fa0e3c30f95dd638.tar.bz2 fork-godot-webrtc-native-0771084b5475a560ccdc03e6fa0e3c30f95dd638.zip |
[SCons] Simplify building cmake libraries.
Add an extra "CMakeBuild" method to reduce configuration needed by each
library.
Diffstat (limited to 'tools/cmake.py')
-rw-r--r-- | tools/cmake.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tools/cmake.py b/tools/cmake.py index c590860..39957d8 100644 --- a/tools/cmake.py +++ b/tools/cmake.py @@ -101,6 +101,18 @@ def cmake_generator(target, source, env, for_signature): ] +def cmake_build(env, target_dir, source_dir, cmake_outputs=[], cmake_targets=[], cmake_options=[], dependencies=[]): + cmake_env = env.Clone() + target = env.Dir("{}/{}/{}".format(target_dir, env["platform"], env["arch"])) + source = env.Dir(source_dir) + builder_targets = [target] + [str(target) + "/" + f for f in cmake_outputs] + builder_sources = [source] + dependencies + cmake_env.Append(CMAKECONFFLAGS=["-D%s=%s" % it for it in cmake_options.items()]) + if len(cmake_targets) > 0: + cmake_env.Append(CMAKEBUILDFLAGS=["-t"] + [t for t in cmake_targets]) + return cmake_env.CMake(builder_targets, builder_sources) + + def options(opts): opts.Add("cmake_default_flags", "Default CMake platform flags override, will be autodetected if not specified.", "") @@ -120,3 +132,4 @@ def generate(env): env["CMAKEBUILDFLAGS"] = SCons.Util.CLVar("") env["CMAKEBUILDCOM"] = "$CMAKE --build ${TARGET.dir} $CMAKEBUILDFLAGS -j$CMAKEBUILDJOBS" env["BUILDERS"]["CMake"] = SCons.Builder.Builder(generator=cmake_generator, emitter=cmake_emitter) + env.AddMethod(cmake_build, "CMakeBuild") |