Skip to content

Commit 0a58425

Browse files
committed
Fix: Libgodot build on Linux.
1 parent 295e465 commit 0a58425

File tree

4 files changed

+41
-38
lines changed

4 files changed

+41
-38
lines changed

platform/linuxbsd/SCsub

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ if env["dbus"]:
4343
if env["library_type"] == "static_library":
4444
prog = env.add_library("#bin/godot", common_linuxbsd)
4545
elif env["library_type"] == "shared_library":
46-
env.Append(CCFLAGS=["-fPIC"])
4746
prog = env.add_shared_library("#bin/godot", common_linuxbsd)
4847
else:
4948
prog = env.add_program("#bin/godot", common_linuxbsd)

platform/linuxbsd/detect.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,9 @@ def configure(env: "SConsEnvironment"):
182182

183183
env.Append(CCFLAGS=["-ffp-contract=off"])
184184

185+
if env["library_type"] == "shared_library":
186+
env.Append(CCFLAGS=["-fPIC"])
187+
185188
# LTO
186189

187190
if env["lto"] == "auto": # Enable LTO for production.

platform/linuxbsd/wayland/SCsub

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ from misc.utility.scons_hints import *
33

44
Import("env")
55

6+
File = env.File
7+
68
# TODO: Add warning to headers and code about their autogenerated status.
79
if env["use_sowrap"]:
810
# We have to implement separate builders for so wrappers as the
@@ -41,14 +43,14 @@ else:
4143

4244

4345
def generate_from_xml(name, path):
44-
header = env.WAYLAND_API_HEADER(f"protocol/{name}.gen.h", path)
45-
source = env.WAYLAND_API_CODE(f"protocol/{name}.gen.c", path)
46+
header = env.WAYLAND_API_HEADER(File(f"protocol/{name}.gen.h"), path)
47+
source = env.WAYLAND_API_CODE(File(f"protocol/{name}.gen.c"), path)
4648
env.NoCache(header, source)
4749

48-
return env.Object(f"protocol/{name}.gen.c")
50+
return source
4951

5052

51-
objects = [
53+
generated_sources = [
5254
# Core protocol
5355
generate_from_xml("wayland", "#thirdparty/wayland/protocol/wayland.xml"),
5456
# Stable protocols
@@ -97,34 +99,31 @@ objects = [
9799
),
98100
]
99101

100-
source_files = [
101-
"detect_prime_egl.cpp",
102-
"display_server_wayland.cpp",
103-
"key_mapping_xkb.cpp",
104-
"wayland_thread.cpp",
102+
source_files = generated_sources + [
103+
File("detect_prime_egl.cpp"),
104+
File("display_server_wayland.cpp"),
105+
File("key_mapping_xkb.cpp"),
106+
File("wayland_thread.cpp"),
105107
]
106108

107109
if env["use_sowrap"]:
108110
source_files.append(
109111
[
110-
"dynwrappers/wayland-cursor-so_wrap.c",
111-
"dynwrappers/wayland-client-core-so_wrap.c",
112-
"dynwrappers/wayland-egl-core-so_wrap.c",
112+
File("dynwrappers/wayland-cursor-so_wrap.c"),
113+
File("dynwrappers/wayland-client-core-so_wrap.c"),
114+
File("dynwrappers/wayland-egl-core-so_wrap.c"),
113115
]
114116
)
115117

116118
if env["libdecor"]:
117-
source_files.append("dynwrappers/libdecor-so_wrap.c")
119+
source_files.append(File("dynwrappers/libdecor-so_wrap.c"))
118120

119121

120122
if env["vulkan"]:
121-
source_files.append("rendering_context_driver_vulkan_wayland.cpp")
123+
source_files.append(File("rendering_context_driver_vulkan_wayland.cpp"))
122124

123125
if env["opengl3"]:
124-
source_files.append("egl_manager_wayland.cpp")
125-
source_files.append("egl_manager_wayland_gles.cpp")
126-
127-
for source_file in source_files:
128-
objects.append(env.Object(source_file))
126+
source_files.append(File("egl_manager_wayland.cpp"))
127+
source_files.append(File("egl_manager_wayland_gles.cpp"))
129128

130-
Return("objects")
129+
Return("source_files")

platform/linuxbsd/x11/SCsub

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,36 +3,38 @@ from misc.utility.scons_hints import *
33

44
Import("env")
55

6+
File = env.File
7+
68
source_files = [
7-
"display_server_x11.cpp",
8-
"key_mapping_x11.cpp",
9+
File("display_server_x11.cpp"),
10+
File("key_mapping_x11.cpp"),
911
]
1012

1113
if env["use_sowrap"]:
1214
source_files.append(
1315
[
14-
"dynwrappers/xlib-so_wrap.c",
15-
"dynwrappers/xcursor-so_wrap.c",
16-
"dynwrappers/xinerama-so_wrap.c",
17-
"dynwrappers/xinput2-so_wrap.c",
18-
"dynwrappers/xrandr-so_wrap.c",
19-
"dynwrappers/xrender-so_wrap.c",
20-
"dynwrappers/xext-so_wrap.c",
16+
File("dynwrappers/xlib-so_wrap.c"),
17+
File("dynwrappers/xcursor-so_wrap.c"),
18+
File("dynwrappers/xinerama-so_wrap.c"),
19+
File("dynwrappers/xinput2-so_wrap.c"),
20+
File("dynwrappers/xrandr-so_wrap.c"),
21+
File("dynwrappers/xrender-so_wrap.c"),
22+
File("dynwrappers/xext-so_wrap.c"),
2123
]
2224
)
2325

2426
if env["vulkan"]:
25-
source_files.append("rendering_context_driver_vulkan_x11.cpp")
27+
source_files.append(File("rendering_context_driver_vulkan_x11.cpp"))
2628

2729
if env["opengl3"]:
2830
env.Append(CPPDEFINES=["GLAD_GLX_NO_X11"])
2931
source_files.append(
30-
["gl_manager_x11_egl.cpp", "gl_manager_x11.cpp", "detect_prime_x11.cpp", "#thirdparty/glad/glx.c"]
32+
[
33+
File("gl_manager_x11_egl.cpp"),
34+
File("gl_manager_x11.cpp"),
35+
File("detect_prime_x11.cpp"),
36+
File("#thirdparty/glad/glx.c"),
37+
]
3138
)
3239

33-
objects = []
34-
35-
for source_file in source_files:
36-
objects.append(env.Object(source_file))
37-
38-
Return("objects")
40+
Return("source_files")

0 commit comments

Comments
 (0)