Add NMake support to the Windows prebuild script.

pull/541/head
AnyOldName3 6 years ago
parent 79eab6c55f
commit 14fcb9158f

@ -31,6 +31,7 @@ SKIP_EXTRACT=""
KEEP="" KEEP=""
UNITY_BUILD="" UNITY_BUILD=""
VS_VERSION="" VS_VERSION=""
NMAKE=""
PLATFORM="" PLATFORM=""
CONFIGURATION="" CONFIGURATION=""
@ -66,6 +67,9 @@ while [ $# -gt 0 ]; do
VS_VERSION=$1 VS_VERSION=$1
shift ;; shift ;;
n )
NMAKE=true ;;
p ) p )
PLATFORM=$1 PLATFORM=$1
shift ;; shift ;;
@ -94,6 +98,8 @@ Options:
Configure for unity builds. Configure for unity builds.
-v <2013/2015/2017> -v <2013/2015/2017>
Choose the Visual Studio version to use. Choose the Visual Studio version to use.
-n
Produce NMake makefiles instead of a Visual Studio solution.
-V -V
Run verbosely Run verbosely
EOF EOF
@ -108,6 +114,10 @@ EOF
done done
done done
if [ -n $NMAKE ]; then
command -v nmake -? >/dev/null 2>&1 || { echo "Error: nmake (NMake) is not on the path. Make sure you have the necessary environment variables set for command-line C++ development (for example, by starting from a Developer Command Prompt)."; exit 1; }
fi
if [ -z $VERBOSE ]; then if [ -z $VERBOSE ]; then
STRIP="> /dev/null 2>&1" STRIP="> /dev/null 2>&1"
fi fi
@ -267,18 +277,12 @@ case $PLATFORM in
ARCHNAME="x86-64" ARCHNAME="x86-64"
ARCHSUFFIX="64" ARCHSUFFIX="64"
BITS="64" BITS="64"
BASE_OPTS="-G\"$GENERATOR Win64\""
add_cmake_opts "-G\"$GENERATOR Win64\""
;; ;;
x32|x86|i686|i386|win32|Win32 ) x32|x86|i686|i386|win32|Win32 )
ARCHNAME="x86" ARCHNAME="x86"
ARCHSUFFIX="86" ARCHSUFFIX="86"
BITS="32" BITS="32"
BASE_OPTS="-G\"$GENERATOR\""
add_cmake_opts "-G\"$GENERATOR\""
;; ;;
* ) * )
@ -304,14 +308,24 @@ case $CONFIGURATION in
;; ;;
esac esac
if ! [ -z $UNITY_BUILD ]; then
add_cmake_opts "-DOPENMW_UNITY_BUILD=True"
fi
if [ ${BITS} -eq 64 ]; then if [ ${BITS} -eq 64 ]; then
GENERATOR="${GENERATOR} Win64" GENERATOR="${GENERATOR} Win64"
fi fi
if [ -n $NMAKE ]; then
GENERATOR="NMake Makefiles"
fi
add_cmake_opts "-G\"$GENERATOR\""
if [ -n $NMAKE ]; then
add_cmake_opts "-DCMAKE_BUILD_TYPE=${BUILD_CONFIG}"
fi
if ! [ -z $UNITY_BUILD ]; then
add_cmake_opts "-DOPENMW_UNITY_BUILD=True"
fi
echo echo
echo "===================================" echo "==================================="
echo "Starting prebuild on MSVC${MSVC_DISPLAY_YEAR} WIN${BITS}" echo "Starting prebuild on MSVC${MSVC_DISPLAY_YEAR} WIN${BITS}"
@ -387,6 +401,11 @@ cd .. #/..
# Set up dependencies # Set up dependencies
BUILD_DIR="MSVC${MSVC_DISPLAY_YEAR}_${BITS}" BUILD_DIR="MSVC${MSVC_DISPLAY_YEAR}_${BITS}"
if [ -n $NMAKE ]; then
BUILD_DIR="${BUILD_DIR}_NMake_${BUILD_CONFIG}"
fi
if [ -z $KEEP ]; then if [ -z $KEEP ]; then
echo echo
echo "(Re)Creating build directory." echo "(Re)Creating build directory."
@ -696,7 +715,11 @@ 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..." echo "- Copying Runtime DLLs..."
mkdir -p $BUILD_CONFIG DLL_PREFIX=""
if [ -z $NMAKE ]; then
mkdir -p $BUILD_CONFIG
DLL_PREFIX="$BUILD_CONFIG/"
fi
for DLL in $RUNTIME_DLLS; do for DLL in $RUNTIME_DLLS; do
TARGET="$(basename "$DLL")" TARGET="$(basename "$DLL")"
if [[ "$DLL" == *":"* ]]; then if [[ "$DLL" == *":"* ]]; then
@ -705,21 +728,21 @@ fi
TARGET=${SPLIT[1]} TARGET=${SPLIT[1]}
fi fi
echo " ${TARGET}." echo " ${TARGET}."
cp "$DLL" "$BUILD_CONFIG/$TARGET" cp "$DLL" "${DLL_PREFIX}$TARGET"
done done
echo echo
echo "- OSG Plugin DLLs..." echo "- OSG Plugin DLLs..."
mkdir -p $BUILD_CONFIG/osgPlugins-3.4.1 mkdir -p ${DLL_PREFIX}osgPlugins-3.4.1
for DLL in $OSG_PLUGINS; do for DLL in $OSG_PLUGINS; do
echo " $(basename $DLL)." echo " $(basename $DLL)."
cp "$DLL" $BUILD_CONFIG/osgPlugins-3.4.1 cp "$DLL" ${DLL_PREFIX}osgPlugins-3.4.1
done done
echo echo
echo "- Qt Platform DLLs..." echo "- Qt Platform DLLs..."
mkdir -p ${BUILD_CONFIG}/platforms mkdir -p ${DLL_PREFIX}platforms
for DLL in $QT_PLATFORMS; do for DLL in $QT_PLATFORMS; do
echo " $(basename $DLL)" echo " $(basename $DLL)"
cp "$DLL" "${BUILD_CONFIG}/platforms" cp "$DLL" "${DLL_PREFIX}platforms"
done done
echo echo
#fi #fi

Loading…
Cancel
Save