2019-07-28 22:58:32 +00:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
2020-03-30 06:28:32 +00:00
|
|
|
Import("env")
|
|
|
|
Import("env_modules")
|
2019-07-28 22:58:32 +00:00
|
|
|
|
|
|
|
env_glslang = env_modules.Clone()
|
|
|
|
|
|
|
|
# Thirdparty source files
|
2020-12-17 15:01:36 +00:00
|
|
|
|
|
|
|
thirdparty_obj = []
|
|
|
|
|
2020-03-30 06:28:32 +00:00
|
|
|
if env["builtin_glslang"]:
|
2019-09-27 07:39:53 +00:00
|
|
|
thirdparty_dir = "#thirdparty/glslang/"
|
|
|
|
thirdparty_sources = [
|
2023-09-01 09:11:12 +00:00
|
|
|
"glslang/GenericCodeGen/CodeGen.cpp",
|
|
|
|
"glslang/GenericCodeGen/Link.cpp",
|
2019-09-27 07:39:53 +00:00
|
|
|
"glslang/MachineIndependent/attribute.cpp",
|
|
|
|
"glslang/MachineIndependent/Constant.cpp",
|
2021-09-22 10:40:17 +00:00
|
|
|
"glslang/MachineIndependent/glslang_tab.cpp",
|
|
|
|
"glslang/MachineIndependent/InfoSink.cpp",
|
|
|
|
"glslang/MachineIndependent/Initialize.cpp",
|
|
|
|
"glslang/MachineIndependent/Intermediate.cpp",
|
|
|
|
"glslang/MachineIndependent/intermOut.cpp",
|
|
|
|
"glslang/MachineIndependent/IntermTraverse.cpp",
|
|
|
|
"glslang/MachineIndependent/iomapper.cpp",
|
2019-09-27 07:39:53 +00:00
|
|
|
"glslang/MachineIndependent/limits.cpp",
|
2021-09-22 10:40:17 +00:00
|
|
|
"glslang/MachineIndependent/linkValidate.cpp",
|
|
|
|
"glslang/MachineIndependent/parseConst.cpp",
|
|
|
|
"glslang/MachineIndependent/ParseContextBase.cpp",
|
|
|
|
"glslang/MachineIndependent/ParseHelper.cpp",
|
|
|
|
"glslang/MachineIndependent/PoolAlloc.cpp",
|
2019-09-27 07:39:53 +00:00
|
|
|
"glslang/MachineIndependent/preprocessor/PpAtom.cpp",
|
|
|
|
"glslang/MachineIndependent/preprocessor/PpContext.cpp",
|
|
|
|
"glslang/MachineIndependent/preprocessor/Pp.cpp",
|
2021-09-22 10:40:17 +00:00
|
|
|
"glslang/MachineIndependent/preprocessor/PpScanner.cpp",
|
|
|
|
"glslang/MachineIndependent/preprocessor/PpTokens.cpp",
|
|
|
|
"glslang/MachineIndependent/propagateNoContraction.cpp",
|
|
|
|
"glslang/MachineIndependent/reflection.cpp",
|
|
|
|
"glslang/MachineIndependent/RemoveTree.cpp",
|
|
|
|
"glslang/MachineIndependent/Scan.cpp",
|
|
|
|
"glslang/MachineIndependent/ShaderLang.cpp",
|
|
|
|
"glslang/MachineIndependent/SpirvIntrinsics.cpp",
|
2019-09-27 07:39:53 +00:00
|
|
|
"glslang/MachineIndependent/SymbolTable.cpp",
|
|
|
|
"glslang/MachineIndependent/Versions.cpp",
|
2023-09-01 09:11:12 +00:00
|
|
|
"glslang/ResourceLimits/ResourceLimits.cpp",
|
2019-09-27 07:39:53 +00:00
|
|
|
"OGLCompilersDLL/InitializeDll.cpp",
|
|
|
|
"SPIRV/disassemble.cpp",
|
|
|
|
"SPIRV/doc.cpp",
|
2021-09-22 10:40:17 +00:00
|
|
|
"SPIRV/GlslangToSpv.cpp",
|
|
|
|
"SPIRV/InReadableOrder.cpp",
|
2020-03-30 06:28:32 +00:00
|
|
|
"SPIRV/Logger.cpp",
|
2021-09-22 10:40:17 +00:00
|
|
|
"SPIRV/SpvBuilder.cpp",
|
|
|
|
"SPIRV/SpvPostProcess.cpp",
|
|
|
|
"SPIRV/SPVRemapper.cpp",
|
|
|
|
"SPIRV/SpvTools.cpp",
|
2019-09-27 07:39:53 +00:00
|
|
|
]
|
2019-07-28 22:58:32 +00:00
|
|
|
|
2020-03-30 06:28:32 +00:00
|
|
|
if env["platform"] == "windows":
|
2019-09-27 07:39:53 +00:00
|
|
|
thirdparty_sources.append("glslang/OSDependent/Windows/ossource.cpp")
|
|
|
|
else:
|
|
|
|
thirdparty_sources.append("glslang/OSDependent/Unix/ossource.cpp")
|
2019-07-28 22:58:32 +00:00
|
|
|
|
2019-09-27 07:39:53 +00:00
|
|
|
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
|
2019-07-28 22:58:32 +00:00
|
|
|
|
2020-02-18 13:57:11 +00:00
|
|
|
# Treat glslang headers as system headers to avoid raising warnings. Not supported on MSVC.
|
2022-01-12 11:28:43 +00:00
|
|
|
# Include `#thirdparty` to workaround mismatch between location of `SPIRV` in library source
|
|
|
|
# and in installed public headers.
|
2020-02-18 13:57:11 +00:00
|
|
|
if not env.msvc:
|
2022-01-12 11:28:43 +00:00
|
|
|
env_glslang.Append(CPPFLAGS=["-isystem", Dir(thirdparty_dir).path, "-isystem", Dir("#thirdparty").path])
|
2020-02-18 13:57:11 +00:00
|
|
|
else:
|
2022-01-12 11:28:43 +00:00
|
|
|
env_glslang.Prepend(CPPPATH=[thirdparty_dir, "#thirdparty"])
|
2019-09-27 07:39:53 +00:00
|
|
|
|
2020-10-15 10:04:10 +00:00
|
|
|
env_glslang.Append(CPPDEFINES=["ENABLE_OPT=0"])
|
|
|
|
|
2019-09-27 07:39:53 +00:00
|
|
|
env_thirdparty = env_glslang.Clone()
|
|
|
|
env_thirdparty.disable_warnings()
|
2020-12-17 15:01:36 +00:00
|
|
|
env_thirdparty.add_source_files(thirdparty_obj, thirdparty_sources)
|
|
|
|
env.modules_sources += thirdparty_obj
|
|
|
|
|
|
|
|
|
|
|
|
# Godot source files
|
|
|
|
|
|
|
|
module_obj = []
|
|
|
|
|
|
|
|
env_glslang.add_source_files(module_obj, "*.cpp")
|
|
|
|
env.modules_sources += module_obj
|
2019-07-28 22:58:32 +00:00
|
|
|
|
2020-12-17 15:01:36 +00:00
|
|
|
# Needed to force rebuilding the module files when the thirdparty library is updated.
|
|
|
|
env.Depends(module_obj, thirdparty_obj)
|