From a1894dc9f650ab94fb7e348e1b06ee75a1e9728b Mon Sep 17 00:00:00 2001 From: SupervisedThinking Date: Sat, 20 Nov 2021 18:39:04 +0100 Subject: [PATCH] CMakeLists: updated glslangValidator logik --- cube/CMakeLists.txt | 43 +++++++++++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 16 deletions(-) diff --git a/cube/CMakeLists.txt b/cube/CMakeLists.txt index d59eb4366..a684fc4f0 100644 --- a/cube/CMakeLists.txt +++ b/cube/CMakeLists.txt @@ -26,26 +26,37 @@ endif() if(GLSLANG_INSTALL_DIR) message(STATUS "Using GLSLANG_INSTALL_DIR to look for glslangValidator") find_program(GLSLANG_VALIDATOR names glslangValidator HINTS "${GLSLANG_INSTALL_DIR}/bin") + else() set(GLSLANG_VALIDATOR_NAME "glslangValidator") - message(STATUS "Using cmake find_program to look for glslangValidator") - if(WIN32) - execute_process( - COMMAND ${PYTHON_EXECUTABLE} ${SCRIPTS_DIR}/fetch_glslangvalidator.py glslang-master-windows-x64-Release.zip) - set(GLSLANG_VALIDATOR_NAME "glslangValidator.exe") - elseif(APPLE) - execute_process(COMMAND ${PYTHON_EXECUTABLE} ${SCRIPTS_DIR}/fetch_glslangvalidator.py glslang-master-osx-Release.zip) - elseif(UNIX AND NOT APPLE) # i.e. Linux - execute_process(COMMAND ${PYTHON_EXECUTABLE} ${SCRIPTS_DIR}/fetch_glslangvalidator.py glslang-master-linux-Release.zip) - endif() - if (WIN32) - set(PLATFORM_DIR "${PROJECT_SOURCE_DIR}/glslang/windows/bin") - elseif(APPLE) - set(PLATFORM_DIR "${PROJECT_SOURCE_DIR}/glslang/darwin/bin") + message(CHECK_START "Looking for glslangValidator") + find_program(GLSLANG_VALIDATOR NAMES ${GLSLANG_VALIDATOR_NAME} HINTS ${PLATFORM_DIR}) + if(GLSLANG_VALIDATOR) + message(CHECK_PASS ${GLSLANG_VALIDATOR}) else() - set(PLATFORM_DIR "${PROJECT_SOURCE_DIR}/glslang/linux/bin") + if(WIN32) + execute_process( + COMMAND ${PYTHON_EXECUTABLE} ${SCRIPTS_DIR}/fetch_glslangvalidator.py glslang-master-windows-x64-Release.zip) + set(GLSLANG_VALIDATOR_NAME "glslangValidator.exe") + elseif(APPLE) + execute_process(COMMAND ${PYTHON_EXECUTABLE} ${SCRIPTS_DIR}/fetch_glslangvalidator.py glslang-master-osx-Release.zip) + elseif(UNIX AND NOT APPLE) # i.e. Linux + execute_process(COMMAND ${PYTHON_EXECUTABLE} ${SCRIPTS_DIR}/fetch_glslangvalidator.py glslang-master-linux-Release.zip) + endif() + if (WIN32) + set(PLATFORM_DIR "${PROJECT_SOURCE_DIR}/glslang/windows/bin") + elseif(APPLE) + set(PLATFORM_DIR "${PROJECT_SOURCE_DIR}/glslang/darwin/bin") + else() + set(PLATFORM_DIR "${PROJECT_SOURCE_DIR}/glslang/linux/bin") + endif() + find_program(GLSLANG_VALIDATOR NAMES ${GLSLANG_VALIDATOR_NAME} HINTS ${PLATFORM_DIR}) + if(GLSLANG_VALIDATOR) + message(CHECK_PASS ${GLSLANG_VALIDATOR}) + else() + message(FATAL_ERROR "no glslangValidator binary found") + endif() endif() - find_program(GLSLANG_VALIDATOR NAMES ${GLSLANG_VALIDATOR_NAME} HINTS ${PLATFORM_DIR}) endif() if(UNIX AND NOT APPLE) # i.e. Linux