Skip to content
0.2.0-dev Download ZIP
68 lines ·2.0 KB Raw
1#!/usr/bin/env python
2from misc.utility.scons_hints import *
3
4Import("env")
5Import("env_modules")
6
7env_ktx = env_modules.Clone()
8
9# libktx thirdparty source files
10
11thirdparty_obj = []
12
13thirdparty_dir = "#thirdparty/libktx/"
14thirdparty_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]
35thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
36
37env_ktx.Prepend(CPPPATH=[thirdparty_dir + "include"])
38env_ktx.Prepend(CPPPATH=[thirdparty_dir + "utils"])
39env_ktx.Prepend(CPPPATH=[thirdparty_dir + "lib"])
40env_ktx.Prepend(CPPPATH=[thirdparty_dir + "other_include"])
41env_ktx.Prepend(CPPPATH=[thirdparty_dir + "external"])
42
43env_ktx.Prepend(CPPPATH=["#thirdparty/basis_universal"])
44if 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
48if env["vulkan"]:
49 env_ktx.Prepend(CPPPATH=["#thirdparty/vulkan/include"])
50else:
51 # Falls back on bundled `vkformat_enum.h`.
52 env_ktx.Append(CPPDEFINES=["LIBKTX"])
53
54env_ktx.Append(CPPDEFINES=[("KHRONOS_STATIC", 1)])
55
56env_thirdparty = env_ktx.Clone()
57env_thirdparty.disable_warnings()
58env_thirdparty.add_source_files(thirdparty_obj, thirdparty_sources)
59env.modules_sources += thirdparty_obj
60
61# Godot source files
62module_obj = []
63
64env_ktx.add_source_files(module_obj, "*.cpp")
65env.modules_sources += module_obj
66
67# Needed to force rebuilding the module files when the thirdparty library is updated.
68env.Depends(module_obj, thirdparty_obj)