|
1 | | -# Based on https://github.com/godotengine/godot-cpp/blob/98ea2f60bb3846d6ae410d8936137d1b099cd50b/tools/linux.py |
| 1 | +# Based on https://github.com/godotengine/godot-cpp/blob/e83fd0904c13356ed1d4c3d09f8bb9132bdc6b77/tools/linux.py |
2 | 2 | from build import common_compiler_flags |
3 | 3 | from SCons.Variables import BoolVariable |
4 | 4 | from SCons.Tool import clang, clangxx |
5 | 5 |
|
6 | 6 |
|
7 | 7 | def options(opts): |
8 | 8 | opts.Add(BoolVariable("use_llvm", "Use the LLVM compiler - only effective when targeting Linux", False)) |
| 9 | + opts.Add(BoolVariable("use_static_cpp", "Link libgcc and libstdc++ statically for better portability", True)) |
9 | 10 | opts.Add(BoolVariable("use_ubsan", "Use LLVM/GCC compiler undefined behavior sanitizer (UBSAN)", False)) |
10 | 11 | opts.Add(BoolVariable("use_asan", "Use LLVM/GCC compiler address sanitizer (ASAN)", False)) |
11 | 12 | opts.Add(BoolVariable("use_lsan", "Use LLVM/GCC compiler leak sanitizer (LSAN)", False)) |
@@ -43,6 +44,10 @@ def generate(env): |
43 | 44 | env.Append(CCFLAGS=["-march=rv64gc"]) |
44 | 45 | env.Append(LINKFLAGS=["-march=rv64gc"]) |
45 | 46 |
|
| 47 | + # Link statically for portability |
| 48 | + if env["use_static_cpp"]: |
| 49 | + env.Append(LINKFLAGS=["-static-libgcc", "-static-libstdc++"]) |
| 50 | + |
46 | 51 | if env["use_ubsan"] or env["use_asan"] or env["use_lsan"] or env["use_tsan"] or env["use_msan"]: |
47 | 52 | env.extra_suffix += ".san" |
48 | 53 | env.Append(CCFLAGS=["-DSANITIZERS_ENABLED"]) |
|
0 commit comments