forked from iglunix/indium
-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
196 lines (163 loc) · 3.73 KB
/
CMakeLists.txt
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
project(indium)
cmake_minimum_required(VERSION 3.20)
find_package(Vulkan REQUIRED)
find_package(LLVM REQUIRED CONFIG)
if (DARLING)
set(INDIUM_TARGETS indium indium_private iridium)
else()
set(INDIUM_TARGETS indium indium_kit indium_private indium_kit_private iridium mtl2spv)
endif()
set(indium_sources
src/indium/blit-command-encoder.cpp
src/indium/buffer.cpp
src/indium/command-buffer.cpp
src/indium/command-encoder.cpp
src/indium/command-queue.cpp
src/indium/compute-command-encoder.cpp
src/indium/compute-pipeline.cpp
src/indium/counter.cpp
src/indium/depth-stencil.cpp
src/indium/device.cpp
src/indium/drawable.cpp
src/indium/dynamic-vk.cpp
src/indium/indium.cpp
src/indium/library.cpp
src/indium/render-command-encoder.cpp
src/indium/render-pipeline.cpp
src/indium/resource.cpp
src/indium/sampler.cpp
src/indium/texture.cpp
)
set(iridium_sources
src/iridium/air.cpp
src/iridium/dynamic-llvm.cpp
src/iridium/iridium.cpp
src/iridium/spirv.cpp
)
if (DARLING)
set(DYLIB_INSTALL_NAME "/usr/lib/darling/libindium.dylib")
add_darling_library(indium ${indium_sources})
make_fat(indium)
else()
add_library(indium SHARED ${indium_sources})
endif()
add_library(indium_private INTERFACE)
if (NOT DARLING)
add_library(indium_kit SHARED
src/indium-kit/layer.cpp
)
add_library(indium_kit_private INTERFACE)
endif()
if (DARLING)
set(DYLIB_INSTALL_NAME "/usr/lib/darling/libiridium.dylib")
add_darling_library(iridium ${iridium_sources})
make_fat(iridium)
else()
add_library(iridium SHARED ${iridium_sources})
endif()
if (NOT DARLING)
add_executable(mtl2spv
src/mtl2spv/mtl2spv.cpp
)
endif()
set_target_properties(${INDIUM_TARGETS}
PROPERTIES
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON
CXX_EXTENSIONS OFF
)
target_include_directories(indium PUBLIC
include
)
if (NOT DARLING)
target_include_directories(indium_kit PUBLIC
${Vulkan_INCLUDE_DIRS}
include
)
endif()
target_include_directories(iridium PUBLIC
include
)
target_include_directories(indium_private INTERFACE
${Vulkan_INCLUDE_DIRS}
private-include
)
if (NOT DARLING)
target_include_directories(indium_kit_private INTERFACE
private-include
)
endif()
target_include_directories(indium PRIVATE
${Vulkan_INCLUDE_DIRS}
private-include
)
if (NOT DARLING)
target_include_directories(indium_kit PRIVATE
private-include
)
endif()
target_include_directories(iridium PRIVATE
private-include
${LLVM_INCLUDE_DIRS}
)
separate_arguments(LLVM_DEFINITIONS_LIST NATIVE_COMMAND ${LLVM_DEFINITIONS})
target_compile_definitions(iridium PRIVATE ${LLVM_DEFINITIONS_LIST})
if (DARLING)
target_link_libraries(indium PRIVATE
iridium
cxx
system
)
target_link_libraries(indium_private INTERFACE
indium
)
else()
target_link_libraries(indium PRIVATE
iridium
)
target_link_libraries(indium_private INTERFACE
indium
)
endif()
if (NOT DARLING)
target_link_libraries(indium_kit PUBLIC
indium
)
target_link_libraries(indium_kit PRIVATE
indium_private
)
target_link_libraries(indium_kit_private INTERFACE
indium_kit
indium_private
)
endif()
execute_process(
COMMAND llvm-config --link-shared --libnames
OUTPUT_VARIABLE HOST_LLVM_LIBNAME
OUTPUT_STRIP_TRAILING_WHITESPACE
)
target_compile_definitions(iridium PRIVATE
"HOST_LLVM_LIBNAME=\"${HOST_LLVM_LIBNAME}\""
)
if (DARLING)
target_link_libraries(iridium PRIVATE
cxx
system
)
endif()
if (NOT DARLING)
target_link_libraries(mtl2spv PRIVATE
iridium
)
endif()
if (DARLING)
install(TARGETS indium iridium DESTINATION libexec/darling/usr/lib/darling)
else()
install(TARGETS indium indium_kit iridium LIBRARY)
install(TARGETS mtl2spv RUNTIME)
install(DIRECTORY include/ DESTINATION include)
option(ENABLE_TESTS "Whether or not to enable tests" OFF)
if (ENABLE_TESTS)
add_subdirectory(test)
endif ()
endif()