cmake: add more verbose messages if SPIRV-Tools is not found

This makes it more clear to users when SPIR-V optimization is disabled
because SPIRV-Tools could not be found, and suggests alternatives for
finding it.
This commit is contained in:
Arcady Goldmints-Orlov 2023-08-09 17:00:04 -06:00 committed by kd-11
parent 467e8804e4
commit 708069d81d

View File

@ -267,10 +267,19 @@ option(ALLOW_EXTERNAL_SPIRV_TOOLS "Allows to build against installed SPIRV-Tools
if(NOT TARGET SPIRV-Tools-opt)
if(ALLOW_EXTERNAL_SPIRV_TOOLS)
# Look for external SPIR-V Tools build, if not building in-tree
message(STATUS "Trying to find local SPIR-V tools")
find_package(SPIRV-Tools-opt)
endif()
if(NOT TARGET SPIRV-Tools-opt)
set(ENABLE_OPT OFF)
if(NOT TARGET SPIRV-Tools-opt)
if(ENABLE_OPT)
message(WARNING "ENABLE_OPT set but SPIR-V tools not found! Disabling SPIR-V optimization.")
endif()
set(ENABLE_OPT OFF)
endif()
else()
if(ENABLE_OPT)
message(SEND_ERROR "ENABLE_OPT set but SPIR-V tools not found. Please run update_glslang_sources.py, "
"set the ALLOW_EXTERNAL_SPIRV_TOOLS option to use a local install of SPIRV-Tools, or set ENABLE_OPT=0.")
endif()
endif()
endif()