SCsub 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. # Treat glslang headers as system headers to avoid raising warnings. Not supported on MSVC.
  58. # Include `#thirdparty` to workaround mismatch between location of `SPIRV` in library source
  59. # and in installed public headers.
  60. if not env.msvc:
  61. env_glslang.Append(CPPFLAGS=["-isystem", Dir(thirdparty_dir).path, "-isystem", Dir("#thirdparty").path])
  62. else:
  63. env_glslang.Prepend(CPPPATH=[thirdparty_dir, "#thirdparty"])
  64. env_glslang.Append(CPPDEFINES=["ENABLE_OPT=0"])
  65. env_thirdparty = env_glslang.Clone()
  66. env_thirdparty.disable_warnings()
  67. env_thirdparty.add_source_files(thirdparty_obj, thirdparty_sources)
  68. env.modules_sources += thirdparty_obj
  69. # Godot source files
  70. module_obj = []
  71. env_glslang.add_source_files(module_obj, "*.cpp")
  72. env.modules_sources += module_obj
  73. # Needed to force rebuilding the module files when the thirdparty library is updated.
  74. env.Depends(module_obj, thirdparty_obj)