embree: Allow building against system library on Linux
This commit is contained in:
parent
a86f5462cf
commit
b266cc2315
3 changed files with 96 additions and 86 deletions
|
@ -151,6 +151,7 @@ opts.Add(BoolVariable("use_precise_math_checks", "Math checks use very precise e
|
||||||
# Thirdparty libraries
|
# Thirdparty libraries
|
||||||
opts.Add(BoolVariable("builtin_bullet", "Use the built-in Bullet library", True))
|
opts.Add(BoolVariable("builtin_bullet", "Use the built-in Bullet library", True))
|
||||||
opts.Add(BoolVariable("builtin_certs", "Use the built-in SSL certificates bundles", True))
|
opts.Add(BoolVariable("builtin_certs", "Use the built-in SSL certificates bundles", True))
|
||||||
|
opts.Add(BoolVariable("builtin_embree", "Use the built-in Embree library", True))
|
||||||
opts.Add(BoolVariable("builtin_enet", "Use the built-in ENet library", True))
|
opts.Add(BoolVariable("builtin_enet", "Use the built-in ENet library", True))
|
||||||
opts.Add(BoolVariable("builtin_freetype", "Use the built-in FreeType library", True))
|
opts.Add(BoolVariable("builtin_freetype", "Use the built-in FreeType library", True))
|
||||||
opts.Add(BoolVariable("builtin_libogg", "Use the built-in libogg library", True))
|
opts.Add(BoolVariable("builtin_libogg", "Use the built-in libogg library", True))
|
||||||
|
|
|
@ -3,7 +3,14 @@
|
||||||
Import("env")
|
Import("env")
|
||||||
Import("env_modules")
|
Import("env_modules")
|
||||||
|
|
||||||
embree_src = [
|
env_raycast = env_modules.Clone()
|
||||||
|
|
||||||
|
# Thirdparty source files
|
||||||
|
|
||||||
|
if env["builtin_embree"]:
|
||||||
|
thirdparty_dir = "#thirdparty/embree/"
|
||||||
|
|
||||||
|
embree_src = [
|
||||||
"common/sys/sysinfo.cpp",
|
"common/sys/sysinfo.cpp",
|
||||||
"common/sys/alloc.cpp",
|
"common/sys/alloc.cpp",
|
||||||
"common/sys/filename.cpp",
|
"common/sys/filename.cpp",
|
||||||
|
@ -56,39 +63,37 @@ embree_src = [
|
||||||
"kernels/bvh/bvh_builder_sah_mb.cpp",
|
"kernels/bvh/bvh_builder_sah_mb.cpp",
|
||||||
"kernels/bvh/bvh_builder_twolevel.cpp",
|
"kernels/bvh/bvh_builder_twolevel.cpp",
|
||||||
"kernels/bvh/bvh_intersector1_bvh4.cpp",
|
"kernels/bvh/bvh_intersector1_bvh4.cpp",
|
||||||
]
|
|
||||||
|
|
||||||
embree_dir = "#thirdparty/embree/"
|
|
||||||
|
|
||||||
env_embree = env_modules.Clone()
|
|
||||||
embree_sources = [embree_dir + file for file in embree_src]
|
|
||||||
env_embree.Prepend(CPPPATH=[embree_dir, embree_dir + "include"])
|
|
||||||
env_embree.Append(
|
|
||||||
CPPFLAGS=[
|
|
||||||
"-DEMBREE_TARGET_SSE2",
|
|
||||||
"-DEMBREE_LOWEST_ISA",
|
|
||||||
"-DTASKING_INTERNAL",
|
|
||||||
"-DNDEBUG",
|
|
||||||
"-D__SSE2__",
|
|
||||||
"-D__SSE__",
|
|
||||||
]
|
]
|
||||||
)
|
|
||||||
|
|
||||||
if not env_embree.msvc:
|
thirdparty_sources = [thirdparty_dir + file for file in embree_src]
|
||||||
env_embree.Append(CPPFLAGS=["-msse2", "-mxsave"])
|
|
||||||
|
env_raycast.Prepend(CPPPATH=[thirdparty_dir, thirdparty_dir + "include"])
|
||||||
|
env_raycast.Append(
|
||||||
|
CPPDEFINES=[
|
||||||
|
"EMBREE_TARGET_SSE2",
|
||||||
|
"EMBREE_LOWEST_ISA",
|
||||||
|
"TASKING_INTERNAL",
|
||||||
|
"NDEBUG",
|
||||||
|
"__SSE2__",
|
||||||
|
"__SSE__",
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
|
if not env.msvc:
|
||||||
|
env_raycast.Append(CPPFLAGS=["-msse2", "-mxsave"])
|
||||||
if env["platform"] == "windows":
|
if env["platform"] == "windows":
|
||||||
env_embree.Append(CPPFLAGS=["-mstackrealign"])
|
env_raycast.Append(CPPFLAGS=["-mstackrealign"])
|
||||||
|
|
||||||
if env["platform"] == "windows":
|
if env["platform"] == "windows":
|
||||||
if env.msvc:
|
if env.msvc:
|
||||||
env.Append(LINKFLAGS=["psapi.lib"])
|
env.Append(LINKFLAGS=["psapi.lib"])
|
||||||
else:
|
else:
|
||||||
env.Append(LIBS=["psapi"])
|
env.Append(LIBS=["psapi"])
|
||||||
|
|
||||||
env_embree.disable_warnings()
|
env_thirdparty = env_raycast.Clone()
|
||||||
env_embree.add_source_files(env.modules_sources, embree_sources)
|
env_thirdparty.disable_warnings()
|
||||||
|
env_thirdparty.add_source_files(env.modules_sources, thirdparty_sources)
|
||||||
|
|
||||||
env_raycast = env_modules.Clone()
|
|
||||||
env_raycast.Prepend(CPPPATH=[embree_dir, embree_dir + "include", embree_dir + "common"])
|
|
||||||
|
|
||||||
|
# Godot source files
|
||||||
env_raycast.add_source_files(env.modules_sources, "*.cpp")
|
env_raycast.add_source_files(env.modules_sources, "*.cpp")
|
||||||
|
|
|
@ -310,6 +310,10 @@ def configure(env):
|
||||||
if not env["builtin_pcre2"]:
|
if not env["builtin_pcre2"]:
|
||||||
env.ParseConfig("pkg-config libpcre2-32 --cflags --libs")
|
env.ParseConfig("pkg-config libpcre2-32 --cflags --libs")
|
||||||
|
|
||||||
|
if not env["builtin_embree"]:
|
||||||
|
# No pkgconfig file so far, hardcode expected lib name.
|
||||||
|
env.Append(LIBS=["embree3"])
|
||||||
|
|
||||||
## Flags
|
## Flags
|
||||||
|
|
||||||
if os.system("pkg-config --exists alsa") == 0: # 0 means found
|
if os.system("pkg-config --exists alsa") == 0: # 0 means found
|
||||||
|
|
Loading…
Reference in a new issue