From ebda227dc0f9324907245bc46832389068459fd7 Mon Sep 17 00:00:00 2001 From: Mark Lobodzinski Date: Tue, 22 May 2018 08:40:49 -0600 Subject: cube: Change glslang location logic for INSTALL_DIR Now respects GLSLANG_INSTALL_DIR, for instance, if Vulkan-Tools is a submodule of another repository. Also updated build doc. --- BUILD.md | 14 ++++++-------- cube/CMakeLists.txt | 28 +++++++++++++++++----------- 2 files changed, 23 insertions(+), 19 deletions(-) diff --git a/BUILD.md b/BUILD.md index 78a6d927..236e0bde 100644 --- a/BUILD.md +++ b/BUILD.md @@ -558,23 +558,21 @@ requiring that the LIB, INCLUDE, and PATHenv variables be set to the WDK paths b ## Custom glslang version The Glslang repository is not a git sub-module of Vulkan-Tools, but glslang components are required to build -the cube and vulkaninfo applications. By default, the cmake scripts will download the required +the cube and cubepp applications. By default, the cmake scripts will download the required components into the repo 'glslang' directory. -If a specific version of the glslang components is desired, perform the following steps: +If a *specific* version of the glslang components is desired, perform the following steps: 1) clone the glslang repository: `git clone https://github.com/KhronosGroup/glslang.git` -2) Configure the glslang source tree with CMake and build it with your IDE of choice +2) Configure the glslang source tree with CMake and build it with your IDE of choice, following the instructions + in the glslang BUILD.md document including using the INSTALL_PREFIX and 'make install'. Note the install directory. -3) Pass the location of the glslang repository using an absolute path via your cmake command like so: +3) Pass the location of the glslang install directory using an absolute path via your cmake command like so: - cmake -DGLSLANG_REPO_ROOT=c:\absolute_path_to\glslang - -4) If building on Windows with MSVC, set `DISABLE_BUILDTGT_DIR_DECORATION` to _On_. - If building on Windows, but without MSVC set `DISABLE_BUILD_PATH_DECORATION` to _On_ + cmake -DGLSLANG_INSTALL_DIR=c:\absolute_path_to\glslang\build\install ## Optional software packages diff --git a/cube/CMakeLists.txt b/cube/CMakeLists.txt index c90ab904..a6db96cc 100644 --- a/cube/CMakeLists.txt +++ b/cube/CMakeLists.txt @@ -8,7 +8,23 @@ set(PYTHON_CMD ${PYTHON_EXECUTABLE}) set(SCRIPTS_DIR "${PROJECT_SOURCE_DIR}/scripts") -if(NOT DEFINED GLSLANG_REPO_ROOT) + +if(DEFINED GLSLANG_INSTALL_DIR) + message(STATUS "Using GLSLANG_INSTALL_DIR to look for glslangValidator") + find_program(GLSLANG_VALIDATOR names glslangValidator + HINTS "${GLSLANG_INSTALL_DIR}/bin" + ) +elseif(DEFINED GLSLANG_REPO_ROOT) + message(STATUS "Using glslang_repo_root to look for glslangValidator") + find_program(GLSLANG_VALIDATOR names glslangValidator + HINTS "${GLSLANG_REPO_ROOT}/build/standalone/release" + HINTS "${GLSLANG_REPO_ROOT}/build/standalone/debug" + HINTS "${GLSLANG_REPO_ROOT}/build/StandAlone" + HINTS "${GLSLANG_REPO_ROOT}/dbuild/StandAlone" + HINTS "${GLSLANG_REPO_ROOT}/build32/standalone/release" + HINTS "${GLSLANG_REPO_ROOT}/build32/standalone/debug" + ) +else() set(GLSLANG_VALIDATOR_NAME "glslangValidator") message(STATUS "Using cmake find_program to look for glslangValidator") if(CMAKE_SYSTEM_NAME STREQUAL "Windows") @@ -22,16 +38,6 @@ if(NOT DEFINED GLSLANG_REPO_ROOT) find_program(GLSLANG_VALIDATOR NAMES ${GLSLANG_VALIDATOR_NAME} HINTS "${PROJECT_SOURCE_DIR}/glslang/bin" ) -else() - message(STATUS "Using glslang_repo_root to look for glslangValidator") - find_program(GLSLANG_VALIDATOR names glslangValidator - HINTS "${GLSLANG_REPO_ROOT}/build/standalone/release" - HINTS "${GLSLANG_REPO_ROOT}/build/standalone/debug" - HINTS "${GLSLANG_REPO_ROOT}/build/StandAlone" - HINTS "${GLSLANG_REPO_ROOT}/dbuild/StandAlone" - HINTS "${GLSLANG_REPO_ROOT}/build32/standalone/release" - HINTS "${GLSLANG_REPO_ROOT}/build32/standalone/debug" - ) endif() if(CMAKE_SYSTEM_NAME STREQUAL "Linux") -- cgit v1.2.3