1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-02-01 02:15:32 +00:00

Allow setting up multiple build configurations at once

Also fix some bugs discovered in the process.

For multi-config generators, this basically just copies the DLLs for
each configuration, and for single-config, due to there being separate
build directories with separate extracted dependencies for each, it
defaults to just one, and will run the script several times if you
manually specify several.

Details include:
* Changing CONFIGURATION from a string to an array called
  CONFIGURATIONS. This gets iterated over in a bunch of places.
* Fixing a typo of 'cannot'
* Making the DLL lists arrays per-config, too.
* Some handling for the recursive stuff and a warning if configurations
  are set with a multi-config generator.
* Moving the configuration name sanitisation after they've been set.
* Myriad changes to Google Test:
  - Build it in a directory specific to the build tools - previously,
    having an MSVC 2017 and MSVC 2019 build on the same machine was
    impossible if unit tests were on, even though it's allowed otherwise
  - Use either Debug or Release Google Test as its finder isn't looking
    for RelWithDebInfo or capable of dealing with it if we try and use
    it anyway.
  - Always build Google Test with MSBuild as it's much less hassle due
    to CMake setting up the environment for us. Currently, MSVC always
    comes with something that can build solution files, no matter how
    you get it, so this shouldn't upset anyone.
  - Use CMake's --install mode so we can set the install prefix in the
    place that uses it.
  - Pass CMake both Debug and Release Google Test instead of risking a
    C/C++ library configuration mismatch causing linker and runtime
    errors - it'll pick a suitable one for each configuration.
  - Pass the library type explicitly as CMake can't cope without a
    Release library if you only gave it Debug, due to accessing a
    Release-specific variable unconditionally.
* Remove the -legacy flag from vswhere as it's only needed for MSVC
  2015, which we don't support any more.
* Fix the -version argument for vswhere as I'd massively cocked it up.
  I don't know how that happened as I did test it on a machine with
  multiple MSVC versions installed, which was the failure case, but it
  didn't fail then.
This commit is contained in:
AnyOldName3 2020-09-08 00:18:18 +01:00
parent f4db29a717
commit 9e547e14d2

View file

@ -69,7 +69,7 @@ NMAKE=""
NINJA="" NINJA=""
PDBS="" PDBS=""
PLATFORM="" PLATFORM=""
CONFIGURATION="" CONFIGURATIONS=()
TEST_FRAMEWORK="" TEST_FRAMEWORK=""
GOOGLE_INSTALL_ROOT="" GOOGLE_INSTALL_ROOT=""
INSTALL_PREFIX="." INSTALL_PREFIX="."
@ -129,7 +129,7 @@ while [ $# -gt 0 ]; do
PDBS=true ;; PDBS=true ;;
c ) c )
CONFIGURATION=$1 CONFIGURATIONS+=( $1 )
shift ;; shift ;;
t ) t )
@ -143,8 +143,10 @@ while [ $# -gt 0 ]; do
cat <<EOF cat <<EOF
Usage: $0 [-cdehkpuvVi] Usage: $0 [-cdehkpuvVi]
Options: Options:
-c <Release/Debug> -c <Release/Debug/RelWithDebInfo>
Set the configuration, can also be set with environment variable CONFIGURATION. Set the configuration, can also be set with environment variable CONFIGURATION.
For mutli-config generators, this is ignored, and all configurations are set up.
For single-config generators, several configurations can be set up at once by specifying -c multiple times.
-d -d
Skip checking the downloads. Skip checking the downloads.
-D -D
@ -164,7 +166,7 @@ Options:
-v <2017/2019> -v <2017/2019>
Choose the Visual Studio version to use. Choose the Visual Studio version to use.
-n -n
Produce NMake makefiles instead of a Visual Studio solution. Cannout be used with -N. Produce NMake makefiles instead of a Visual Studio solution. Cannot be used with -N.
-N -N
Produce Ninja (multi-config if CMake is new enough to support it) files instead of a Visual Studio solution. Cannot be used with -n.. Produce Ninja (multi-config if CMake is new enough to support it) files instead of a Visual Studio solution. Cannot be used with -n..
-P -P
@ -187,7 +189,7 @@ done
if [ -n "$NMAKE" ] || [ -n "$NINJA" ]; then if [ -n "$NMAKE" ] || [ -n "$NINJA" ]; then
if [ -n "$NMAKE" ] && [ -n "$NINJA" ]; then if [ -n "$NMAKE" ] && [ -n "$NINJA" ]; then
echo "Cannout run in NMake and Ninja mode at the same time." echo "Cannot run in NMake and Ninja mode at the same time."
wrappedExit 1 wrappedExit 1
fi fi
ACTIVATE_MSVC=true ACTIVATE_MSVC=true
@ -293,29 +295,40 @@ add_cmake_opts() {
CMAKE_OPTS="$CMAKE_OPTS $@" CMAKE_OPTS="$CMAKE_OPTS $@"
} }
RUNTIME_DLLS="" declare -A RUNTIME_DLLS
RUNTIME_DLLS["Release"]=""
RUNTIME_DLLS["Debug"]=""
RUNTIME_DLLS["RelWithDebInfo"]=""
add_runtime_dlls() { add_runtime_dlls() {
RUNTIME_DLLS="$RUNTIME_DLLS $@" local CONFIG=$1
shift
RUNTIME_DLLS[$CONFIG]="${RUNTIME_DLLS[$CONFIG]} $@"
} }
OSG_PLUGINS="" declare -A OSG_PLUGINS
OSG_PLUGINS["Release"]=""
OSG_PLUGINS["Debug"]=""
OSG_PLUGINS["RelWithDebInfo"]=""
add_osg_dlls() { add_osg_dlls() {
OSG_PLUGINS="$OSG_PLUGINS $@" local CONFIG=$1
shift
OSG_PLUGINS[$CONFIG]="${OSG_PLUGINS[$CONFIG]} $@"
} }
QT_PLATFORMS="" declare -A QT_PLATFORMS
QT_PLATFORMS["Release"]=""
QT_PLATFORMS["Debug"]=""
QT_PLATFORMS["RelWithDebInfo"]=""
add_qt_platform_dlls() { add_qt_platform_dlls() {
QT_PLATFORMS="$QT_PLATFORMS $@" local CONFIG=$1
shift
QT_PLATFORMS[$CONFIG]="${QT_PLATFORMS[$CONFIG]} $@"
} }
if [ -z $PLATFORM ]; then if [ -z $PLATFORM ]; then
PLATFORM="$(uname -m)" PLATFORM="$(uname -m)"
fi fi
if [ -z $CONFIGURATION ]; then
CONFIGURATION="Debug"
fi
if [ -z $VS_VERSION ]; then if [ -z $VS_VERSION ]; then
VS_VERSION="2017" VS_VERSION="2017"
fi fi
@ -377,20 +390,6 @@ case $PLATFORM in
;; ;;
esac esac
case $CONFIGURATION in
debug|Debug|DEBUG )
CONFIGURATION=Debug
;;
release|Release|RELEASE )
CONFIGURATION=Release
;;
relwithdebinfo|RelWithDebInfo|RELWITHDEBINFO )
CONFIGURATION=RelWithDebInfo
;;
esac
if [ $BITS -eq 64 ] && [ $MSVC_REAL_VER -lt 16 ]; then if [ $BITS -eq 64 ] && [ $MSVC_REAL_VER -lt 16 ]; then
GENERATOR="${GENERATOR} Win64" GENERATOR="${GENERATOR} Win64"
fi fi
@ -408,6 +407,79 @@ if [ -n "$NINJA" ]; then
fi fi
fi fi
if [ -n "$SINGLE_CONFIG" ]; then
if [ ${#CONFIGURATIONS[@]} -eq 0 ]; then
if [ -n "${CONFIGURATION:-}" ]; then
CONFIGURATIONS=("$CONFIGURATION")
else
CONFIGURATIONS=("Debug")
fi
elif [ ${#CONFIGURATIONS[@]} -ne 1 ]; then
# It's simplest just to recursively call the script a few times.
RECURSIVE_OPTIONS=()
if [ -n "$VERBOSE" ]; then
RECURSIVE_OPTIONS+=("-V")
fi
if [ -n "$SKIP_DOWNLOAD" ]; then
RECURSIVE_OPTIONS+=("-d")
fi
if [ -n "$BULLET_DOUBLE" ]; then
RECURSIVE_OPTIONS+=("-D")
fi
if [ -n "$SKIP_EXTRACT" ]; then
RECURSIVE_OPTIONS+=("-e")
fi
if [ -n "$KEEP" ]; then
RECURSIVE_OPTIONS+=("-k")
fi
if [ -n "$UNITY_BUILD" ]; then
RECURSIVE_OPTIONS+=("-u")
fi
if [ -n "$NMAKE" ]; then
RECURSIVE_OPTIONS+=("-n")
fi
if [ -n "$NINJA" ]; then
RECURSIVE_OPTIONS+=("-N")
fi
if [ -n "$PDBS" ]; then
RECURSIVE_OPTIONS+=("-P")
fi
if [ -n "$TEST_FRAMEWORK" ]; then
RECURSIVE_OPTIONS+=("-t")
fi
RECURSIVE_OPTIONS+=("-v $VS_VERSION")
RECURSIVE_OPTIONS+=("-p $PLATFORM")
RECURSIVE_OPTIONS+=("-i '$INSTALL_PREFIX'")
for config in ${CONFIGURATIONS[@]}; do
$0 ${RECURSIVE_OPTIONS[@]} -c $config
done
wrappedExit 1
fi
else
if [ ${#CONFIGURATIONS[@]} -ne 0 ]; then
echo "Ignoring configurations argument - generator is multi-config"
fi
CONFIGURATIONS=("Release" "Debug" "RelWithDebInfo")
fi
for i in ${!CONFIGURATIONS[@]}; do
case ${CONFIGURATIONS[$i]} in
debug|Debug|DEBUG )
CONFIGURATIONS[$i]=Debug
;;
release|Release|RELEASE )
CONFIGURATIONS[$i]=Release
;;
relwithdebinfo|RelWithDebInfo|RELWITHDEBINFO )
CONFIGURATIONS[$i]=RelWithDebInfo
;;
esac
done
if [ $MSVC_REAL_VER -ge 16 ] && [ -z "$NMAKE" ] && [ -z "$NINJA" ]; then if [ $MSVC_REAL_VER -ge 16 ] && [ -z "$NMAKE" ] && [ -z "$NINJA" ]; then
if [ $BITS -eq 64 ]; then if [ $BITS -eq 64 ]; then
add_cmake_opts "-G\"$GENERATOR\" -A x64" add_cmake_opts "-G\"$GENERATOR\" -A x64"
@ -419,7 +491,7 @@ else
fi fi
if [ -n "$SINGLE_CONFIG" ]; then if [ -n "$SINGLE_CONFIG" ]; then
add_cmake_opts "-DCMAKE_BUILD_TYPE=${CONFIGURATION}" add_cmake_opts "-DCMAKE_BUILD_TYPE=${CONFIGURATIONS[0]}"
fi fi
if ! [ -z $UNITY_BUILD ]; then if ! [ -z $UNITY_BUILD ]; then
@ -522,7 +594,7 @@ elif [ -n "$NINJA" ]; then
fi fi
if [ -n "$SINGLE_CONFIG" ]; then if [ -n "$SINGLE_CONFIG" ]; then
BUILD_DIR="${BUILD_DIR}_${CONFIGURATION}" BUILD_DIR="${BUILD_DIR}_${CONFIGURATIONS[0]}"
fi fi
if [ -z $KEEP ]; then if [ -z $KEEP ]; then
@ -623,7 +695,9 @@ printf "FFmpeg 4.2.2... "
rm -rf "ffmpeg-4.2.2-win${BITS}-dev" rm -rf "ffmpeg-4.2.2-win${BITS}-dev"
fi fi
export FFMPEG_HOME="$(real_pwd)/FFmpeg" export FFMPEG_HOME="$(real_pwd)/FFmpeg"
add_runtime_dlls "$(pwd)/FFmpeg/bin/"{avcodec-58,avformat-58,avutil-56,swresample-3,swscale-5}.dll for config in ${CONFIGURATIONS[@]}; do
add_runtime_dlls $config "$(pwd)/FFmpeg/bin/"{avcodec-58,avformat-58,avutil-56,swresample-3,swscale-5}.dll
done
if [ $BITS -eq 32 ]; then if [ $BITS -eq 32 ]; then
add_cmake_opts "-DCMAKE_EXE_LINKER_FLAGS=\"/machine:X86 /safeseh:no\"" add_cmake_opts "-DCMAKE_EXE_LINKER_FLAGS=\"/machine:X86 /safeseh:no\""
fi fi
@ -648,6 +722,7 @@ printf "MyGUI 3.4.0... "
mv "MyGUI-3.4.0-msvc${MSVC_REAL_YEAR}-win${BITS}" MyGUI mv "MyGUI-3.4.0-msvc${MSVC_REAL_YEAR}-win${BITS}" MyGUI
fi fi
export MYGUI_HOME="$(real_pwd)/MyGUI" export MYGUI_HOME="$(real_pwd)/MyGUI"
for CONFIGURATION in ${CONFIGURATIONS[@]}; do
if [ $CONFIGURATION == "Debug" ]; then if [ $CONFIGURATION == "Debug" ]; then
SUFFIX="_d" SUFFIX="_d"
MYGUI_CONFIGURATION="Debug" MYGUI_CONFIGURATION="Debug"
@ -655,7 +730,8 @@ printf "MyGUI 3.4.0... "
SUFFIX="" SUFFIX=""
MYGUI_CONFIGURATION="RelWithDebInfo" MYGUI_CONFIGURATION="RelWithDebInfo"
fi fi
add_runtime_dlls "$(pwd)/MyGUI/bin/${MYGUI_CONFIGURATION}/MyGUIEngine${SUFFIX}.dll" add_runtime_dlls $CONFIGURATION "$(pwd)/MyGUI/bin/${MYGUI_CONFIGURATION}/MyGUIEngine${SUFFIX}.dll"
done
echo Done. echo Done.
} }
cd $DEPS cd $DEPS
@ -672,7 +748,9 @@ printf "OpenAL-Soft 1.20.1... "
OPENAL_SDK="$(real_pwd)/openal-soft-1.20.1-bin" OPENAL_SDK="$(real_pwd)/openal-soft-1.20.1-bin"
add_cmake_opts -DOPENAL_INCLUDE_DIR="${OPENAL_SDK}/include/AL" \ add_cmake_opts -DOPENAL_INCLUDE_DIR="${OPENAL_SDK}/include/AL" \
-DOPENAL_LIBRARY="${OPENAL_SDK}/libs/Win${BITS}/OpenAL32.lib" -DOPENAL_LIBRARY="${OPENAL_SDK}/libs/Win${BITS}/OpenAL32.lib"
add_runtime_dlls "$(pwd)/openal-soft-1.20.1-bin/bin/WIN${BITS}/soft_oal.dll:OpenAL32.dll" for config in ${CONFIGURATIONS[@]}; do
add_runtime_dlls $config "$(pwd)/openal-soft-1.20.1-bin/bin/WIN${BITS}/soft_oal.dll:OpenAL32.dll"
done
echo Done. echo Done.
} }
cd $DEPS cd $DEPS
@ -695,15 +773,17 @@ printf "OSG 3.6.5... "
fi fi
OSG_SDK="$(real_pwd)/OSG" OSG_SDK="$(real_pwd)/OSG"
add_cmake_opts -DOSG_DIR="$OSG_SDK" add_cmake_opts -DOSG_DIR="$OSG_SDK"
for CONFIGURATION in ${CONFIGURATIONS[@]}; do
if [ $CONFIGURATION == "Debug" ]; then if [ $CONFIGURATION == "Debug" ]; then
SUFFIX="d" SUFFIX="d"
else else
SUFFIX="" SUFFIX=""
fi fi
add_runtime_dlls "$(pwd)/OSG/bin/"{OpenThreads,zlib,libpng}${SUFFIX}.dll \ add_runtime_dlls $CONFIGURATION "$(pwd)/OSG/bin/"{OpenThreads,zlib,libpng}${SUFFIX}.dll \
"$(pwd)/OSG/bin/osg"{,Animation,DB,FX,GA,Particle,Text,Util,Viewer,Shadow}${SUFFIX}.dll "$(pwd)/OSG/bin/osg"{,Animation,DB,FX,GA,Particle,Text,Util,Viewer,Shadow}${SUFFIX}.dll
add_osg_dlls "$(pwd)/OSG/bin/osgPlugins-3.6.5/osgdb_"{bmp,dds,freetype,jpeg,osg,png,tga}${SUFFIX}.dll add_osg_dlls $CONFIGURATION "$(pwd)/OSG/bin/osgPlugins-3.6.5/osgdb_"{bmp,dds,freetype,jpeg,osg,png,tga}${SUFFIX}.dll
add_osg_dlls "$(pwd)/OSG/bin/osgPlugins-3.6.5/osgdb_serializers_osg"{,animation,fx,ga,particle,text,util,viewer,shadow}${SUFFIX}.dll add_osg_dlls $CONFIGURATION "$(pwd)/OSG/bin/osgPlugins-3.6.5/osgdb_serializers_osg"{,animation,fx,ga,particle,text,util,viewer,shadow}${SUFFIX}.dll
done
echo Done. echo Done.
} }
cd $DEPS cd $DEPS
@ -775,26 +855,30 @@ fi
cd $QT_SDK cd $QT_SDK
add_cmake_opts -DQT_QMAKE_EXECUTABLE="${QT_SDK}/bin/qmake.exe" \ add_cmake_opts -DQT_QMAKE_EXECUTABLE="${QT_SDK}/bin/qmake.exe" \
-DCMAKE_PREFIX_PATH="$QT_SDK" -DCMAKE_PREFIX_PATH="$QT_SDK"
for CONFIGURATION in ${CONFIGURATIONS[@]}; do
if [ $CONFIGURATION == "Debug" ]; then if [ $CONFIGURATION == "Debug" ]; then
SUFFIX="d" DLLSUFFIX="d"
else else
SUFFIX="" DLLSUFFIX=""
fi fi
add_runtime_dlls "$(pwd)/bin/Qt5"{Core,Gui,Network,OpenGL,Widgets}${SUFFIX}.dll add_runtime_dlls $CONFIGURATION "$(pwd)/bin/Qt5"{Core,Gui,Network,OpenGL,Widgets}${DLLSUFFIX}.dll
add_qt_platform_dlls "$(pwd)/plugins/platforms/qwindows${SUFFIX}.dll" add_qt_platform_dlls $CONFIGURATION "$(pwd)/plugins/platforms/qwindows${DLLSUFFIX}.dll"
done
echo Done. echo Done.
else else
QT_SDK="C:/Qt/5.13/msvc2017${SUFFIX}" QT_SDK="C:/Qt/5.13/msvc2017${SUFFIX}"
add_cmake_opts -DQT_QMAKE_EXECUTABLE="${QT_SDK}/bin/qmake.exe" \ add_cmake_opts -DQT_QMAKE_EXECUTABLE="${QT_SDK}/bin/qmake.exe" \
-DCMAKE_PREFIX_PATH="$QT_SDK" -DCMAKE_PREFIX_PATH="$QT_SDK"
for CONFIGURATION in ${CONFIGURATIONS[@]}; do
if [ $CONFIGURATION == "Debug" ]; then if [ $CONFIGURATION == "Debug" ]; then
SUFFIX="d" DLLSUFFIX="d"
else else
SUFFIX="" DLLSUFFIX=""
fi fi
DIR=$(windowsPathAsUnix "${QT_SDK}") DIR=$(windowsPathAsUnix "${QT_SDK}")
add_runtime_dlls "${DIR}/bin/Qt5"{Core,Gui,Network,OpenGL,Widgets}${SUFFIX}.dll add_runtime_dlls $CONFIGURATION "${DIR}/bin/Qt5"{Core,Gui,Network,OpenGL,Widgets}${DLLSUFFIX}.dll
add_qt_platform_dlls "${DIR}/plugins/platforms/qwindows${SUFFIX}.dll" add_qt_platform_dlls $CONFIGURATION "${DIR}/plugins/platforms/qwindows${DLLSUFFIX}.dll"
done
echo Done. echo Done.
fi fi
} }
@ -810,7 +894,9 @@ printf "SDL 2.0.12... "
eval 7z x -y SDL2-2.0.12.zip $STRIP eval 7z x -y SDL2-2.0.12.zip $STRIP
fi fi
export SDL2DIR="$(real_pwd)/SDL2-2.0.12" export SDL2DIR="$(real_pwd)/SDL2-2.0.12"
add_runtime_dlls "$(pwd)/SDL2-2.0.12/lib/x${ARCHSUFFIX}/SDL2.dll" for config in ${CONFIGURATIONS[@]}; do
add_runtime_dlls $config "$(pwd)/SDL2-2.0.12/lib/x${ARCHSUFFIX}/SDL2.dll"
done
echo Done. echo Done.
} }
cd $DEPS cd $DEPS
@ -820,41 +906,51 @@ if [ ! -z $TEST_FRAMEWORK ]; then
printf "Google test 1.10.0 ..." printf "Google test 1.10.0 ..."
cd googletest cd googletest
if [ ! -d build ]; then mkdir -p build${MSVC_REAL_YEAR}
mkdir build
fi
cd build cd build${MSVC_REAL_YEAR}
GOOGLE_INSTALL_ROOT="${DEPS_INSTALL}/GoogleTest" GOOGLE_INSTALL_ROOT="${DEPS_INSTALL}/GoogleTest"
if [ $CONFIGURATION == "Debug" ]; then
for CONFIGURATION in ${CONFIGURATIONS[@]}; do
# FindGMock.cmake mentions Release explicitly, but not RelWithDebInfo. Only one optimised library config can be used, so go for the safer one.
GTEST_CONFIG=$([ $CONFIGURATION == "RelWithDebInfo" ] && echo "Release" || echo "$CONFIGURATION" )
if [ $GTEST_CONFIG == "Debug" ]; then
DEBUG_SUFFIX="d" DEBUG_SUFFIX="d"
else else
DEBUG_SUFFIX="" DEBUG_SUFFIX=""
fi fi
if [ ! -d $GOOGLE_INSTALL_ROOT ]; then if [ ! -f "$GOOGLE_INSTALL_ROOT/lib/gtest${DEBUG_SUFFIX}.lib" ]; then
# Always use MSBuild solution files as they don't need the environment activating
cmake .. -DCMAKE_BUILD_TYPE="${CONFIGURATION}" -DCMAKE_INSTALL_PREFIX="${GOOGLE_INSTALL_ROOT}" -DCMAKE_USE_WIN32_THREADS_INIT=1 -G "${GENERATOR}" -DBUILD_SHARED_LIBS=1 cmake .. -DCMAKE_USE_WIN32_THREADS_INIT=1 -G "Visual Studio $MSVC_REAL_VER $MSVC_REAL_YEAR$([ $BITS -eq 64 ] && [ $MSVC_REAL_VER -lt 16 ] && echo " Win64")" $([ $MSVC_REAL_VER -ge 16 ] && echo "-A $([ $BITS -eq 64 ] && echo "x64" || echo "Win32")") -DBUILD_SHARED_LIBS=1
cmake --build . --config "${CONFIGURATION}" cmake --build . --config "${GTEST_CONFIG}"
cmake --build . --target install --config "${CONFIGURATION}" cmake --install . --config "${GTEST_CONFIG}" --prefix "${GOOGLE_INSTALL_ROOT}"
add_runtime_dlls "${GOOGLE_INSTALL_ROOT}\bin\gtest_main${DEBUG_SUFFIX}.dll"
add_runtime_dlls "${GOOGLE_INSTALL_ROOT}\bin\gtest${DEBUG_SUFFIX}.dll"
add_runtime_dlls "${GOOGLE_INSTALL_ROOT}\bin\gmock_main${DEBUG_SUFFIX}.dll"
add_runtime_dlls "${GOOGLE_INSTALL_ROOT}\bin\gmock${DEBUG_SUFFIX}.dll"
fi fi
add_runtime_dlls $CONFIGURATION "${GOOGLE_INSTALL_ROOT}\bin\gtest_main${DEBUG_SUFFIX}.dll"
add_runtime_dlls $CONFIGURATION "${GOOGLE_INSTALL_ROOT}\bin\gtest${DEBUG_SUFFIX}.dll"
add_runtime_dlls $CONFIGURATION "${GOOGLE_INSTALL_ROOT}\bin\gmock_main${DEBUG_SUFFIX}.dll"
add_runtime_dlls $CONFIGURATION "${GOOGLE_INSTALL_ROOT}\bin\gmock${DEBUG_SUFFIX}.dll"
done
add_cmake_opts -DBUILD_UNITTESTS=yes add_cmake_opts -DBUILD_UNITTESTS=yes
# FindGTest and FindGMock do not work perfectly on Windows # FindGTest and FindGMock do not work perfectly on Windows
# but we can help them by telling them everything we know about installation # but we can help them by telling them everything we know about installation
add_cmake_opts -DGMOCK_ROOT="$GOOGLE_INSTALL_ROOT" add_cmake_opts -DGMOCK_ROOT="$GOOGLE_INSTALL_ROOT"
add_cmake_opts -DGTEST_ROOT="$GOOGLE_INSTALL_ROOT" add_cmake_opts -DGTEST_ROOT="$GOOGLE_INSTALL_ROOT"
add_cmake_opts -DGTEST_LIBRARY="$GOOGLE_INSTALL_ROOT/lib/gtest${DEBUG_SUFFIX}.lib" add_cmake_opts -DGTEST_LIBRARY="$GOOGLE_INSTALL_ROOT/lib/gtest.lib"
add_cmake_opts -DGTEST_MAIN_LIBRARY="$GOOGLE_INSTALL_ROOT/lib/gtest_main${DEBUG_SUFFIX}.lib" add_cmake_opts -DGTEST_MAIN_LIBRARY="$GOOGLE_INSTALL_ROOT/lib/gtest_main.lib"
add_cmake_opts -DGMOCK_LIBRARY="$GOOGLE_INSTALL_ROOT/lib/gmock${DEBUG_SUFFIX}.lib" add_cmake_opts -DGMOCK_LIBRARY="$GOOGLE_INSTALL_ROOT/lib/gmock.lib"
add_cmake_opts -DGMOCK_MAIN_LIBRARY="$GOOGLE_INSTALL_ROOT/lib/gmock_main${DEBUG_SUFFIX}.lib" add_cmake_opts -DGMOCK_MAIN_LIBRARY="$GOOGLE_INSTALL_ROOT/lib/gmock_main.lib"
add_cmake_opts -DGTEST_LIBRARY_DEBUG="$GOOGLE_INSTALL_ROOT/lib/gtestd.lib"
add_cmake_opts -DGTEST_MAIN_LIBRARY_DEBUG="$GOOGLE_INSTALL_ROOT/lib/gtest_maind.lib"
add_cmake_opts -DGMOCK_LIBRARY_DEBUG="$GOOGLE_INSTALL_ROOT/lib/gmockd.lib"
add_cmake_opts -DGMOCK_MAIN_LIBRARY_DEBUG="$GOOGLE_INSTALL_ROOT/lib/gmock_maind.lib"
add_cmake_opts -DGTEST_LINKED_AS_SHARED_LIBRARY=True add_cmake_opts -DGTEST_LINKED_AS_SHARED_LIBRARY=True
add_cmake_opts -DGTEST_LIBRARY_TYPE=SHARED
add_cmake_opts -DGTEST_MAIN_LIBRARY_TYPE=SHARED
echo Done. echo Done.
fi fi
@ -901,13 +997,14 @@ if [ ! -z $CI ]; then
fi fi
# NOTE: Disable this when/if we want to run test cases # NOTE: Disable this when/if we want to run test cases
#if [ -z $CI ]; then #if [ -z $CI ]; then
echo "- Copying Runtime DLLs..." for CONFIGURATION in ${CONFIGURATIONS[@]}; do
echo "- Copying Runtime DLLs for $CONFIGURATION..."
DLL_PREFIX="" DLL_PREFIX=""
if [ -z $SINGLE_CONFIG ]; then if [ -z $SINGLE_CONFIG ]; then
mkdir -p $CONFIGURATION mkdir -p $CONFIGURATION
DLL_PREFIX="$CONFIGURATION/" DLL_PREFIX="$CONFIGURATION/"
fi fi
for DLL in $RUNTIME_DLLS; do for DLL in ${RUNTIME_DLLS[$CONFIGURATION]}; do
TARGET="$(basename "$DLL")" TARGET="$(basename "$DLL")"
if [[ "$DLL" == *":"* ]]; then if [[ "$DLL" == *":"* ]]; then
originalIFS="$IFS" originalIFS="$IFS"
@ -921,25 +1018,26 @@ fi
echo echo
echo "- OSG Plugin DLLs..." echo "- OSG Plugin DLLs..."
mkdir -p ${DLL_PREFIX}osgPlugins-3.6.5 mkdir -p ${DLL_PREFIX}osgPlugins-3.6.5
for DLL in $OSG_PLUGINS; do for DLL in ${OSG_PLUGINS[$CONFIGURATION]}; do
echo " $(basename $DLL)." echo " $(basename $DLL)."
cp "$DLL" ${DLL_PREFIX}osgPlugins-3.6.5 cp "$DLL" ${DLL_PREFIX}osgPlugins-3.6.5
done done
echo echo
echo "- Qt Platform DLLs..." echo "- Qt Platform DLLs..."
mkdir -p ${DLL_PREFIX}platforms mkdir -p ${DLL_PREFIX}platforms
for DLL in $QT_PLATFORMS; do for DLL in ${QT_PLATFORMS[$CONFIGURATION]}; do
echo " $(basename $DLL)" echo " $(basename $DLL)"
cp "$DLL" "${DLL_PREFIX}platforms" cp "$DLL" "${DLL_PREFIX}platforms"
done done
echo echo
done
#fi #fi
if [ -n "$ACTIVATE_MSVC" ]; then if [ -n "$ACTIVATE_MSVC" ]; then
echo -n "- Activating MSVC in the current shell... " echo -n "- Activating MSVC in the current shell... "
command -v vswhere >/dev/null 2>&1 || { echo "Error: vswhere is not on the path."; wrappedExit 1; } command -v vswhere >/dev/null 2>&1 || { echo "Error: vswhere is not on the path."; wrappedExit 1; }
MSVC_INSTALLATION_PATH=$(vswhere -legacy -products '*' -version "[$MSVC_VER,$(awk "BEGIN { print $MSVC_REAL_VER + 1; exit }"))" -property installationPath) MSVC_INSTALLATION_PATH=$(vswhere -products '*' -version "[$MSVC_REAL_VER,$(awk "BEGIN { print $MSVC_REAL_VER + 1; exit }"))" -property installationPath)
if [ -z "$MSVC_INSTALLATION_PATH" ]; then if [ -z "$MSVC_INSTALLATION_PATH" ]; then
echo "vswhere was unable to find MSVC $MSVC_DISPLAY_YEAR" echo "vswhere was unable to find MSVC $MSVC_DISPLAY_YEAR"
wrappedExit 1 wrappedExit 1