SCons: Add explicit dependencies on thirdparty code in cloned env
Since we clone the environments to build thirdparty code, we don't get an explicit dependency on the build objects produced by that environment. So when we update thirdparty code, Godot code using it is not necessarily rebuilt (I think it is for changed headers, but not for changed .c/.cpp files), which can lead to an invalid compilation output (linking old Godot .o files with a newer, potentially ABI breaking version of thirdparty code). This was only seen as really problematic with bullet updates (leading to crashes when rebuilding Godot after a bullet update without cleaning .o files), but it's safer to fix it everywhere, even if it's a LOT of hacky boilerplate.
This commit is contained in:
parent
5332d212f9
commit
c7b53c03ae
50 changed files with 601 additions and 164 deletions
|
|
@ -5,6 +5,9 @@ Import("env")
|
|||
env_png = env.Clone()
|
||||
|
||||
# Thirdparty source files
|
||||
|
||||
thirdparty_obj = []
|
||||
|
||||
if env["builtin_libpng"]:
|
||||
thirdparty_dir = "#thirdparty/libpng/"
|
||||
thirdparty_sources = [
|
||||
|
|
@ -41,7 +44,7 @@ if env["builtin_libpng"]:
|
|||
|
||||
env_thirdparty = env_png.Clone()
|
||||
env_thirdparty.disable_warnings()
|
||||
env_thirdparty.add_source_files(env.drivers_sources, thirdparty_sources)
|
||||
env_thirdparty.add_source_files(thirdparty_obj, thirdparty_sources)
|
||||
|
||||
if use_neon:
|
||||
env_neon = env_thirdparty.Clone()
|
||||
|
|
@ -52,9 +55,17 @@ if env["builtin_libpng"]:
|
|||
neon_sources.append(env_neon.Object(thirdparty_dir + "/arm/filter_neon_intrinsics.c"))
|
||||
neon_sources.append(env_neon.Object(thirdparty_dir + "/arm/filter_neon.S"))
|
||||
neon_sources.append(env_neon.Object(thirdparty_dir + "/arm/palette_neon_intrinsics.c"))
|
||||
env.drivers_sources += neon_sources
|
||||
thirdparty_obj += neon_sources
|
||||
|
||||
env.drivers_sources += thirdparty_obj
|
||||
|
||||
|
||||
# Godot source files
|
||||
env_png.add_source_files(env.drivers_sources, "*.cpp")
|
||||
|
||||
Export("env")
|
||||
driver_obj = []
|
||||
|
||||
env_png.add_source_files(driver_obj, "*.cpp")
|
||||
env.drivers_sources += driver_obj
|
||||
|
||||
# Needed to force rebuilding the driver files when the thirdparty library is updated.
|
||||
env.Depends(driver_obj, thirdparty_obj)
|
||||
|
|
|
|||
|
|
@ -2,8 +2,7 @@
|
|||
|
||||
Import("env")
|
||||
|
||||
env_spirv_reflect = env.Clone()
|
||||
env_spirv_reflect.disable_warnings()
|
||||
# Thirdparty source files
|
||||
|
||||
thirdparty_dir = "#thirdparty/spirv-reflect/"
|
||||
thirdparty_sources = [
|
||||
|
|
@ -12,6 +11,7 @@ thirdparty_sources = [
|
|||
|
||||
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
|
||||
|
||||
env_spirv_reflect.add_source_files(env.drivers_sources, thirdparty_sources)
|
||||
env_thirdparty = env.Clone()
|
||||
env_thirdparty.disable_warnings()
|
||||
|
||||
Export("env")
|
||||
env_thirdparty.add_source_files(env.drivers_sources, thirdparty_sources)
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
Import("env")
|
||||
|
||||
env.add_source_files(env.drivers_sources, "*.cpp")
|
||||
thirdparty_obj = []
|
||||
|
||||
# FIXME: Refactor all this to reduce code duplication.
|
||||
if env["platform"] == "android":
|
||||
|
|
@ -22,7 +22,8 @@ if env["platform"] == "android":
|
|||
|
||||
thirdparty_dir = "#thirdparty/vulkan"
|
||||
vma_sources = [thirdparty_dir + "/android/vk_mem_alloc.cpp"]
|
||||
env_thirdparty.add_source_files(env.drivers_sources, vma_sources)
|
||||
env_thirdparty.add_source_files(thirdparty_obj, vma_sources)
|
||||
|
||||
elif env["platform"] == "iphone":
|
||||
# Use bundled Vulkan headers
|
||||
thirdparty_dir = "#thirdparty/vulkan"
|
||||
|
|
@ -33,7 +34,8 @@ elif env["platform"] == "iphone":
|
|||
env_thirdparty.disable_warnings()
|
||||
|
||||
vma_sources = [thirdparty_dir + "/vk_mem_alloc.cpp"]
|
||||
env_thirdparty.add_source_files(env.drivers_sources, vma_sources)
|
||||
env_thirdparty.add_source_files(thirdparty_obj, vma_sources)
|
||||
|
||||
elif env["builtin_vulkan"]:
|
||||
# Use bundled Vulkan headers
|
||||
thirdparty_dir = "#thirdparty/vulkan"
|
||||
|
|
@ -98,8 +100,9 @@ elif env["builtin_vulkan"]:
|
|||
env_thirdparty.AppendUnique(CPPDEFINES=["HAVE_SECURE_GETENV"])
|
||||
|
||||
loader_sources = [thirdparty_dir + "/loader/" + file for file in loader_sources]
|
||||
env_thirdparty.add_source_files(env.drivers_sources, loader_sources)
|
||||
env_thirdparty.add_source_files(env.drivers_sources, vma_sources)
|
||||
env_thirdparty.add_source_files(thirdparty_obj, loader_sources)
|
||||
env_thirdparty.add_source_files(thirdparty_obj, vma_sources)
|
||||
|
||||
else: # Always build VMA.
|
||||
thirdparty_dir = "#thirdparty/vulkan"
|
||||
env.Prepend(CPPPATH=[thirdparty_dir])
|
||||
|
|
@ -109,4 +112,18 @@ else: # Always build VMA.
|
|||
env_thirdparty.disable_warnings()
|
||||
vma_sources = [thirdparty_dir + "/vk_mem_alloc.cpp"]
|
||||
|
||||
env_thirdparty.add_source_files(env.drivers_sources, vma_sources)
|
||||
env_thirdparty.add_source_files(thirdparty_obj, vma_sources)
|
||||
|
||||
|
||||
env.drivers_sources += thirdparty_obj
|
||||
|
||||
|
||||
# Godot source files
|
||||
|
||||
driver_obj = []
|
||||
|
||||
env.add_source_files(driver_obj, "*.cpp")
|
||||
env.drivers_sources += driver_obj
|
||||
|
||||
# Needed to force rebuilding the driver files when the thirdparty code is updated.
|
||||
env.Depends(driver_obj, thirdparty_obj)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue