| 1 |
|
| 2 |
from misc.utility.scons_hints import * |
| 3 |
|
| 4 |
Import("env") |
| 5 |
Import("env_modules") |
| 6 |
|
| 7 |
env_raycast = env_modules.Clone() |
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
thirdparty_obj = [] |
| 12 |
|
| 13 |
if env["builtin_embree"]: |
| 14 |
thirdparty_dir = "#thirdparty/embree/" |
| 15 |
|
| 16 |
embree_src = [ |
| 17 |
"common/sys/sysinfo.cpp", |
| 18 |
"common/sys/alloc.cpp", |
| 19 |
"common/sys/estring.cpp", |
| 20 |
"common/sys/filename.cpp", |
| 21 |
"common/sys/library.cpp", |
| 22 |
"common/sys/thread.cpp", |
| 23 |
"common/sys/regression.cpp", |
| 24 |
"common/sys/mutex.cpp", |
| 25 |
"common/sys/condition.cpp", |
| 26 |
"common/sys/barrier.cpp", |
| 27 |
"common/math/constants.cpp", |
| 28 |
"common/simd/sse.cpp", |
| 29 |
"common/lexers/stringstream.cpp", |
| 30 |
"common/lexers/tokenstream.cpp", |
| 31 |
"common/tasking/taskschedulerinternal.cpp", |
| 32 |
"kernels/common/device.cpp", |
| 33 |
"kernels/common/stat.cpp", |
| 34 |
"kernels/common/acceln.cpp", |
| 35 |
"kernels/common/accelset.cpp", |
| 36 |
"kernels/common/state.cpp", |
| 37 |
"kernels/common/rtcore.cpp", |
| 38 |
"kernels/common/rtcore_builder.cpp", |
| 39 |
"kernels/common/scene.cpp", |
| 40 |
"kernels/common/scene_verify.cpp", |
| 41 |
"kernels/common/alloc.cpp", |
| 42 |
"kernels/common/geometry.cpp", |
| 43 |
"kernels/common/scene_triangle_mesh.cpp", |
| 44 |
"kernels/geometry/primitive4.cpp", |
| 45 |
"kernels/builders/primrefgen.cpp", |
| 46 |
"kernels/bvh/bvh.cpp", |
| 47 |
"kernels/bvh/bvh_statistics.cpp", |
| 48 |
"kernels/bvh/bvh4_factory.cpp", |
| 49 |
"kernels/bvh/bvh8_factory.cpp", |
| 50 |
"kernels/bvh/bvh_collider.cpp", |
| 51 |
"kernels/bvh/bvh_rotate.cpp", |
| 52 |
"kernels/bvh/bvh_refit.cpp", |
| 53 |
"kernels/bvh/bvh_builder.cpp", |
| 54 |
"kernels/bvh/bvh_builder_morton.cpp", |
| 55 |
"kernels/bvh/bvh_builder_sah.cpp", |
| 56 |
"kernels/bvh/bvh_builder_sah_spatial.cpp", |
| 57 |
"kernels/bvh/bvh_builder_sah_mb.cpp", |
| 58 |
"kernels/bvh/bvh_builder_twolevel.cpp", |
| 59 |
"kernels/bvh/bvh_intersector1_bvh4.cpp", |
| 60 |
"kernels/bvh/bvh_intersector_hybrid4_bvh4.cpp", |
| 61 |
] |
| 62 |
|
| 63 |
thirdparty_sources = [thirdparty_dir + file for file in embree_src] |
| 64 |
|
| 65 |
env_raycast.Prepend(CPPPATH=[thirdparty_dir, thirdparty_dir + "include"]) |
| 66 |
env_raycast.Append(CPPDEFINES=["EMBREE_TARGET_SSE2", "EMBREE_LOWEST_ISA", "TASKING_INTERNAL"]) |
| 67 |
env_raycast.AppendUnique(CPPDEFINES=["NDEBUG"]) |
| 68 |
|
| 69 |
if env["platform"] == "windows": |
| 70 |
if env.msvc: |
| 71 |
env.Append(LINKFLAGS=["psapi.lib"]) |
| 72 |
else: |
| 73 |
env.Append(LIBS=["psapi"]) |
| 74 |
|
| 75 |
if env.msvc: |
| 76 |
env_raycast.Append(CCFLAGS=["/wd4324"]) |
| 77 |
|
| 78 |
env_thirdparty = env_raycast.Clone() |
| 79 |
env_thirdparty.force_optimization_on_debug() |
| 80 |
env_thirdparty.disable_warnings() |
| 81 |
env_thirdparty.add_source_files(thirdparty_obj, thirdparty_sources) |
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
if env["arch"] != "x86_64" or env.msvc: |
| 88 |
|
| 89 |
env_thirdparty.Append(CPPDEFINES=["__SSE__", "__SSE2__"]) |
| 90 |
|
| 91 |
if env["arch"] == "x86_64" and env.msvc: |
| 92 |
env_thirdparty.Append(CPPDEFINES=["__SSE3__", "__SSSE3__", "__SSE4_1__", "__SSE4_2__"]) |
| 93 |
|
| 94 |
if env["platform"] == "web": |
| 95 |
env_thirdparty.Append(CXXFLAGS=["-msimd128"]) |
| 96 |
|
| 97 |
if not env.msvc: |
| 98 |
|
| 99 |
if env["arch"] == "arm64" and env["platform"] == "linuxbsd" and not env["use_llvm"]: |
| 100 |
env_thirdparty.Append(CXXFLAGS=["-flax-vector-conversions"]) |
| 101 |
|
| 102 |
env_thirdparty.Append( |
| 103 |
CXXFLAGS=[ |
| 104 |
"-fno-strict-overflow", |
| 105 |
"-fno-delete-null-pointer-checks", |
| 106 |
"-fwrapv", |
| 107 |
"-fsigned-char", |
| 108 |
"-fno-strict-aliasing", |
| 109 |
"-fno-tree-vectorize", |
| 110 |
"-fvisibility=hidden", |
| 111 |
"-fvisibility-inlines-hidden", |
| 112 |
] |
| 113 |
) |
| 114 |
|
| 115 |
env.modules_sources += thirdparty_obj |
| 116 |
|
| 117 |
|
| 118 |
|
| 119 |
|
| 120 |
module_obj = [] |
| 121 |
|
| 122 |
env_raycast.add_source_files(module_obj, "*.cpp") |
| 123 |
env.modules_sources += module_obj |
| 124 |
|
| 125 |
|
| 126 |
env.Depends(module_obj, thirdparty_obj) |