build: Improve cygwin build support
Partially support cygwin environment by adding --no-build to
update_external_sources.sh
Change-Id: I9fa35d6c720dd05a11c307d3da4d09415934899e
diff --git a/BUILD.md b/BUILD.md
index da9f3e0..d88eb9a 100644
--- a/BUILD.md
+++ b/BUILD.md
@@ -194,7 +194,7 @@
- Need python3.3 or later to get the Windows py.exe launcher that is used to get python3 rather than python2 if both are installed on Windows
- 32 bit python works
- [Git](http://git-scm.com/download/win).
- - Note: If you use Cygwin, you can normally use Cygwin's "git.exe". However, in order to use the "update\_external\_sources.bat" script, you must have this version.
+ - Note: If you use Cygwin, you can normally use Cygwin's "git.exe", and "update\_external\_sources.sh --no-build" does support Cygwin's git. However, in order to use the "update\_external\_sources.bat" script, you must have this version.
- Tell the installer to allow it to be used for "Developer Prompt" as well as "Git Bash".
- Tell the installer to treat line endings "as is" (i.e. both DOS and Unix-style line endings).
- Install each a 32-bit and a 64-bit version, as the 64-bit installer does not install the 32-bit libraries and tools.
@@ -225,6 +225,15 @@
This specification describes both how ICDs and layers should be properly
packaged, and how developers can point to ICDs and layers within their builds.
+### Cygwin
+
+If you are using Cygwin git instead of win32-native git, you can use Cygwin's git to sync external sources:
+```
+./update_external_sources.sh --no-build
+```
+
+Unfortunately, "update\_external\_sources.bat" does not have a --no-sync option. To build the external sources you have to modify "update\_external\_sources.bat" to skip the sync portions of the script.
+
## Android Build
Install the required tools for Linux and Windows covered above, then add the following.
### Android Studio
diff --git a/update_external_sources.bat b/update_external_sources.bat
index b6a9911..c0b41a2 100644
--- a/update_external_sources.bat
+++ b/update_external_sources.bat
@@ -105,7 +105,7 @@
if not defined FOUND (
echo Dependency check failed:
echo cmake.exe not found
- echo Get CNake 2.8 for Windows here: http://www.cmake.org/cmake/resources/software.html
+ echo Get CMake for Windows here: http://www.cmake.org/cmake/resources/software.html
echo Install and ensure each makes it into your PATH, default is "C:\Program Files (x86)\CMake\bin"
set errorCode=1
)
diff --git a/update_external_sources.sh b/update_external_sources.sh
index 78f21f9..30be3d3 100755
--- a/update_external_sources.sh
+++ b/update_external_sources.sh
@@ -3,13 +3,14 @@
set -e
-if [[ $(uname) == "Linux" ]]; then
+if [[ $(uname) == "Linux" || $(uname) =~ "CYGWIN" ]]; then
CURRENT_DIR="$(dirname "$(readlink -f ${BASH_SOURCE[0]})")"
CORE_COUNT=$(nproc || echo 4)
elif [[ $(uname) == "Darwin" ]]; then
CURRENT_DIR="$(dirname "$(python -c 'import os,sys;print(os.path.realpath(sys.argv[1]))' ${BASH_SOURCE[0]})")"
CORE_COUNT=$(sysctl -n hw.ncpu || echo 4)
fi
+echo CURRENT_DIR=$CURRENT_DIR
echo CORE_COUNT=$CORE_COUNT
REVISION_DIR="$CURRENT_DIR/external_revisions"
@@ -95,57 +96,82 @@
make -j $CORE_COUNT
}
-# If any options are provided, just compile those tools
-# If no options are provided, build everything
+# If any options are provided, just sync and compile those tools
+# If no options are provided, sync and build everything
INCLUDE_GLSLANG=false
INCLUDE_SPIRV_TOOLS=false
+NO_SYNC=false
+NO_BUILD=false
+USE_IMPLICIT_COMPONENT_LIST=true
-if [ "$#" == 0 ]; then
+# Parse options
+while [[ $# > 0 ]]
+do
+ option="$1"
+
+ case $option in
+ # options to specify build of glslang components
+ -g|--glslang)
+ INCLUDE_GLSLANG=true
+ USE_IMPLICIT_COMPONENT_LIST=false
+ echo "Building glslang ($option)"
+ ;;
+ # options to specify build of spirv-tools components
+ -s|--spirv-tools)
+ INCLUDE_SPIRV_TOOLS=true
+ USE_IMPLICIT_COMPONENT_LIST=false
+ echo "Building spirv-tools ($option)"
+ ;;
+ # option to specify skipping sync from git
+ --no-sync)
+ NO_SYNC=true
+ echo "Skipping sync ($option)"
+ ;;
+ # option to specify skipping build
+ --no-build)
+ NO_BUILD=true
+ echo "Skipping build ($option)"
+ ;;
+ *)
+ echo "Unrecognized option: $option"
+ echo "Try the following:"
+ echo " -g | --glslang # enable glslang"
+ echo " -s | --spirv-tools # enable spirv-tools"
+ echo " --no-sync # skip sync from git"
+ echo " --no-build # skip build"
+ exit 1
+ ;;
+ esac
+ shift
+done
+
+if [ ${USE_IMPLICIT_COMPONENT_LIST} == "true" ]; then
echo "Building glslang, spirv-tools"
INCLUDE_GLSLANG=true
INCLUDE_SPIRV_TOOLS=true
-else
- # Parse options
- while [[ $# > 0 ]]
- do
- option="$1"
-
- case $option in
- # options to specify build of glslang components
- -g|--glslang)
- INCLUDE_GLSLANG=true
- echo "Building glslang ($option)"
- ;;
- # options to specify build of spirv-tools components
- -s|--spirv-tools)
- INCLUDE_SPIRV_TOOLS=true
- echo "Building spirv-tools ($option)"
- ;;
- *)
- echo "Unrecognized option: $option"
- echo "Try the following:"
- echo " -g | --glslang # enable glslang"
- echo " -s | --spirv-tools # enable spirv-tools"
- exit 1
- ;;
- esac
- shift
- done
fi
if [ ${INCLUDE_GLSLANG} == "true" ]; then
- if [ ! -d "${BASEDIR}/glslang" -o ! -d "${BASEDIR}/glslang/.git" -o -d "${BASEDIR}/glslang/.svn" ]; then
- create_glslang
+ if [ ${NO_SYNC} == "false" ]; then
+ if [ ! -d "${BASEDIR}/glslang" -o ! -d "${BASEDIR}/glslang/.git" -o -d "${BASEDIR}/glslang/.svn" ]; then
+ create_glslang
+ fi
+ update_glslang
fi
- update_glslang
- build_glslang
+ if [ ${NO_BUILD} == "false" ]; then
+ build_glslang
+ fi
fi
if [ ${INCLUDE_SPIRV_TOOLS} == "true" ]; then
+ if [ ${NO_SYNC} == "false" ]; then
if [ ! -d "${BASEDIR}/spirv-tools" -o ! -d "${BASEDIR}/spirv-tools/.git" ]; then
create_spirv-tools
fi
update_spirv-tools
+ fi
+ if [ ${NO_BUILD} == "false" ]; then
build_spirv-tools
+ fi
fi