SCsub 1.6 KB

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