Skip to content

Commit 8f26de7

Browse files
committed
always optimize, remove exlcude_from_all
1 parent f589f7a commit 8f26de7

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

CMakeLists.txt

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,16 @@ find_package(Vulkan COMPONENTS glslangValidator)
2121
if(Vulkan_glslangValidator_FOUND)
2222
# use the found glslangValidator from find_package()
2323
set(SPVRC_GLSLANG_VALIDATOR ${Vulkan_GLSLANG_VALIDATOR_EXECUTABLE})
24-
set(SPVRC_GLSLANG_VALIDATOR_OPTIMIZER ON)
2524
else()
2625
# try to find glslang validator on cmd line
2726
find_program(GLSLANG_VALIDATOR_FOUND glslangValidator)
2827
if (NOT ${GLSLANG_VALIDATOR_FOUND} STREQUAL "GLSLANG_VALIDATOR_FOUND-NOTFOUND")
2928
set(SPVRC_GLSLANG_VALIDATOR ${GLSLANG_VALIDATOR_FOUND})
30-
# the optimizer likely won't be available
31-
set(SPVRC_GLSLANG_VALIDATOR_OPTIMIZER OFF)
3229
endif()
3330
endif()
3431

3532
# build glslangValidator if not found
36-
if(SPVRC_GLSLANG_VALIDATOR STREQUAL "")
33+
if(NOT DEFINED SPVRC_GLSLANG_VALIDATOR)
3734
include(FetchContent)
3835
# SPIRV-Tools for glslang compiler
3936
set(SKIP_SPIRV_TOOLS_INSTALL ON)
@@ -51,14 +48,12 @@ if(SPVRC_GLSLANG_VALIDATOR STREQUAL "")
5148
GIT_TAG "vulkan-sdk-1.3.290.0"
5249
GIT_SHALLOW ON
5350
OVERRIDE_FIND_PACKAGE
54-
EXCLUDE_FROM_ALL
5551
SYSTEM)
5652
FetchContent_Declare(spirv-tools
5753
GIT_REPOSITORY "https://github.com/KhronosGroup/SPIRV-Tools.git"
5854
GIT_TAG "vulkan-sdk-1.3.290.0"
5955
GIT_SHALLOW ON
6056
OVERRIDE_FIND_PACKAGE
61-
EXCLUDE_FROM_ALL
6257
SYSTEM)
6358
# glslangValidator for runtime/static shader compilation
6459
set(ENABLE_OPT ON)
@@ -74,11 +69,9 @@ if(SPVRC_GLSLANG_VALIDATOR STREQUAL "")
7469
GIT_TAG "vulkan-sdk-1.3.290.0"
7570
GIT_SHALLOW ON
7671
OVERRIDE_FIND_PACKAGE
77-
EXCLUDE_FROM_ALL
7872
SYSTEM)
7973
FetchContent_MakeAvailable(spirv-headers spirv-tools glslang)
8074
set(SPVRC_GLSLANG_VALIDATOR glslang-standalone)
81-
set(SPVRC_GLSLANG_VALIDATOR_OPTIMIZER ON)
8275
endif()
8376

8477
# compile glsl to spirv
@@ -91,10 +84,8 @@ set(GLSLANG_CLI_PARAMS
9184
# --spirv-val
9285
--enhanced-msgs --quiet
9386
--target-env "${SPVRC_SHADER_ENV}"
87+
-Os
9488
-I"${SPVRC_SHADER_DIR}")
95-
if(SPVRC_GLSLANG_VALIDATOR_OPTIMIZER)
96-
list(APPEND GLSLANG_CLI_PARAMS -Os)
97-
endif()
9889
file(MAKE_DIRECTORY "${SPVRC_SHADER_DIR}")
9990
foreach(GLSL_FILE ${GLSL_SOURCE_FILES})
10091
# get shortened path relative to shader directory root

0 commit comments

Comments
 (0)