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