File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -14,11 +14,25 @@ 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
+ # gersemi: off
27
+ target_link_options (
28
+ godot-cpp
29
+ PUBLIC
30
+ $< ${STATIC_CPP} :
31
+ -static-libgcc
32
+ -static-libstdc++
33
+ >
34
+ )
35
+ # gersemi: on
36
+
23
37
common_compiler_flags ()
24
38
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