diff --git a/modules/raycast/SCsub b/modules/raycast/SCsub index be19066781df..2b881e9d4b52 100644 --- a/modules/raycast/SCsub +++ b/modules/raycast/SCsub @@ -81,9 +81,17 @@ if env["builtin_embree"]: thirdparty_sources = [thirdparty_dir + file for file in embree_src] env_raycast.Prepend(CPPPATH=[thirdparty_dir, thirdparty_dir + "include"]) - env_raycast.Append(CPPDEFINES=["EMBREE_LOWEST_ISA", "TASKING_INTERNAL"]) env_raycast.AppendUnique(CPPDEFINES=["NDEBUG"]) # No assert() even in debug builds. + if env.msvc: # Disable bogus warning about intentional struct padding. + env_raycast.Append(CCFLAGS=["/wd4324"]) + + env_thirdparty = env_raycast.Clone() + env_thirdparty.force_optimization_on_debug() + env_thirdparty.disable_warnings() + env_thirdparty.add_source_files(thirdparty_obj, thirdparty_sources) + env_thirdparty.Append(CPPDEFINES=["EMBREE_LOWEST_ISA", "TASKING_INTERNAL"]) + # These defines are used for MSVC (to signal SSE support) and for ARM (to enable use of NEON in Embree code) sse2_defines = ["__SSE__", "__SSE2__"] sse42_defines = ["__SSE4_1__", "__SSE4_2__"] @@ -119,46 +127,46 @@ if env["builtin_embree"]: arm = env["arch"] in ["arm32", "arm64"] if env["builtin_embree_isa"] == "sse2": - env_raycast.Append(CPPDEFINES=["EMBREE_TARGET_SSE2"]) + env_thirdparty.Append(CPPDEFINES=["EMBREE_TARGET_SSE2"]) if not arm: - env_raycast.Append(CCFLAGS=sse2_flags) + env_thirdparty.Append(CCFLAGS=sse2_flags) if env.msvc or arm: - env_raycast.Append(CPPDEFINES=sse2_defines) + env_thirdparty.Append(CPPDEFINES=sse2_defines) if env["platform"] == "windows" and not env.msvc and env["arch"] == "x86_32": - env_raycast.Append(CCFLAGS=["-mstackrealign"]) + env_thirdparty.Append(CCFLAGS=["-mstackrealign"]) elif env["builtin_embree_isa"] == "sse42": - env_raycast.Append(CPPDEFINES=["EMBREE_TARGET_SSE42"]) + env_thirdparty.Append(CPPDEFINES=["EMBREE_TARGET_SSE42"]) if not arm: - env_raycast.Append(CCFLAGS=sse42_flags) + env_thirdparty.Append(CCFLAGS=sse42_flags) if env.msvc or arm: - env_raycast.Append(CPPDEFINES=sse42_defines) + env_thirdparty.Append(CPPDEFINES=sse42_defines) if env["platform"] == "windows" and not env.msvc and env["arch"] == "x86_32": - env_raycast.Append(CCFLAGS=["-mstackrealign"]) + env_thirdparty.Append(CCFLAGS=["-mstackrealign"]) elif env["builtin_embree_isa"] == "avx": - env_raycast.Append(CPPDEFINES=["EMBREE_TARGET_AVX"]) + env_thirdparty.Append(CPPDEFINES=["EMBREE_TARGET_AVX"]) if not arm: - env_raycast.Append(CCFLAGS=avx_flags) + env_thirdparty.Append(CCFLAGS=avx_flags) else: - env_raycast.Append(CPPDEFINES=avx_defines) + env_thirdparty.Append(CPPDEFINES=avx_defines) elif env["builtin_embree_isa"] == "avx2": - env_raycast.Append(CPPDEFINES=["EMBREE_TARGET_AVX2"]) + env_thirdparty.Append(CPPDEFINES=["EMBREE_TARGET_AVX2"]) if not arm: - env_raycast.Append(CCFLAGS=avx2_flags) + env_thirdparty.Append(CCFLAGS=avx2_flags) else: - env_raycast.Append(CPPDEFINES=avx2_defines) + env_thirdparty.Append(CPPDEFINES=avx2_defines) elif env["builtin_embree_isa"] == "avx512": - env_raycast.Append(CPPDEFINES=["EMBREE_TARGET_AVX512"]) + env_thirdparty.Append(CPPDEFINES=["EMBREE_TARGET_AVX512"]) if not arm: - env_raycast.Append(CCFLAGS=avx512_flags) + env_thirdparty.Append(CCFLAGS=avx512_flags) if env["platform"] == "windows": if env.msvc: @@ -166,14 +174,6 @@ if env["builtin_embree"]: else: env.Append(LIBS=["psapi"]) - if env.msvc: # Disable bogus warning about intentional struct padding. - env_raycast.Append(CCFLAGS=["/wd4324"]) - - env_thirdparty = env_raycast.Clone() - env_thirdparty.force_optimization_on_debug() - env_thirdparty.disable_warnings() - env_thirdparty.add_source_files(thirdparty_obj, thirdparty_sources) - if env["platform"] == "web": env_thirdparty.Append(CXXFLAGS=["-msimd128"])