cube: Change glslang location logic for INSTALL_DIR
authorMark Lobodzinski <mark@lunarg.com>
Tue, 22 May 2018 14:40:49 +0000 (08:40 -0600)
committerMark Lobodzinski <mark@lunarg.com>
Tue, 22 May 2018 14:43:13 +0000 (08:43 -0600)
Now respects GLSLANG_INSTALL_DIR, for instance, if Vulkan-Tools is a
submodule of another repository. Also updated build doc.

BUILD.md
cube/CMakeLists.txt

index 78a6d92..236e0bd 100644 (file)
--- 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
 
index c90ab90..a6db96c 100644 (file)
@@ -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")