diff options
author | Fabio Alessandrelli <fabio.alessandrelli@gmail.com> | 2023-01-09 21:48:09 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-09 21:48:09 +0100 |
commit | 40962dbe19a017bee19b3806c4f0182c7e042f02 (patch) | |
tree | 02e7cb119a26e52b3c472c5c0ed7b03a5095da05 /tools/cmake.py | |
parent | 5348407de99ccfa49033170674060397f56490e6 (diff) | |
parent | bdd9d5074534db22ef0030f52db35aa04721ed09 (diff) | |
download | fork-godot-webrtc-native-40962dbe19a017bee19b3806c4f0182c7e042f02.tar.gz fork-godot-webrtc-native-40962dbe19a017bee19b3806c4f0182c7e042f02.tar.bz2 fork-godot-webrtc-native-40962dbe19a017bee19b3806c4f0182c7e042f02.zip |
Merge pull request #78 from Faless/build/split_deps
[SCons] Refactor build tools.
Diffstat (limited to 'tools/cmake.py')
-rw-r--r-- | tools/cmake.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tools/cmake.py b/tools/cmake.py new file mode 100644 index 0000000..0d6ee6b --- /dev/null +++ b/tools/cmake.py @@ -0,0 +1,27 @@ + +def exists(env): + return True + + +def generate(env): + env.AddMethod(cmake_configure, "CMakeConfigure") + env.AddMethod(cmake_build, "CMakeBuild") + + +def cmake_configure(env, source, target, opt_args): + args = [ + "-B", + target, + ] + if env["platform"] == "windows" and env["use_mingw"]: + args.extend(["-G", "Unix Makefiles"]) + for arg in opt_args: + args.append(arg) + args.append(source) + return env.Execute("cmake " + " ".join(['"%s"' % a for a in args])) + + +def cmake_build(env, source, target=""): + jobs = env.GetOption("num_jobs") + env = env.Clone() + return env.Execute("cmake --build %s %s -j%s" % (source, "-t %s" % target if target else "", jobs)) |