Skip to content

Commit

Permalink
Don't apply Embree-specific compiler flags and defines to the raycast…
Browse files Browse the repository at this point in the history
… module
  • Loading branch information
MonterraByte committed Aug 5, 2024
1 parent e9d8736 commit efdbc98
Showing 1 changed file with 25 additions and 25 deletions.
50 changes: 25 additions & 25 deletions modules/raycast/SCsub
Original file line number Diff line number Diff line change
Expand Up @@ -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__"]
Expand Down Expand Up @@ -119,61 +127,53 @@ 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:
env.Append(LINKFLAGS=["psapi.lib"])
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"])

Expand Down

0 comments on commit efdbc98

Please sign in to comment.