-
Notifications
You must be signed in to change notification settings - Fork 0
/
SConstruct
104 lines (93 loc) · 2.51 KB
/
SConstruct
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
import platform
AddOption(
'--release',
dest='release',
action='store_true',
help='Build in release mode',
default=False,
)
is_release = GetOption('release')
os = platform.system().lower()
env = Environment(
CPPPATH=[
"third_party/vk-bootstrap/src",
"third_party/fmt/include",
"third_party/VulkanMemoryAllocator/include",
"third_party/glm",
"third_party/tinyobjloader",
"third_party/imgui",
"third_party/imgui/backends",
"third_party/imgui/misc/cpp",
],
LIBPATH="bin",
LIBS=["SDL2", "imgui"],
)
if os == "darwin":
default_flags = ["-std=c++20", "-Wall"]
release_flags = ["-O3", "-DNDEBUG"]
debug_flags = ["-g", "-O0"]
flags = default_flags
if is_release:
flags = flags + release_flags
else:
flags = flags + debug_flags
env.Append(CXXFLAGS=flags)
env.Append(
CPPPATH=[
"/opt/homebrew/include",
"/opt/homebrew/include/SDL2", # For imgui which includes SDL as: #include <SDL.h>
]
)
env.Append(
LIBPATH=[
"third_party/fmt/build",
"/opt/homebrew/lib",
]
)
env.Append(LIBS=["vulkan", "fmt"])
if os == "windows":
env.Append(CXXFLAGS=["/std:c++20", "/EHsc", "/permissive"])
env.Append(
CPPPATH=[
"e:/David/Software/VulkanSDK/1.3.275.0/Include/",
"e:/David/Software/VulkanSDK/1.3.275.0/Include/SDL2/",
]
)
env.Append(
LIBPATH=[
"third_party/fmt/build/Debug/",
"e:/David/Software/VulkanSDK/1.3.275.0/Lib/",
]
)
env.Append(LIBS=["vulkan-1", "fmtd"])
imgui_os_impl = "third_party/imgui/backends/imgui_impl_"
if os == "darwin":
imgui_os_impl += "osx.mm"
if os == "windows":
imgui_os_impl += "win32.cpp"
env.Library(
"bin/imgui",
[
Glob("third_party/imgui/*.cpp"),
"third_party/imgui/backends/imgui_impl_sdl2.cpp",
"third_party/imgui/backends/imgui_impl_vulkan.cpp",
"third_party/imgui/misc/cpp/imgui_stdlib.cpp",
imgui_os_impl,
],
)
env.Tool("compilation_db")
env.CompilationDatabase()
bin_name = "vulkun"
if is_release:
bin_name += "-release"
env.Program(
"bin/" + bin_name,
[
Glob("src/*.cpp"),
Glob("third_party/vk-bootstrap/src/*.cpp"),
# Glob("third_party/imgui/*.cpp"),
# "third_party/imgui/backends/imgui_impl_sdl2.cpp",
# "third_party/imgui/backends/imgui_impl_vulkan.cpp",
# imgui_os_impl,
],
)