@@ -4,7 +4,11 @@ cmake_minimum_required(VERSION 3.22)
4
4
# from git describe
5
5
list (APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR} /cmake" )
6
6
include (GitVersion)
7
- get_git_version(SLANG_VERSION_NUMERIC SLANG_VERSION_FULL "${CMAKE_CURRENT_LIST_DIR} " )
7
+ get_git_version(
8
+ SLANG_VERSION_NUMERIC
9
+ SLANG_VERSION_FULL
10
+ "${CMAKE_CURRENT_LIST_DIR} "
11
+ )
8
12
9
13
#
10
14
# Our project
@@ -83,7 +87,11 @@ auto_option(
83
87
Aftermath
84
88
"Enable Aftermath in GFX, and add aftermath crash example to project"
85
89
)
86
- advanced_option(SLANG_ENABLE_DX_ON_VK "Use dxvk and vkd3d-proton for DirectX support" OFF )
90
+ advanced_option(
91
+ SLANG_ENABLE_DX_ON_VK
92
+ "Use dxvk and vkd3d-proton for DirectX support"
93
+ OFF
94
+ )
87
95
advanced_option(SLANG_ENABLE_SLANG_RHI "Use slang-rhi as dependency" ON )
88
96
89
97
option (SLANG_EMBED_STDLIB_SOURCE "Embed stdlib source in the binary" ON )
@@ -98,31 +106,62 @@ option(SLANG_ENABLE_GFX "Enable gfx targets" ON)
98
106
option (SLANG_ENABLE_SLANGD "Enable language server target" ON )
99
107
option (SLANG_ENABLE_SLANGC "Enable standalone compiler target" ON )
100
108
option (SLANG_ENABLE_SLANGRT "Enable runtime target" ON )
101
- option (SLANG_ENABLE_SLANG_GLSLANG "Enable glslang dependency and slang-glslang wrapper target" ON )
102
- option (SLANG_ENABLE_TESTS "Enable test targets, some tests may require SLANG_ENABLE_GFX, SLANG_ENABLE_SLANGD or SLANG_ENABLE_SLANGRT" ON )
103
- option (SLANG_ENABLE_EXAMPLES "Enable example targets, requires SLANG_ENABLE_GFX" ON )
109
+ option (
110
+ SLANG_ENABLE_SLANG_GLSLANG
111
+ "Enable glslang dependency and slang-glslang wrapper target"
112
+ ON
113
+ )
114
+ option (
115
+ SLANG_ENABLE_TESTS
116
+ "Enable test targets, some tests may require SLANG_ENABLE_GFX, SLANG_ENABLE_SLANGD or SLANG_ENABLE_SLANGRT"
117
+ ON
118
+ )
119
+ option (
120
+ SLANG_ENABLE_EXAMPLES
121
+ "Enable example targets, requires SLANG_ENABLE_GFX"
122
+ ON
123
+ )
104
124
option (SLANG_ENABLE_REPLAYER "Enable slang-replay tool" ON )
105
125
106
- option (SLANG_GITHUB_TOKEN "Use a given token value for accessing Github REST API" "" )
126
+ option (
127
+ SLANG_GITHUB_TOKEN
128
+ "Use a given token value for accessing Github REST API"
129
+ ""
130
+ )
107
131
108
132
advanced_option(SLANG_USE_SYSTEM_MINIZ "Build using system Miniz library" OFF )
109
133
advanced_option(SLANG_USE_SYSTEM_LZ4 "Build using system LZ4 library" OFF )
110
- advanced_option(SLANG_USE_SYSTEM_VULKAN_HEADERS "Build using system Vulkan headers" OFF )
111
- advanced_option(SLANG_USE_SYSTEM_SPIRV_HEADERS "Build using system SPIR-V headers" OFF )
112
- advanced_option(SLANG_USE_SYSTEM_UNORDERED_DENSE "Build using system unordered dense" OFF )
134
+ advanced_option(
135
+ SLANG_USE_SYSTEM_VULKAN_HEADERS
136
+ "Build using system Vulkan headers"
137
+ OFF
138
+ )
139
+ advanced_option(
140
+ SLANG_USE_SYSTEM_SPIRV_HEADERS
141
+ "Build using system SPIR-V headers"
142
+ OFF
143
+ )
144
+ advanced_option(
145
+ SLANG_USE_SYSTEM_UNORDERED_DENSE
146
+ "Build using system unordered dense"
147
+ OFF
148
+ )
113
149
114
- option (SLANG_SPIRV_HEADERS_INCLUDE_DIR "Provide a specific path for the SPIR-V headers and grammar files" )
150
+ option (
151
+ SLANG_SPIRV_HEADERS_INCLUDE_DIR
152
+ "Provide a specific path for the SPIR-V headers and grammar files"
153
+ )
115
154
mark_as_advanced (SLANG_SPIRV_HEADERS_INCLUDE_DIR)
116
155
117
- if (${SLANG_USE_SYSTEM_LZ4} )
156
+ if (${SLANG_USE_SYSTEM_LZ4} )
118
157
add_compile_definitions (SLANG_USE_SYSTEM_LZ4_HEADER)
119
158
endif ()
120
159
121
- if (${SLANG_USE_SYSTEM_SPIRV_HEADERS} )
160
+ if (${SLANG_USE_SYSTEM_SPIRV_HEADERS} )
122
161
add_compile_definitions (SLANG_USE_SYSTEM_SPIRV_HEADER)
123
162
endif ()
124
163
125
- if (${SLANG_USE_SYSTEM_UNORDERED_DENSE} )
164
+ if (${SLANG_USE_SYSTEM_UNORDERED_DENSE} )
126
165
add_compile_definitions (SLANG_USE_SYSTEM_UNORDERED_DENSE_HEADER)
127
166
endif ()
128
167
@@ -166,9 +205,15 @@ if(SLANG_SLANG_LLVM_FLAVOR MATCHES FETCH_BINARY)
166
205
get_best_slang_binary_release_url("${SLANG_GITHUB_TOKEN} " url)
167
206
if (NOT DEFINED url)
168
207
if (SLANG_SLANG_LLVM_FLAVOR STREQUAL FETCH_BINARY_IF_POSSIBLE)
169
- message (WARNING "Unable to find a prebuilt binary for slang-llvm, Slang will be built without LLVM support. Please consider setting SLANG_SLANG_LLVM_BINARY_URL manually" )
208
+ message (
209
+ WARNING
210
+ "Unable to find a prebuilt binary for slang-llvm, Slang will be built without LLVM support. Please consider setting SLANG_SLANG_LLVM_BINARY_URL manually"
211
+ )
170
212
else ()
171
- message (FATAL_ERROR "Unable to find binary release for slang-llvm, please set a different SLANG_SLANG_LLVM_FLAVOR or set SLANG_SLANG_LLVM_BINARY_URL manually" )
213
+ message (
214
+ FATAL_ERROR
215
+ "Unable to find binary release for slang-llvm, please set a different SLANG_SLANG_LLVM_FLAVOR or set SLANG_SLANG_LLVM_BINARY_URL manually"
216
+ )
172
217
endif ()
173
218
endif ()
174
219
endif ()
@@ -180,21 +225,23 @@ if(SLANG_SLANG_LLVM_FLAVOR MATCHES FETCH_BINARY)
180
225
endif ()
181
226
182
227
set (webgpu_dawn_release_tag "webgpu_dawn-0" )
183
- if (CMAKE_SYSTEM_NAME MATCHES "Windows" AND
184
- CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|amd64|AMD64" )
185
- set (
186
- SLANG_WEBGPU_DAWN_BINARY_URL
187
- "https://github.com/shader-slang/dawn/releases/download/${webgpu_dawn_release_tag} /webgpu_dawn-windows-x64.zip"
188
- )
228
+ if (
229
+ CMAKE_SYSTEM_NAME MATCHES "Windows"
230
+ AND CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|amd64|AMD64"
231
+ )
232
+ set (SLANG_WEBGPU_DAWN_BINARY_URL
233
+ "https://github.com/shader-slang/dawn/releases/download/${webgpu_dawn_release_tag} /webgpu_dawn-windows-x64.zip"
234
+ )
189
235
endif ()
190
236
191
237
set (slang_tint_release_tag "slang-tint-0" )
192
- if (CMAKE_SYSTEM_NAME MATCHES "Windows" AND
193
- CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|amd64|AMD64" )
194
- set (
195
- SLANG_SLANG_TINT_BINARY_URL
196
- "https://github.com/shader-slang/dawn/releases/download/${slang_tint_release_tag} /slang-tint-windows-x64.zip"
197
- )
238
+ if (
239
+ CMAKE_SYSTEM_NAME MATCHES "Windows"
240
+ AND CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|amd64|AMD64"
241
+ )
242
+ set (SLANG_SLANG_TINT_BINARY_URL
243
+ "https://github.com/shader-slang/dawn/releases/download/${slang_tint_release_tag} /slang-tint-windows-x64.zip"
244
+ )
198
245
endif ()
199
246
200
247
#
@@ -230,7 +277,7 @@ endif()
230
277
231
278
find_package (Threads REQUIRED)
232
279
233
- if (${SLANG_USE_SYSTEM_UNORDERED_DENSE} )
280
+ if (${SLANG_USE_SYSTEM_UNORDERED_DENSE} )
234
281
find_package (unordered_dense CONFIG QUIET )
235
282
endif ()
236
283
@@ -273,20 +320,13 @@ add_subdirectory(examples)
273
320
set (CPACK_ARCHIVE_COMPONENT_INSTALL ON )
274
321
set (CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE ON )
275
322
set (CPACK_STRIP_FILES FALSE )
276
- install (FILES
277
- "${slang_SOURCE_DIR} /README.md"
278
- "${slang_SOURCE_DIR} /LICENSE"
279
- DESTINATION .
280
- COMPONENT metadata
281
- EXCLUDE_FROM_ALL
282
- )
283
- install (DIRECTORY
284
- "${slang_SOURCE_DIR} /docs/"
285
- DESTINATION share/doc /slang
286
- )
287
- install (DIRECTORY
288
- "${slang_SOURCE_DIR} /include"
289
- DESTINATION .
323
+ install (
324
+ FILES "${slang_SOURCE_DIR} /README.md" "${slang_SOURCE_DIR} /LICENSE"
325
+ DESTINATION .
326
+ COMPONENT metadata
327
+ EXCLUDE_FROM_ALL
290
328
)
329
+ install (DIRECTORY "${slang_SOURCE_DIR} /docs/" DESTINATION share/doc /slang)
330
+ install (DIRECTORY "${slang_SOURCE_DIR} /include" DESTINATION .)
291
331
292
332
include (CPack)
0 commit comments