SCsub 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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_check_variant.c",
  22. "lib/vkformat_typesize.c",
  23. "external/dfdutils/createdfd.c",
  24. "external/dfdutils/colourspaces.c",
  25. "external/dfdutils/interpretdfd.c",
  26. "external/dfdutils/printdfd.c",
  27. "external/dfdutils/queries.c",
  28. "external/dfdutils/vk2dfd.c",
  29. ]
  30. thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
  31. env_ktx.Prepend(CPPPATH=[thirdparty_dir + "include"])
  32. env_ktx.Prepend(CPPPATH=[thirdparty_dir + "utils"])
  33. env_ktx.Prepend(CPPPATH=[thirdparty_dir + "lib"])
  34. env_ktx.Prepend(CPPPATH=[thirdparty_dir + "other_include"])
  35. env_ktx.Prepend(CPPPATH=[thirdparty_dir + "external"])
  36. env_ktx.Prepend(CPPPATH=["#thirdparty/basis_universal"])
  37. if env.editor_build:
  38. # We already build miniz in the basis_universal module (editor only).
  39. env_ktx.Append(CPPDEFINES=["MINIZ_HEADER_FILE_ONLY"])
  40. if env["vulkan"]:
  41. env_ktx.Prepend(CPPPATH=["#thirdparty/vulkan/include"])
  42. else:
  43. # Falls back on bundled `vkformat_enum.h`.
  44. env_ktx.Append(CPPDEFINES=["LIBKTX"])
  45. env_ktx.Append(CPPDEFINES=[("KHRONOS_STATIC", 1)])
  46. env_thirdparty = env_ktx.Clone()
  47. env_thirdparty.disable_warnings()
  48. env_thirdparty.add_source_files(thirdparty_obj, thirdparty_sources)
  49. env.modules_sources += thirdparty_obj
  50. # Godot source files
  51. module_obj = []
  52. env_ktx.add_source_files(module_obj, "*.cpp")
  53. env.modules_sources += module_obj
  54. # Needed to force rebuilding the module files when the thirdparty library is updated.
  55. env.Depends(module_obj, thirdparty_obj)