Ver Fonte

Fix: Libgodot build on Linux.

Ben Rog-Wilhelm há 2 meses atrás
pai
commit
0a584250ae

+ 0 - 1
platform/linuxbsd/SCsub

@@ -43,7 +43,6 @@ if env["dbus"]:
 if env["library_type"] == "static_library":
     prog = env.add_library("#bin/godot", common_linuxbsd)
 elif env["library_type"] == "shared_library":
-    env.Append(CCFLAGS=["-fPIC"])
     prog = env.add_shared_library("#bin/godot", common_linuxbsd)
 else:
     prog = env.add_program("#bin/godot", common_linuxbsd)

+ 3 - 0
platform/linuxbsd/detect.py

@@ -182,6 +182,9 @@ def configure(env: "SConsEnvironment"):
 
     env.Append(CCFLAGS=["-ffp-contract=off"])
 
+    if env["library_type"] == "shared_library":
+        env.Append(CCFLAGS=["-fPIC"])
+
     # LTO
 
     if env["lto"] == "auto":  # Enable LTO for production.

+ 19 - 20
platform/linuxbsd/wayland/SCsub

@@ -3,6 +3,8 @@ from misc.utility.scons_hints import *
 
 Import("env")
 
+File = env.File
+
 # TODO: Add warning to headers and code about their autogenerated status.
 if env["use_sowrap"]:
     # We have to implement separate builders for so wrappers as the
@@ -41,14 +43,14 @@ else:
 
 
 def generate_from_xml(name, path):
-    header = env.WAYLAND_API_HEADER(f"protocol/{name}.gen.h", path)
-    source = env.WAYLAND_API_CODE(f"protocol/{name}.gen.c", path)
+    header = env.WAYLAND_API_HEADER(File(f"protocol/{name}.gen.h"), path)
+    source = env.WAYLAND_API_CODE(File(f"protocol/{name}.gen.c"), path)
     env.NoCache(header, source)
 
-    return env.Object(f"protocol/{name}.gen.c")
+    return source
 
 
-objects = [
+generated_sources = [
     # Core protocol
     generate_from_xml("wayland", "#thirdparty/wayland/protocol/wayland.xml"),
     # Stable protocols
@@ -97,34 +99,31 @@ objects = [
     ),
 ]
 
-source_files = [
-    "detect_prime_egl.cpp",
-    "display_server_wayland.cpp",
-    "key_mapping_xkb.cpp",
-    "wayland_thread.cpp",
+source_files = generated_sources + [
+    File("detect_prime_egl.cpp"),
+    File("display_server_wayland.cpp"),
+    File("key_mapping_xkb.cpp"),
+    File("wayland_thread.cpp"),
 ]
 
 if env["use_sowrap"]:
     source_files.append(
         [
-            "dynwrappers/wayland-cursor-so_wrap.c",
-            "dynwrappers/wayland-client-core-so_wrap.c",
-            "dynwrappers/wayland-egl-core-so_wrap.c",
+            File("dynwrappers/wayland-cursor-so_wrap.c"),
+            File("dynwrappers/wayland-client-core-so_wrap.c"),
+            File("dynwrappers/wayland-egl-core-so_wrap.c"),
         ]
     )
 
     if env["libdecor"]:
-        source_files.append("dynwrappers/libdecor-so_wrap.c")
+        source_files.append(File("dynwrappers/libdecor-so_wrap.c"))
 
 
 if env["vulkan"]:
-    source_files.append("rendering_context_driver_vulkan_wayland.cpp")
+    source_files.append(File("rendering_context_driver_vulkan_wayland.cpp"))
 
 if env["opengl3"]:
-    source_files.append("egl_manager_wayland.cpp")
-    source_files.append("egl_manager_wayland_gles.cpp")
-
-for source_file in source_files:
-    objects.append(env.Object(source_file))
+    source_files.append(File("egl_manager_wayland.cpp"))
+    source_files.append(File("egl_manager_wayland_gles.cpp"))
 
-Return("objects")
+Return("source_files")

+ 19 - 17
platform/linuxbsd/x11/SCsub

@@ -3,36 +3,38 @@ from misc.utility.scons_hints import *
 
 Import("env")
 
+File = env.File
+
 source_files = [
-    "display_server_x11.cpp",
-    "key_mapping_x11.cpp",
+    File("display_server_x11.cpp"),
+    File("key_mapping_x11.cpp"),
 ]
 
 if env["use_sowrap"]:
     source_files.append(
         [
-            "dynwrappers/xlib-so_wrap.c",
-            "dynwrappers/xcursor-so_wrap.c",
-            "dynwrappers/xinerama-so_wrap.c",
-            "dynwrappers/xinput2-so_wrap.c",
-            "dynwrappers/xrandr-so_wrap.c",
-            "dynwrappers/xrender-so_wrap.c",
-            "dynwrappers/xext-so_wrap.c",
+            File("dynwrappers/xlib-so_wrap.c"),
+            File("dynwrappers/xcursor-so_wrap.c"),
+            File("dynwrappers/xinerama-so_wrap.c"),
+            File("dynwrappers/xinput2-so_wrap.c"),
+            File("dynwrappers/xrandr-so_wrap.c"),
+            File("dynwrappers/xrender-so_wrap.c"),
+            File("dynwrappers/xext-so_wrap.c"),
         ]
     )
 
 if env["vulkan"]:
-    source_files.append("rendering_context_driver_vulkan_x11.cpp")
+    source_files.append(File("rendering_context_driver_vulkan_x11.cpp"))
 
 if env["opengl3"]:
     env.Append(CPPDEFINES=["GLAD_GLX_NO_X11"])
     source_files.append(
-        ["gl_manager_x11_egl.cpp", "gl_manager_x11.cpp", "detect_prime_x11.cpp", "#thirdparty/glad/glx.c"]
+        [
+            File("gl_manager_x11_egl.cpp"),
+            File("gl_manager_x11.cpp"),
+            File("detect_prime_x11.cpp"),
+            File("#thirdparty/glad/glx.c"),
+        ]
     )
 
-objects = []
-
-for source_file in source_files:
-    objects.append(env.Object(source_file))
-
-Return("objects")
+Return("source_files")