SCsub 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. #!/usr/bin/env python
  2. from misc.utility.scons_hints import *
  3. Import("env")
  4. Import("env_modules")
  5. env_glslang = env_modules.Clone()
  6. # Thirdparty source files
  7. thirdparty_obj = []
  8. if env["builtin_glslang"]:
  9. thirdparty_dir = "#thirdparty/glslang/"
  10. thirdparty_sources = [
  11. "glslang/GenericCodeGen/CodeGen.cpp",
  12. "glslang/GenericCodeGen/Link.cpp",
  13. "glslang/MachineIndependent/attribute.cpp",
  14. "glslang/MachineIndependent/Constant.cpp",
  15. "glslang/MachineIndependent/glslang_tab.cpp",
  16. "glslang/MachineIndependent/InfoSink.cpp",
  17. "glslang/MachineIndependent/Initialize.cpp",
  18. "glslang/MachineIndependent/Intermediate.cpp",
  19. "glslang/MachineIndependent/intermOut.cpp",
  20. "glslang/MachineIndependent/IntermTraverse.cpp",
  21. "glslang/MachineIndependent/iomapper.cpp",
  22. "glslang/MachineIndependent/limits.cpp",
  23. "glslang/MachineIndependent/linkValidate.cpp",
  24. "glslang/MachineIndependent/parseConst.cpp",
  25. "glslang/MachineIndependent/ParseContextBase.cpp",
  26. "glslang/MachineIndependent/ParseHelper.cpp",
  27. "glslang/MachineIndependent/PoolAlloc.cpp",
  28. "glslang/MachineIndependent/preprocessor/PpAtom.cpp",
  29. "glslang/MachineIndependent/preprocessor/PpContext.cpp",
  30. "glslang/MachineIndependent/preprocessor/Pp.cpp",
  31. "glslang/MachineIndependent/preprocessor/PpScanner.cpp",
  32. "glslang/MachineIndependent/preprocessor/PpTokens.cpp",
  33. "glslang/MachineIndependent/propagateNoContraction.cpp",
  34. "glslang/MachineIndependent/reflection.cpp",
  35. "glslang/MachineIndependent/RemoveTree.cpp",
  36. "glslang/MachineIndependent/Scan.cpp",
  37. "glslang/MachineIndependent/ShaderLang.cpp",
  38. "glslang/MachineIndependent/SpirvIntrinsics.cpp",
  39. "glslang/MachineIndependent/SymbolTable.cpp",
  40. "glslang/MachineIndependent/Versions.cpp",
  41. "glslang/ResourceLimits/ResourceLimits.cpp",
  42. "SPIRV/disassemble.cpp",
  43. "SPIRV/doc.cpp",
  44. "SPIRV/GlslangToSpv.cpp",
  45. "SPIRV/InReadableOrder.cpp",
  46. "SPIRV/Logger.cpp",
  47. "SPIRV/SpvBuilder.cpp",
  48. "SPIRV/SpvPostProcess.cpp",
  49. "SPIRV/SPVRemapper.cpp",
  50. "SPIRV/SpvTools.cpp",
  51. ]
  52. if env["platform"] == "windows":
  53. thirdparty_sources.append("glslang/OSDependent/Windows/ossource.cpp")
  54. else:
  55. thirdparty_sources.append("glslang/OSDependent/Unix/ossource.cpp")
  56. thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
  57. # Include `#thirdparty` to workaround mismatch between location of `SPIRV` in library source
  58. # and in installed public headers.
  59. env_glslang.Prepend(CPPEXTPATH=[thirdparty_dir, "#thirdparty"])
  60. env_glslang.Append(CPPDEFINES=["ENABLE_OPT=0"])
  61. env_thirdparty = env_glslang.Clone()
  62. env_thirdparty.disable_warnings()
  63. env_thirdparty.add_source_files(thirdparty_obj, thirdparty_sources)
  64. env.modules_sources += thirdparty_obj
  65. # Godot source files
  66. module_obj = []
  67. env_glslang.add_source_files(module_obj, "*.cpp")
  68. env.modules_sources += module_obj
  69. # Needed to force rebuilding the module files when the thirdparty library is updated.
  70. env.Depends(module_obj, thirdparty_obj)