SCsub 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #!/usr/bin/env python
  2. from misc.utility.scons_hints import *
  3. Import("env")
  4. Import("env_modules")
  5. env_ktx = env_modules.Clone()
  6. # libktx thirdparty source files
  7. thirdparty_obj = []
  8. thirdparty_dir = "#thirdparty/libktx/"
  9. thirdparty_sources = [
  10. "lib/basis_transcode.cpp",
  11. "lib/checkheader.c",
  12. "lib/filestream.c",
  13. "lib/hashlist.c",
  14. "lib/memstream.c",
  15. "lib/miniz_wrapper.cpp",
  16. "lib/swap.c",
  17. "lib/texture.c",
  18. "lib/texture1.c",
  19. "lib/texture2.c",
  20. "lib/vkformat_check.c",
  21. "lib/vkformat_typesize.c",
  22. "lib/dfdutils/createdfd.c",
  23. "lib/dfdutils/colourspaces.c",
  24. "lib/dfdutils/interpretdfd.c",
  25. "lib/dfdutils/printdfd.c",
  26. "lib/dfdutils/queries.c",
  27. "lib/dfdutils/vk2dfd.c",
  28. ]
  29. thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
  30. env_ktx.Prepend(CPPPATH=[thirdparty_dir + "include"])
  31. env_ktx.Prepend(CPPPATH=[thirdparty_dir + "utils"])
  32. env_ktx.Prepend(CPPPATH=[thirdparty_dir + "lib"])
  33. env_ktx.Prepend(CPPPATH=[thirdparty_dir + "other_include"])
  34. env_ktx.Prepend(CPPPATH=["#thirdparty/basis_universal"])
  35. if env.editor_build:
  36. # We already build miniz in the basis_universal module (editor only).
  37. env_ktx.Append(CPPDEFINES=["MINIZ_HEADER_FILE_ONLY"])
  38. if env["vulkan"]:
  39. env_ktx.Prepend(CPPPATH=["#thirdparty/vulkan/include"])
  40. else:
  41. # Falls back on bundled `vkformat_enum.h`.
  42. env_ktx.Append(CPPDEFINES=["LIBKTX"])
  43. env_ktx.Append(CPPDEFINES=[("KHRONOS_STATIC", 1)])
  44. env_thirdparty = env_ktx.Clone()
  45. env_thirdparty.disable_warnings()
  46. env_thirdparty.add_source_files(thirdparty_obj, thirdparty_sources)
  47. env.modules_sources += thirdparty_obj
  48. # Godot source files
  49. module_obj = []
  50. env_ktx.add_source_files(module_obj, "*.cpp")
  51. env.modules_sources += module_obj
  52. # Needed to force rebuilding the module files when the thirdparty library is updated.
  53. env.Depends(module_obj, thirdparty_obj)