external: GH#246, Move glslang and spirv-tools inside of dir tree

Have update_external_sources create a sub-directory "external" to
fetch these components into. This way the update_external_sources
does not potentially overwrite files outside the directory tree.

Change-Id: Ia03d1fb9e4dad9d9db26a46e596fb1bf24fcb033
diff --git a/.gitignore b/.gitignore
index a1abef1..3c8b765 100644
--- a/.gitignore
+++ b/.gitignore
@@ -30,3 +30,4 @@
 build
 build32
 dbuild
+external
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b2142ed..94abcdc 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -97,26 +97,26 @@
 option(BUILD_VKJSON "Build vkjson" ON)
 
 find_program(GLSLANG_VALIDATOR NAMES glslangValidator
-             HINTS "${CMAKE_SOURCE_DIR}/../glslang/${BUILDTGT_DIR}/install/bin"
+             HINTS "${CMAKE_SOURCE_DIR}/external/glslang/${BUILDTGT_DIR}/install/bin"
                    "${PROJECT_SOURCE_DIR}/../${BINDATA_DIR}" )
 
-find_path(GLSLANG_SPIRV_INCLUDE_DIR SPIRV/spirv.hpp HINTS "${CMAKE_SOURCE_DIR}/../glslang" DOC "Path to SPIRV/spirv.hpp")
-find_path(SPIRV_TOOLS_INCLUDE_DIR spirv-tools/libspirv.h HINTS "${CMAKE_SOURCE_DIR}/../spirv-tools/include"
-                                                               "${CMAKE_SOURCE_DIR}/../source/spirv-tools/include"
-                                                               "${CMAKE_SOURCE_DIR}/../spirv-tools/external/include"
-                                                               "${CMAKE_SOURCE_DIR}/../source/spirv-tools/external/include"
+find_path(GLSLANG_SPIRV_INCLUDE_DIR SPIRV/spirv.hpp HINTS "${CMAKE_SOURCE_DIR}/external/glslang" DOC "Path to SPIRV/spirv.hpp")
+find_path(SPIRV_TOOLS_INCLUDE_DIR spirv-tools/libspirv.h HINTS "${CMAKE_SOURCE_DIR}/external/spirv-tools/include"
+                                                               "${CMAKE_SOURCE_DIR}/external/source/spirv-tools/include"
+                                                               "${CMAKE_SOURCE_DIR}/external/spirv-tools/external/include"
+                                                               "${CMAKE_SOURCE_DIR}/external/source/spirv-tools/external/include"
                                                          DOC "Path to spirv-tools/libspirv.h")
 
 if (WIN32)
-    set (GLSLANG_SEARCH_PATH "${CMAKE_SOURCE_DIR}/../glslang/${BUILDTGT_DIR}/glslang/Release"
-                             "${CMAKE_SOURCE_DIR}/../glslang/${BUILDTGT_DIR}/glslang/OSDependent/Windows/Release"
-                             "${CMAKE_SOURCE_DIR}/../glslang/${BUILDTGT_DIR}/hlsl/Release"
-                             "${CMAKE_SOURCE_DIR}/../glslang/${BUILDTGT_DIR}/OGLCompilersDLL/Release"
-                             "${CMAKE_SOURCE_DIR}/../glslang/${BUILDTGT_DIR}/SPIRV/Release" )
-    set (SPIRV_TOOLS_SEARCH_PATH "${CMAKE_SOURCE_DIR}/../spirv-tools/${BUILDTGT_DIR}/source/Release")
+    set (GLSLANG_SEARCH_PATH "${CMAKE_SOURCE_DIR}/external/glslang/${BUILDTGT_DIR}/glslang/Release"
+                             "${CMAKE_SOURCE_DIR}/external/glslang/${BUILDTGT_DIR}/glslang/OSDependent/Windows/Release"
+                             "${CMAKE_SOURCE_DIR}/external/glslang/${BUILDTGT_DIR}/hlsl/Release"
+                             "${CMAKE_SOURCE_DIR}/external/glslang/${BUILDTGT_DIR}/OGLCompilersDLL/Release"
+                             "${CMAKE_SOURCE_DIR}/external/glslang/${BUILDTGT_DIR}/SPIRV/Release" )
+    set (SPIRV_TOOLS_SEARCH_PATH "${CMAKE_SOURCE_DIR}/external/spirv-tools/${BUILDTGT_DIR}/source/Release")
 else()
-    set (GLSLANG_SEARCH_PATH "${CMAKE_SOURCE_DIR}/../glslang/build/install/lib" "${CMAKE_SOURCE_DIR}/../x86_64/lib/glslang" )
-    set (SPIRV_TOOLS_SEARCH_PATH "${CMAKE_SOURCE_DIR}/../spirv-tools/build/source" "${CMAKE_SOURCE_DIR}/../x86_64/lib/spirv-tools" )
+    set (GLSLANG_SEARCH_PATH "${CMAKE_SOURCE_DIR}/external/glslang/build/install/lib" "${CMAKE_SOURCE_DIR}/../x86_64/lib/glslang" )
+    set (SPIRV_TOOLS_SEARCH_PATH "${CMAKE_SOURCE_DIR}/external/spirv-tools/build/source" "${CMAKE_SOURCE_DIR}/../x86_64/lib/spirv-tools" )
 endif()
 
 find_library(GLSLANG_LIB NAMES glslang
@@ -139,12 +139,12 @@
 
 # On Windows, we must pair Debug and Release appropriately
 if (WIN32)
-    set (GLSLANG_DEBUG_SEARCH_PATH "${CMAKE_SOURCE_DIR}/../glslang/${BUILDTGT_DIR}/glslang/Debug"
-                                   "${CMAKE_SOURCE_DIR}/../glslang/${BUILDTGT_DIR}/glslang/OSDependent/Windows/Debug"
-                                   "${CMAKE_SOURCE_DIR}/../glslang/${BUILDTGT_DIR}/hlsl/Debug"
-                                   "${CMAKE_SOURCE_DIR}/../glslang/${BUILDTGT_DIR}/OGLCompilersDLL/Debug"
-                                   "${CMAKE_SOURCE_DIR}/../glslang/${BUILDTGT_DIR}/SPIRV/Debug")
-    set (SPIRV_TOOLS_DEBUG_SEARCH_PATH "${CMAKE_SOURCE_DIR}/../spirv-tools/${BUILDTGT_DIR}/source/Debug")
+    set (GLSLANG_DEBUG_SEARCH_PATH "${CMAKE_SOURCE_DIR}/external/glslang/${BUILDTGT_DIR}/glslang/Debug"
+                                   "${CMAKE_SOURCE_DIR}/external/glslang/${BUILDTGT_DIR}/glslang/OSDependent/Windows/Debug"
+                                   "${CMAKE_SOURCE_DIR}/external/glslang/${BUILDTGT_DIR}/hlsl/Debug"
+                                   "${CMAKE_SOURCE_DIR}/external/glslang/${BUILDTGT_DIR}/OGLCompilersDLL/Debug"
+                                   "${CMAKE_SOURCE_DIR}/external/glslang/${BUILDTGT_DIR}/SPIRV/Debug")
+    set (SPIRV_TOOLS_DEBUG_SEARCH_PATH "${CMAKE_SOURCE_DIR}/external/spirv-tools/${BUILDTGT_DIR}/source/Debug")
 
     add_library(glslang     STATIC IMPORTED)
     add_library(OGLCompiler STATIC IMPORTED)
diff --git a/update_external_sources.bat b/update_external_sources.bat
index be2d8d4..e4f1cae 100755
--- a/update_external_sources.bat
+++ b/update_external_sources.bat
@@ -13,7 +13,7 @@
 setlocal EnableDelayedExpansion

 set errorCode=0

 set BUILD_DIR=%~dp0

-set BASE_DIR=%BUILD_DIR%..

+set BASE_DIR=%BUILD_DIR%external
 set GLSLANG_DIR=%BASE_DIR%\glslang

 set SPIRV_TOOLS_DIR=%BASE_DIR%\spirv-tools

 

diff --git a/update_external_sources.sh b/update_external_sources.sh
index d3702ec..4c1a6f9 100755
--- a/update_external_sources.sh
+++ b/update_external_sources.sh
@@ -9,7 +9,7 @@
 echo "SPIRV_TOOLS_REVISION=$SPIRV_TOOLS_REVISION"
 
 BUILDDIR=$PWD
-BASEDIR=$BUILDDIR/..
+BASEDIR=$BUILDDIR/external
 
 function create_glslang () {
    rm -rf $BASEDIR/glslang