diff options
author | Fabio Alessandrelli <fabio.alessandrelli@gmail.com> | 2023-06-20 18:53:08 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-20 18:53:08 +0200 |
commit | 32ae1d11958dcf04d0bd9c5c5ca98e21221a57d7 (patch) | |
tree | 4fea8b1675014c255b0f5b13fb971c2fd4c54eb4 /tools/cmake.py | |
parent | f19011f2fb794ab831b9cd53376fc52e8a5057db (diff) | |
parent | 54c8586235f497cb080fcc6c2fae169460769aad (diff) | |
download | fork-godot-webrtc-native-32ae1d11958dcf04d0bd9c5c5ca98e21221a57d7.tar.gz fork-godot-webrtc-native-32ae1d11958dcf04d0bd9c5c5ca98e21221a57d7.tar.bz2 fork-godot-webrtc-native-32ae1d11958dcf04d0bd9c5c5ca98e21221a57d7.zip |
Merge pull request #103 from Faless/build/less_rebuilds
[SCons] Fix regression causing unnecessary rebuilds.
Diffstat (limited to 'tools/cmake.py')
-rw-r--r-- | tools/cmake.py | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/tools/cmake.py b/tools/cmake.py index 28e1269..4141ee0 100644 --- a/tools/cmake.py +++ b/tools/cmake.py @@ -87,9 +87,13 @@ def cmake_emitter(target, source, env): return [str(target[0]) + "/CMakeCache.txt"] + target[1:], [str(source[0]) + "/CMakeLists.txt"] + source[1:] -cmake_configure_action = SCons.Action.Action("$CMAKECONFCOM", "$CMAKECONFCOMSTR") -cmake_build_action = SCons.Action.Action("$CMAKEBUILDCOM", "$CMAKEBUILDCOMSTR") -cmake_builder = SCons.Builder.Builder(action=[cmake_configure_action, cmake_build_action], emitter=cmake_emitter) +def cmake_generator(target, source, env, for_signature): + # Strip the -j option for signature to avoid rebuilding when num_jobs changes. + build = env["CMAKEBUILDCOM"].replace("-j$CMAKEBUILDJOBS", "") if for_signature else env["CMAKEBUILDCOM"] + return [ + SCons.Action.Action("$CMAKECONFCOM", "$CMAKECONFCOMSTR"), + SCons.Action.Action(build, "$CMAKEBUILDCOMSTR"), + ] def exists(env): @@ -104,6 +108,7 @@ def generate(env): env["CMAKEGENERATOR"] = "" env["CMAKECONFFLAGS"] = SCons.Util.CLVar("") env["CMAKECONFCOM"] = "$CMAKE -B ${TARGET.dir} $CMAKEPLATFORMCONFIG $CMAKECONFFLAGS ${SOURCE.dir}" + env["CMAKEBUILDJOBS"] = "${__env__.GetOption('num_jobs')}" env["CMAKEBUILDFLAGS"] = SCons.Util.CLVar("") - env["CMAKEBUILDCOM"] = "$CMAKE --build ${TARGET.dir} $CMAKEBUILDFLAGS" - env["BUILDERS"]["CMake"] = cmake_builder + env["CMAKEBUILDCOM"] = "$CMAKE --build ${TARGET.dir} $CMAKEBUILDFLAGS -j$CMAKEBUILDJOBS" + env["BUILDERS"]["CMake"] = SCons.Builder.Builder(generator=cmake_generator, emitter=cmake_emitter) |