From 708069d81da3ff9c62fcfab7d65b426a6b626623 Mon Sep 17 00:00:00 2001 From: Arcady Goldmints-Orlov Date: Wed, 9 Aug 2023 17:00:04 -0600 Subject: [PATCH] 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. --- CMakeLists.txt | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c1e0b05e..a734ad1f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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()