diff options
author | Alexander Chung <alexander.chung@uwaterloo.ca> | 2017-03-15 16:55:01 +0000 |
---|---|---|
committer | Yun Peng <pcloudy@google.com> | 2017-03-16 08:35:52 +0000 |
commit | d1f0d6e57286e0987b680aaf956226585ea965a9 (patch) | |
tree | f86dbbb261f915609cd06444d0cd409fd8d316df /src/main/native | |
parent | 9e39ea56ecb30453ffd0e88d0977efd4ef03a4a3 (diff) |
Make Bazel work with all MSVS 2017 editions
Added support for Enterprise, Professional, and Community editions of Microsoft Visual Studio 2017.
In the Community edition, the working directory changes after vcvarsall.bat is called. Not sure why.
Closes #2658.
--
Reviewed-on: https://github.com/bazelbuild/bazel/pull/2658
PiperOrigin-RevId: 150203876
MOS_MIGRATED_REVID=150203876
Diffstat (limited to 'src/main/native')
-rwxr-xr-x | src/main/native/build_windows_jni.sh | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/main/native/build_windows_jni.sh b/src/main/native/build_windows_jni.sh index a3caed361c..97f37e918a 100755 --- a/src/main/native/build_windows_jni.sh +++ b/src/main/native/build_windows_jni.sh @@ -51,10 +51,19 @@ if [ -z "${BAZEL_VS+set}" ]; then fi VSVARS="${BAZEL_VS}/VC/VCVARSALL.BAT" -# Check if Visual Studio 2017 is installed. Look for it at the default location. +# Check if Visual Studio 2017 is installed. Look for it at the default +# locations. if [ ! -f "${VSVARS}" ]; then - VSVARS="C:/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/VC/" - VSVARS+="Auxiliary/Build/VCVARSALL.BAT" + VSVARS="C:/Program Files (x86)/Microsoft Visual Studio/2017/" + VSEDITION="BuildTools" + if [ -d "${VSVARS}Enterprise" ]; then + VSEDITION="Enterprise" + elif [ -d "${VSVARS}Professional" ]; then + VSEDITION="Professional" + elif [ -d "${VSVARS}Community" ]; then + VSEDITION="Community" + fi + VSVARS+="$VSEDITION/VC/Auxiliary/Build/VCVARSALL.BAT" fi if [ ! -f "${VSVARS}" ]; then @@ -81,6 +90,7 @@ done cat > "${VSTEMP}/windows_jni.bat" <<EOF @echo OFF @call "${VSVARS}" amd64 +@cd $(cygpath -a -w "${PWD}") @set TMP=$(cygpath -a -w "${VSTEMP}") @CL /O2 /EHsc /LD /Fe:"$(cygpath -a -w ${DLL})" /I "${JAVAINCLUDES}" /I "${JAVAINCLUDES}/win32" /I . ${WINDOWS_SOURCES[*]} EOF |