SCsub 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #!/usr/bin/env python
  2. Import("env")
  3. Import("env_modules")
  4. env_basisu = env_modules.Clone()
  5. # Thirdparty source files
  6. thirdparty_obj = []
  7. # Not unbundled so far since not widespread as shared library
  8. thirdparty_dir = "#thirdparty/basis_universal/"
  9. # Sync list with upstream CMakeLists.txt
  10. encoder_sources = [
  11. "basisu_backend.cpp",
  12. "basisu_basis_file.cpp",
  13. "basisu_bc7enc.cpp",
  14. "basisu_opencl.cpp",
  15. "basisu_comp.cpp",
  16. "basisu_enc.cpp",
  17. "basisu_etc.cpp",
  18. "basisu_frontend.cpp",
  19. "basisu_gpu_texture.cpp",
  20. "basisu_kernels_sse.cpp",
  21. "basisu_pvrtc1_4.cpp",
  22. "basisu_resampler.cpp",
  23. "basisu_resample_filters.cpp",
  24. "basisu_ssim.cpp",
  25. "basisu_uastc_enc.cpp",
  26. "pvpngreader.cpp",
  27. ]
  28. encoder_sources = [thirdparty_dir + "encoder/" + file for file in encoder_sources]
  29. transcoder_sources = [thirdparty_dir + "transcoder/basisu_transcoder.cpp"]
  30. # Treat Basis headers as system headers to avoid raising warnings. Not supported on MSVC.
  31. if not env.msvc:
  32. env_basisu.Append(
  33. CPPFLAGS=["-isystem", Dir(thirdparty_dir).path, "-isystem", Dir("#thirdparty/jpeg-compressor").path]
  34. )
  35. else:
  36. env_basisu.Prepend(CPPPATH=[thirdparty_dir, "#thirdparty/jpeg-compressor"])
  37. if env["builtin_zstd"]:
  38. env_basisu.Prepend(CPPPATH=["#thirdparty/zstd"])
  39. if env.dev_build:
  40. env_basisu.Append(CPPDEFINES=[("BASISU_DEVEL_MESSAGES", 1), ("BASISD_ENABLE_DEBUG_FLAGS", 1)])
  41. env_thirdparty = env_basisu.Clone()
  42. env_thirdparty.disable_warnings()
  43. if env.editor_build:
  44. env_thirdparty.Append(CPPDEFINES=["BASISU_NO_IMG_LOADERS"])
  45. env_thirdparty.add_source_files(thirdparty_obj, encoder_sources)
  46. env_thirdparty.add_source_files(thirdparty_obj, transcoder_sources)
  47. env.modules_sources += thirdparty_obj
  48. # Godot source files
  49. module_obj = []
  50. env_basisu.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)