File tree 2 files changed +17
-0
lines changed 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -14,11 +14,23 @@ function(linux_options)
14
14
Not implemented as compiler selection is managed by CMake. Look to
15
15
doc/cmake.rst for examples.
16
16
]]
17
+ option (GODOTCPP_USE_STATIC_CPP "Link libgcc and libstdc++ statically for better portability" ON )
17
18
endfunction ()
18
19
19
20
#[===========================[ Target Generation ]===========================]
20
21
function (linux_generate)
22
+ set (STATIC_CPP "$<BOOL:${GODOTCPP_USE_STATIC_CPP} >" )
23
+
21
24
target_compile_definitions (godot-cpp PUBLIC LINUX_ENABLED UNIX_ENABLED)
22
25
26
+ target_link_options (
27
+ godot-cpp
28
+ PUBLIC
29
+ $<${STATIC_CPP} :
30
+ -static -libgcc
31
+ -static -libstdc++
32
+ >
33
+ )
34
+
23
35
common_compiler_flags()
24
36
endfunction ()
Original file line number Diff line number Diff line change 5
5
6
6
def options (opts ):
7
7
opts .Add (BoolVariable ("use_llvm" , "Use the LLVM compiler - only effective when targeting Linux" , False ))
8
+ opts .Add (BoolVariable ("use_static_cpp" , "Link libgcc and libstdc++ statically for better portability" , True ))
8
9
9
10
10
11
def exists (env ):
@@ -37,6 +38,10 @@ def generate(env):
37
38
env .Append (CCFLAGS = ["-march=rv64gc" ])
38
39
env .Append (LINKFLAGS = ["-march=rv64gc" ])
39
40
41
+ # Link statically for portability
42
+ if env ["use_static_cpp" ]:
43
+ env .Append (LINKFLAGS = ["-static-libgcc" , "-static-libstdc++" ])
44
+
40
45
env .Append (CPPDEFINES = ["LINUX_ENABLED" , "UNIX_ENABLED" ])
41
46
42
47
# Refer to https://github.com/godotengine/godot/blob/master/platform/linuxbsd/detect.py
You can’t perform that action at this time.
0 commit comments