Skip to content

Commit 748818c

Browse files
authored
Add VKB_BUILD_SHADERS cmake option to control shader build (#1528)
* Add VKB_BUILD_SHADERS cmake variable to control shader compilation * Add VKB_BUILD_SHADERS=OFF to iOS CI build script
1 parent 923d8ac commit 748818c

3 files changed

Lines changed: 9 additions & 17 deletions

File tree

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,5 +194,5 @@ jobs:
194194
- name: build_ios
195195
run: |
196196
source ~/VulkanSDK/iOS/setup-env.sh
197-
cmake -H"." -B"build/ios" -DVKB_BUILD_TESTS=ON -DVKB_BUILD_SAMPLES=ON -G Xcode -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos -DCMAKE_OSX_DEPLOYMENT_TARGET=16.3 -DCMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED=NO
197+
cmake -H"." -B"build/ios" -DVKB_BUILD_TESTS=ON -DVKB_BUILD_SAMPLES=ON -DVKB_BUILD_SHADERS=OFF -G Xcode -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos -DCMAKE_OSX_DEPLOYMENT_TARGET=16.3 -DCMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED=NO
198198
cmake --build "build/ios" --target vulkan_samples --config ${{ matrix.build_type }} -- -allowProvisioningUpdates

bldsys/cmake/global_options.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ set(VKB_VALIDATION_LAYERS_BEST_PRACTICES OFF CACHE BOOL "Enable best practices v
120120
set(VKB_VALIDATION_LAYERS_SYNCHRONIZATION OFF CACHE BOOL "Enable synchronization validation layers for every application (implicitly enables VKB_VALIDATION_LAYERS).")
121121
set(VKB_VULKAN_DEBUG ON CACHE BOOL "Enable VK_EXT_debug_utils or VK_EXT_debug_marker if supported.")
122122
set(VKB_BUILD_SAMPLES ON CACHE BOOL "Enable generation and building of Vulkan best practice samples.")
123+
set(VKB_BUILD_SHADERS ON CACHE BOOL "Enable shader compilation for all supported shading languages.")
123124
set(VKB_BUILD_TESTS OFF CACHE BOOL "Enable generation and building of Vulkan best practice tests.")
124125
set(VKB_WSI_SELECTION "XCB" CACHE STRING "Select WSI target (XCB, XLIB, WAYLAND, D2D)")
125126
set(VKB_CLANG_TIDY OFF CACHE STRING "Use CMake Clang Tidy integration")

bldsys/cmake/sample_helper.cmake

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#[[
2-
Copyright (c) 2019-2025, Arm Limited and Contributors
3-
Copyright (c) 2024-2025, Mobica Limited
4-
Copyright (c) 2024-2025, Sascha Willems
2+
Copyright (c) 2019-2026, Arm Limited and Contributors
3+
Copyright (c) 2024-2026, Mobica Limited
4+
Copyright (c) 2024-2026, Sascha Willems
55
66
SPDX-License-Identifier: Apache-2.0
77
@@ -197,7 +197,7 @@ endif()
197197
endif()
198198

199199
# HLSL compilation via DXC
200-
if(Vulkan_dxc_EXECUTABLE AND DEFINED SHADERS_HLSL)
200+
if(VKB_BUILD_SHADERS AND Vulkan_dxc_EXECUTABLE AND DEFINED SHADERS_HLSL)
201201
set(OUTPUT_FILES "")
202202
set(HLSL_TARGET_NAME ${PROJECT_NAME}-HLSL)
203203
foreach(SHADER_FILE_HLSL ${TARGET_SHADERS_HLSL})
@@ -256,16 +256,7 @@ endif()
256256
endif()
257257

258258
# Slang shader compilation
259-
# Skip on MacOS/iOS due to CI/CD using potentially broken slang compiler versions from the SDK
260-
# Might revisit once Slang shipped with the SDK is usable
261-
set(SLANG_SKIP_COMPILE false)
262-
if (($ENV{CI} MATCHES true) AND ((CMAKE_SYSTEM_NAME MATCHES "Darwin") OR (CMAKE_SYSTEM_NAME MATCHES "iOS")))
263-
set(SLANG_SKIP_COMPILE true)
264-
endif()
265-
if(VKB_SKIP_SLANG_SHADER_COMPILATION)
266-
set(SLANG_SKIP_COMPILE true)
267-
endif()
268-
if(NOT SLANG_SKIP_COMPILE AND Vulkan_slang_EXECUTABLE AND DEFINED SHADERS_SLANG)
259+
if(VKB_BUILD_SHADERS AND NOT VKB_SKIP_SLANG_SHADER_COMPILATION AND Vulkan_slang_EXECUTABLE AND DEFINED SHADERS_SLANG)
269260
set(OUTPUT_FILES "")
270261
set(SLANG_TARGET_NAME ${PROJECT_NAME}-SLANG)
271262
foreach(SHADER_FILE_SLANG ${TARGET_SHADERS_SLANG})
@@ -297,7 +288,7 @@ endif()
297288
endif()
298289

299290
# GLSL shader compilation
300-
if(Vulkan_glslc_EXECUTABLE AND DEFINED SHADERS_GLSL)
291+
if(VKB_BUILD_SHADERS AND Vulkan_glslc_EXECUTABLE AND DEFINED SHADERS_GLSL)
301292
set(GLSL_TARGET_NAME ${PROJECT_NAME}-GLSL)
302293
set(OUTPUT_FILES "")
303294
foreach(SHADER_FILE_GLSL ${TARGET_SHADERS_GLSL})
@@ -343,7 +334,7 @@ endif()
343334
endif()
344335

345336
# spvasm shader compilation
346-
if(Vulkan_spirvas_EXECUTABLE AND DEFINED SHADERS_SPVASM)
337+
if(VKB_BUILD_SHADERS AND Vulkan_spirvas_EXECUTABLE AND DEFINED SHADERS_SPVASM)
347338
set(SPVASM_TARGET_NAME ${PROJECT_NAME}-SPVASM)
348339
set(OUTPUT_FILES "")
349340
foreach(SHADER_FILE_SPVASM ${TARGET_SHADERS_SPVASM})

0 commit comments

Comments
 (0)