Add Visual Studio 2017 support

The new VS2017 configuration uses all the same settings as the
VS2015 one, but uses a different generator.

CMake by default looks for Boost libraries based on the compiler
being used, but Boost only has binaries for VS2015, so a hack is
used to make sure it looks for the correct ones.

I don't know what TOOLSET and XP_TOOLSET are for but I left them
just in case.
This commit is contained in:
PlutonicOverkill 2017-07-14 12:07:16 +12:00
parent 40dc1dd6f5
commit 2d7689b978

View file

@ -75,7 +75,7 @@ Options:
Set the build platform, can also be set with environment variable PLATFORM. Set the build platform, can also be set with environment variable PLATFORM.
-u -u
Configure for unity builds. Configure for unity builds.
-v <2013/2015> -v <2013/2015/2017>
Choose the Visual Studio version to use. Choose the Visual Studio version to use.
-V -V
Run verbosely Run verbosely
@ -213,20 +213,34 @@ if [ -z $VS_VERSION ]; then
fi fi
case $VS_VERSION in case $VS_VERSION in
15|15.0|2017 )
GENERATOR="Visual Studio 15 2017"
XP_TOOLSET="v140xp"
TOOLSET="v140"
BOOST_TOOLSET="vc140"
MSVC_VER="14"
MSVC_YEAR="2015"
MSVC_DISPLAY_YEAR="2017"
;;
14|14.0|2015 ) 14|14.0|2015 )
GENERATOR="Visual Studio 14 2015" GENERATOR="Visual Studio 14 2015"
XP_TOOLSET="v140_xp" XP_TOOLSET="v140_xp"
TOOLSET="v140" TOOLSET="v140"
BOOST_TOOLSET="vc140"
MSVC_VER="14" MSVC_VER="14"
MSVC_YEAR="2015" MSVC_YEAR="2015"
MSVC_DISPLAY_YEAR="2015"
;; ;;
12|12.0|2013 ) 12|12.0|2013 )
GENERATOR="Visual Studio 12 2013" GENERATOR="Visual Studio 12 2013"
XP_TOOLSET="v120_xp" XP_TOOLSET="v120_xp"
TOOLSET="v120" TOOLSET="v120"
BOOST_TOOLSET="vc120"
MSVC_VER="12" MSVC_VER="12"
MSVC_YEAR="2013" MSVC_YEAR="2013"
MSVC_DISPLAY_YEAR="2013"
;; ;;
esac esac
@ -278,7 +292,7 @@ fi
echo echo
echo "===================================" echo "==================================="
echo "Starting prebuild on MSVC${MSVC_YEAR} WIN${BITS}" echo "Starting prebuild on MSVC${MSVC_DISPLAY_YEAR} WIN${BITS}"
echo "===================================" echo "==================================="
echo echo
@ -350,7 +364,7 @@ fi
cd .. #/.. cd .. #/..
# Set up dependencies # Set up dependencies
BUILD_DIR="MSVC${MSVC_YEAR}_${BITS}" BUILD_DIR="MSVC${MSVC_DISPLAY_YEAR}_${BITS}"
if [ -z $KEEP ]; then if [ -z $KEEP ]; then
echo echo
echo "(Re)Creating build directory." echo "(Re)Creating build directory."
@ -395,6 +409,7 @@ fi
add_cmake_opts -DBOOST_ROOT="$BOOST_SDK" \ add_cmake_opts -DBOOST_ROOT="$BOOST_SDK" \
-DBOOST_LIBRARYDIR="${BOOST_SDK}/lib${BITS}-msvc-${MSVC_VER}.0" -DBOOST_LIBRARYDIR="${BOOST_SDK}/lib${BITS}-msvc-${MSVC_VER}.0"
add_cmake_opts -DBoost_COMPILER="-${BOOST_TOOLSET}"
echo Done. echo Done.
else else
@ -406,6 +421,7 @@ fi
fi fi
add_cmake_opts -DBOOST_ROOT="$BOOST_SDK" \ add_cmake_opts -DBOOST_ROOT="$BOOST_SDK" \
-DBOOST_LIBRARYDIR="${BOOST_SDK}/lib${BITS}-msvc-${MSVC_VER}.0" -DBOOST_LIBRARYDIR="${BOOST_SDK}/lib${BITS}-msvc-${MSVC_VER}.0"
add_cmake_opts -DBoost_COMPILER="-${BOOST_TOOLSET}"
echo Done. echo Done.
fi fi