2023-04-29 00:26:01 +08:00
|
|
|
#!/usr/bin/env python
|
2024-06-12 04:19:07 +08:00
|
|
|
from misc.utility.scons_hints import *
|
2023-04-29 00:26:01 +08:00
|
|
|
|
|
|
|
Import("env")
|
|
|
|
Import("env_modules")
|
|
|
|
|
|
|
|
env_ktx = env_modules.Clone()
|
|
|
|
|
|
|
|
# libktx thirdparty source files
|
|
|
|
|
|
|
|
thirdparty_obj = []
|
|
|
|
|
|
|
|
thirdparty_dir = "#thirdparty/libktx/"
|
|
|
|
thirdparty_sources = [
|
2023-08-19 22:49:08 +08:00
|
|
|
"lib/basis_transcode.cpp",
|
2023-04-29 00:26:01 +08:00
|
|
|
"lib/checkheader.c",
|
|
|
|
"lib/filestream.c",
|
|
|
|
"lib/hashlist.c",
|
|
|
|
"lib/memstream.c",
|
2024-02-08 02:55:27 +08:00
|
|
|
"lib/miniz_wrapper.cpp",
|
2023-04-29 00:26:01 +08:00
|
|
|
"lib/swap.c",
|
|
|
|
"lib/texture.c",
|
|
|
|
"lib/texture1.c",
|
|
|
|
"lib/texture2.c",
|
2024-02-08 02:55:27 +08:00
|
|
|
"lib/vkformat_check.c",
|
2024-04-05 16:44:32 +08:00
|
|
|
"lib/vkformat_typesize.c",
|
2023-04-29 00:26:01 +08:00
|
|
|
"lib/dfdutils/createdfd.c",
|
|
|
|
"lib/dfdutils/colourspaces.c",
|
|
|
|
"lib/dfdutils/interpretdfd.c",
|
|
|
|
"lib/dfdutils/printdfd.c",
|
|
|
|
"lib/dfdutils/queries.c",
|
|
|
|
"lib/dfdutils/vk2dfd.c",
|
|
|
|
]
|
|
|
|
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
|
|
|
|
|
|
|
|
env_ktx.Prepend(CPPPATH=[thirdparty_dir + "include"])
|
|
|
|
env_ktx.Prepend(CPPPATH=[thirdparty_dir + "utils"])
|
|
|
|
env_ktx.Prepend(CPPPATH=[thirdparty_dir + "lib"])
|
|
|
|
env_ktx.Prepend(CPPPATH=[thirdparty_dir + "other_include"])
|
2024-02-08 02:55:27 +08:00
|
|
|
|
2023-08-19 22:49:08 +08:00
|
|
|
env_ktx.Prepend(CPPPATH=["#thirdparty/basis_universal"])
|
2024-02-08 02:55:27 +08:00
|
|
|
if env.editor_build:
|
|
|
|
# We already build miniz in the basis_universal module (editor only).
|
|
|
|
env_ktx.Append(CPPDEFINES=["MINIZ_HEADER_FILE_ONLY"])
|
2023-04-29 00:26:01 +08:00
|
|
|
|
|
|
|
if env["vulkan"]:
|
|
|
|
env_ktx.Prepend(CPPPATH=["#thirdparty/vulkan/include"])
|
|
|
|
else:
|
|
|
|
# Falls back on bundled `vkformat_enum.h`.
|
|
|
|
env_ktx.Append(CPPDEFINES=["LIBKTX"])
|
|
|
|
|
|
|
|
env_ktx.Append(CPPDEFINES=[("KHRONOS_STATIC", 1)])
|
|
|
|
|
|
|
|
env_thirdparty = env_ktx.Clone()
|
|
|
|
env_thirdparty.disable_warnings()
|
|
|
|
env_thirdparty.add_source_files(thirdparty_obj, thirdparty_sources)
|
|
|
|
env.modules_sources += thirdparty_obj
|
|
|
|
|
|
|
|
# Godot source files
|
|
|
|
module_obj = []
|
|
|
|
|
|
|
|
env_ktx.add_source_files(module_obj, "*.cpp")
|
|
|
|
env.modules_sources += module_obj
|
|
|
|
|
|
|
|
# Needed to force rebuilding the module files when the thirdparty library is updated.
|
|
|
|
env.Depends(module_obj, thirdparty_obj)
|