diff --git a/CI/before_script.msvc.sh b/CI/before_script.msvc.sh index 66f74520c..ae74146bc 100644 --- a/CI/before_script.msvc.sh +++ b/CI/before_script.msvc.sh @@ -8,6 +8,15 @@ while [ $# -gt 0 ]; do -v ) VERBOSE=true ;; + -d ) + SKIP_DOWNLOAD=true ;; + + -e ) + SKIP_EXTRACT=true ;; + + -k ) + KEEP=true ;; + * ) echo "Unknown arg $ARG." exit 1 ;; @@ -61,29 +70,46 @@ run_cmd() { } download() { - if ! [ -f $2 ]; then - printf " Downloading $2... " + if [ $# -lt 3 ]; then + echo "Invalid parameters to download." + return 1 + fi - if [ -z $VERBOSE ]; then - curl --silent --retry 10 -kLy 5 -o $2 $1 - RET=$? - else - curl --retry 10 -kLy 5 -o $2 $1 - RET=$? - fi + NAME=$1 + shift - if [ $RET -ne 0 ]; then - echo "Failed!" + echo "$NAME..." + + while [ $# -gt 1 ]; do + URL=$1 + FILE=$2 + shift + shift + + if ! [ -f $FILE ]; then + printf " Downloading $FILE... " + + if [ -z $VERBOSE ]; then + curl --silent --retry 10 -kLy 5 -o $FILE $URL + RET=$? + else + curl --retry 10 -kLy 5 -o $FILE $URL + RET=$? + fi + + if [ $RET -ne 0 ]; then + echo "Failed!" + else + echo "Done." + fi else - echo "Done" + echo " $FILE exists, skipping." fi + done - return $RET - else - echo " $2 exists, skipping." + if [ $# -ne 0 ]; then + echo "Missing parameter." fi - - return 0 } real_pwd() { @@ -95,6 +121,11 @@ add_cmake_opts() { CMAKE_OPTS="$CMAKE_OPTS $@" } +RUNTIME_DLLS="" +add_runtime_dlls() { + RUNTIME_DLLS="$RUNTIME_DLLS $@" +} + if [ -z $PLATFORM ]; then PLATFORM=`uname -m` fi @@ -128,6 +159,21 @@ case $PLATFORM in ;; esac + +case $CONFIGURATION in + debug|Debug|DEBUG ) + CONFIGURATION=Debug + ;; + + release|Release|RELEASE ) + CONFIGURATION=Release + ;; + + relwithdebinfo|RelWithDebInfo|RELWITHDEBINFO ) + CONFIGURATION=RelWithDebInfo + ;; +esac + echo echo "==========================" echo "Starting prebuild on win$BITS" @@ -139,58 +185,71 @@ cd deps DEPS="`pwd`" -echo "Downloading dependency packages." -echo - -# Boost -if [ -z $APPVEYOR ]; then - echo "Boost 1.58.0..." - download http://sourceforge.net/projects/boost/files/boost-binaries/1.58.0/boost_1_58_0-msvc-12.0-$BITS.exe boost-1.58.0-win$BITS.exe +if [ -z $SKIP_DOWNLOAD ]; then + echo "Downloading dependency packages." echo -fi - -# Bullet -echo "Bullet 2.83.4..." -download http://www.lysator.liu.se/~ace/OpenMW/deps/Bullet-2.83.4-win$BITS.7z Bullet-2.83.4-win$BITS.7z -echo - -# FFmpeg -echo "FFmpeg 2.5.2..." -download http://ffmpeg.zeranoe.com/builds/win$BITS/shared/ffmpeg-2.5.2-win$BITS-shared.7z ffmpeg$BITS-2.5.2.7z -download http://ffmpeg.zeranoe.com/builds/win$BITS/dev/ffmpeg-2.5.2-win$BITS-dev.7z ffmpeg$BITS-2.5.2-dev.7z -echo -# MyGUI -echo "MyGUI 3.2.2..." -download http://www.lysator.liu.se/~ace/OpenMW/deps/MyGUI-3.2.2-win$BITS.7z MyGUI-3.2.2-win$BITS.7z -echo + # Boost + if [ -z $APPVEYOR ]; then + download "Boost 1.58.0" \ + http://sourceforge.net/projects/boost/files/boost-binaries/1.58.0/boost_1_58_0-msvc-12.0-$BITS.exe \ + boost-1.58.0-win$BITS.exe + fi -# Ogre -echo "Ogre 1.9..." -download http://www.lysator.liu.se/~ace/OpenMW/deps/Ogre-1.9-win$BITS.7z Ogre-1.9-win$BITS.7z -echo + # Bullet + download "Bullet 2.83.5" \ + http://www.lysator.liu.se/~ace/OpenMW/deps/Bullet-2.83.5-win$BITS.7z \ + Bullet-2.83.5-win$BITS.7z + + # FFmpeg + download "FFmpeg 2.5.2" \ + http://ffmpeg.zeranoe.com/builds/win$BITS/shared/ffmpeg-2.5.2-win$BITS-shared.7z \ + ffmpeg$BITS-2.5.2.7z \ + http://ffmpeg.zeranoe.com/builds/win$BITS/dev/ffmpeg-2.5.2-win$BITS-dev.7z \ + ffmpeg$BITS-2.5.2-dev.7z + + # MyGUI + download "MyGUI 3.2.2" \ + http://www.lysator.liu.se/~ace/OpenMW/deps/MyGUI-3.2.2-win$BITS.7z \ + MyGUI-3.2.2-win$BITS.7z + + # OpenAL + download "OpenAL-Soft 1.16.0" \ + http://kcat.strangesoft.net/openal-soft-1.16.0-bin.zip \ + OpenAL-Soft-1.16.0.zip + + # Ogre + download "Ogre 1.9" \ + http://www.lysator.liu.se/~ace/OpenMW/deps/Ogre-1.9-win$BITS.7z \ + Ogre-1.9-win$BITS.7z + + # Qt + download "Qt 4.8.6" \ + http://sourceforge.net/projects/qt64ng/files/qt/$ARCHNAME/4.8.6/msvc2013/qt-4.8.6-x$ARCHSUFFIX-msvc2013.7z \ + qt$BITS-4.8.6.7z + + # SDL2 + download "SDL 2.0.3" \ + https://www.libsdl.org/release/SDL2-devel-2.0.3-VC.zip \ + SDL2-2.0.3.zip +fi -# OpenAL -echo "OpenAL-Soft 1.16.0..." -download http://kcat.strangesoft.net/openal-soft-1.16.0-bin.zip OpenAL-Soft-1.16.0.zip -echo +cd .. -# Qt -echo "Qt 4.8.6..." -download http://sourceforge.net/projects/qt64ng/files/qt/$ARCHNAME/4.8.6/msvc2013/qt-4.8.6-x$ARCHSUFFIX-msvc2013.7z qt$BITS-4.8.6.7z -echo +# Set up dependencies +if [ -z $KEEP ]; then + echo + printf "Preparing build directory... " -# SDL2 -echo "SDL 2.0.3 binaries..." -download https://www.libsdl.org/release/SDL2-devel-2.0.3-VC.zip SDL2-2.0.3.zip -echo + rm -rf Build_$BITS + mkdir -p Build_$BITS/deps -cd .. + echo Done. +fi +mkdir -p Build_$BITS/deps +cd Build_$BITS/deps -# Set up dependencies -rm -rf build_$BITS -mkdir -p build_$BITS/deps -cd deps +DEPS_INSTALL=`pwd` echo echo "Extracting dependencies..." @@ -198,11 +257,16 @@ echo "Extracting dependencies..." # Boost if [ -z $APPVEYOR ]; then printf "Boost 1.58.0... " - cd ../build_$BITS/deps + cd $DEPS_INSTALL BOOST_SDK="`real_pwd`/Boost" - $DEPS/boost-1.58.0-win$BITS.exe //dir="$(echo $BOOST_SDK | sed s,/,\\\\,g)" //verysilent + if [ -d Boost ] && grep "BOOST_VERSION 105800" Boost/boost/version.hpp > /dev/null; then + printf "Exists. " + elif [ -z $SKIP_EXTRACT ]; then + rm -rf Boost + $DEPS/boost-1.58.0-win$BITS.exe //dir="$(echo $BOOST_SDK | sed s,/,\\\\,g)" //verysilent + fi add_cmake_opts -DBOOST_ROOT="$BOOST_SDK" \ -DBOOST_LIBRARYDIR="$BOOST_SDK/lib$BITS-msvc-12.0" @@ -218,11 +282,16 @@ else fi # Bullet -printf "Bullet 2.83.4... " -cd ../build_$BITS/deps - -eval 7z x -y $DEPS/Bullet-2.83.4-win$BITS.7z $STRIP -mv Bullet-2.83.4-win$BITS Bullet +printf "Bullet 2.83.5... " +cd $DEPS_INSTALL + +if [ -d Bullet ]; then + printf "Exists. (No version checking) " +elif [ -z $SKIP_EXTRACT ]; then + rm -rf Bullet + eval 7z x -y $DEPS/Bullet-2.83.5-win$BITS.7z $STRIP + mv Bullet-2.83.5-win$BITS Bullet +fi BULLET_SDK="`real_pwd`/Bullet" add_cmake_opts -DBULLET_INCLUDE_DIR="$BULLET_SDK/include/bullet" \ @@ -239,14 +308,20 @@ echo Done. # FFmpeg printf "FFmpeg 2.5.2... " -cd ../build_$BITS/deps +cd $DEPS_INSTALL + +if [ -d FFmpeg ] && grep "FFmpeg version: 2.5.2" FFmpeg/README.txt > /dev/null; then + printf "Exists. " +elif [ -z $SKIP_EXTRACT ]; then + rm -rf FFmpeg -eval 7z x -y $DEPS/ffmpeg$BITS-2.5.2.7z $STRIP -eval 7z x -y $DEPS/ffmpeg$BITS-2.5.2-dev.7z $STRIP + eval 7z x -y $DEPS/ffmpeg$BITS-2.5.2.7z $STRIP + eval 7z x -y $DEPS/ffmpeg$BITS-2.5.2-dev.7z $STRIP -mv ffmpeg-2.5.2-win$BITS-shared FFmpeg -cp -r ffmpeg-2.5.2-win$BITS-dev/* FFmpeg/ -rm -rf ffmpeg-2.5.2-win$BITS-dev + mv ffmpeg-2.5.2-win$BITS-shared FFmpeg + cp -r ffmpeg-2.5.2-win$BITS-dev/* FFmpeg/ + rm -rf ffmpeg-2.5.2-win$BITS-dev +fi FFMPEG_SDK="`real_pwd`/FFmpeg" add_cmake_opts -DAVCODEC_INCLUDE_DIRS="$FFMPEG_SDK/include" \ @@ -264,6 +339,8 @@ add_cmake_opts -DAVCODEC_INCLUDE_DIRS="$FFMPEG_SDK/include" \ -DSWSCALE_INCLUDE_DIRS="$FFMPEG_SDK/include" \ -DSWSCALE_LIBRARIES="$FFMPEG_SDK/lib/swscale.lib" +add_runtime_dlls `pwd`/FFmpeg/bin/{avcodec-56,avformat-56,avutil-54,swresample-1,swscale-3}.dll + if [ $BITS -eq 32 ]; then add_cmake_opts "-DCMAKE_EXE_LINKER_FLAGS=\"/machine:X86 /safeseh:no\"" fi @@ -272,34 +349,64 @@ cd $DEPS echo Done. -# Ogre -printf "Ogre 1.9... " -cd ../build_$BITS/deps +# MyGUI +printf "MyGUI 3.2.2... " +cd $DEPS_INSTALL + +if [ -d MyGUI ] && \ + grep "MYGUI_VERSION_MAJOR 3" MyGUI/include/MYGUI/MyGUI_Prerequest.h > /dev/null && \ + grep "MYGUI_VERSION_MINOR 2" MyGUI/include/MYGUI/MyGUI_Prerequest.h > /dev/null && \ + grep "MYGUI_VERSION_PATCH 2" MyGUI/include/MYGUI/MyGUI_Prerequest.h > /dev/null +then + printf "Exists. " +elif [ -z $SKIP_EXTRACT ]; then + rm -rf MyGUI + eval 7z x -y $DEPS/MyGUI-3.2.2-win$BITS.7z $STRIP + mv MyGUI-3.2.2-win$BITS MyGUI +fi -eval 7z x -y $DEPS/Ogre-1.9-win$BITS.7z $STRIP -mv Ogre-1.9-win$BITS Ogre +MYGUI_SDK="`real_pwd`/MyGUI" -OGRE_SDK="`real_pwd`/Ogre" +add_cmake_opts -DMYGUISDK="$MYGUI_SDK" \ + -DMYGUI_INCLUDE_DIRS="$MYGUI_SDK/include" \ + -DMYGUI_PLATFORM_INCLUDE_DIRS="$MYGUI_SDK/include/MYGUI" \ + -DMYGUI_PREQUEST_FILE="$MYGUI_SDK/include/MYGUI/MyGUI_Prerequest.h" -add_cmake_opts -DOGRE_SDK="$OGRE_SDK" +if [ $CONFIGURATION == "Debug" ]; then + SUFFIX="_d" +else + SUFFIX="" +fi +add_runtime_dlls `pwd`/MyGUI/bin/$CONFIGURATION/MyGUIEngine$SUFFIX.dll cd $DEPS echo Done. -# MyGUI -printf "MyGUI 3.2.2... " -cd ../build_$BITS/deps +# Ogre +printf "Ogre 1.9... " +cd $DEPS_INSTALL + +if [ -d Ogre ]; then + printf "Exists. (No version check) " +elif [ -z $SKIP_EXTRACT ]; then + rm -rf Ogre + eval 7z x -y $DEPS/Ogre-1.9-win$BITS.7z $STRIP + mv Ogre-1.9-win$BITS Ogre +fi -eval 7z x -y $DEPS/MyGUI-3.2.2-win$BITS.7z $STRIP -mv MyGUI-3.2.2-win$BITS MyGUI +OGRE_SDK="`real_pwd`/Ogre" -MYGUI_SDK="`real_pwd`/MyGUI" +add_cmake_opts -DOGRE_SDK="$OGRE_SDK" -add_cmake_opts -DMYGUISDK="$MYGUI_SDK" \ - -DMYGUI_PLATFORM_INCLUDE_DIRS="$MYGUI_SDK/include/MYGUI" \ - -DMYGUI_INCLUDE_DIRS="$MYGUI_SDK/include" \ - -DMYGUI_PREQUEST_FILE="$MYGUI_SDK/include/MYGUI/MyGUI_Prerequest.h" +if [ $CONFIGURATION == "Debug" ]; then + SUFFIX="_d" +else + SUFFIX="" +fi + +add_runtime_dlls `pwd`/Ogre/bin/$CONFIGURATION/cg.dll \ + `pwd`/Ogre/bin/$CONFIGURATION/{OgreMain,OgreOverlay,Plugin_CgProgramManager,Plugin_ParticleFX,RenderSystem_Direct3D9,RenderSystem_GL}$SUFFIX.dll cd $DEPS @@ -307,21 +414,33 @@ echo Done. # OpenAL printf "OpenAL-Soft 1.16.0... " -eval 7z x -y OpenAL-Soft-1.16.0.zip $STRIP +if [ -d openal-soft-1.16.0-bin ]; then + printf "Exists. " +elif [ -z $SKIP_EXTRACT ]; then + rm -rf openal-soft-1.16.0-bin + eval 7z x -y OpenAL-Soft-1.16.0.zip $STRIP +fi OPENAL_SDK="`real_pwd`/openal-soft-1.16.0-bin" -add_cmake_opts -DOPENAL_INCLUDE_DIR="$OPENAL_SDK/include" \ +add_cmake_opts -DOPENAL_INCLUDE_DIR="$OPENAL_SDK/include/AL" \ -DOPENAL_LIBRARY="$OPENAL_SDK/libs/Win$BITS/OpenAL32.lib" + + echo Done. # Qt printf "Qt 4.8.6... " -cd ../build_$BITS/deps - -eval 7z x -y $DEPS/qt$BITS-4.8.6.7z $STRIP -mv qt-4.8.6-* Qt +cd $DEPS_INSTALL + +if [ -d Qt ] && head -n2 Qt/BUILDINFO.txt | grep "4.8.6" > /dev/null; then + printf "Exists. " +elif [ -z $SKIP_EXTRACT ]; then + rm -rf Qt + eval 7z x -y $DEPS/qt$BITS-4.8.6.7z $STRIP + mv qt-4.8.6-* Qt +fi QT_SDK="`real_pwd`/Qt" @@ -330,13 +449,26 @@ eval qtbinpatcher.exe $STRIP add_cmake_opts -DQT_QMAKE_EXECUTABLE="$QT_SDK/bin/qmake.exe" +if [ $CONFIGURATION == "Debug" ]; then + SUFFIX="d4" +else + SUFFIX="4" +fi +add_runtime_dlls `pwd`/bin/Qt{Core,Gui,Network,OpenGL}$SUFFIX.dll + cd $DEPS echo Done. # SDL2 printf "SDL 2.0.3... " -eval 7z x -y SDL2-2.0.3.zip $STRIP + +if [ -d SDL2-2.0.3 ]; then + printf "Exists. " +elif [ -z $SKIP_EXTRACT ]; then + rm -rf SDL2-2.0.3 + eval 7z x -y SDL2-2.0.3.zip $STRIP +fi SDL_SDK="`real_pwd`/SDL2-2.0.3" add_cmake_opts -DSDL2_INCLUDE_DIR="$SDL_SDK/include" \ @@ -344,23 +476,59 @@ add_cmake_opts -DSDL2_INCLUDE_DIR="$SDL_SDK/include" \ -DSDL2_LIBRARY_PATH="$SDL_SDK/lib/x$ARCHSUFFIX/SDL2.lib" \ -DSDL2_LIBRARY_ONLY="$SDL_SDK/lib/x$ARCHSUFFIX/SDL2.lib" +add_runtime_dlls `pwd`/SDL2-2.0.3/lib/x$ARCHSUFFIX/SDL2.dll + cd $DEPS echo Done. echo -cd ../build_$BITS +cd $DEPS_INSTALL/.. -echo "Building OpenMW..." +echo "Setting up OpenMW build..." add_cmake_opts -DBUILD_BSATOOL=no \ -DBUILD_ESMTOOL=no \ -DBUILD_MYGUI_PLUGIN=no \ - -DBUILD_OPENCS=no \ - -DBUILD_WIZARD=no \ - -DBUILD_ESSIMPORTER=no \ - -DBUILD_LAUNCHER=no \ - -DBUILD_MWINIIMPORTER=no + -DOPENMW_MP_BUILD=yes + +if [ -z $APPVEYOR ]; then + echo " (Outside of AppVeyor, doing full build.)" +else + case $STEP in + components ) + echo " Subproject: Components." + add_cmake_opts -DBUILD_ESSIMPORTER=no \ + -DBUILD_LAUNCHER=no \ + -DBUILD_MWINIIMPORTER=no \ + -DBUILD_OPENCS=no \ + -DBUILD_OPENMW=no \ + -DBUILD_WIZARD=no + rm -rf components + ;; + openmw ) + echo " Subproject: OpenMW." + add_cmake_opts -DBUILD_ESSIMPORTER=no \ + -DBUILD_LAUNCHER=no \ + -DBUILD_MWINIIMPORTER=no \ + -DBUILD_OPENCS=no \ + -DBUILD_WIZARD=no + ;; + opencs ) + echo " Subproject: OpenCS." + add_cmake_opts -DBUILD_ESSIMPORTER=no \ + -DBUILD_LAUNCHER=no \ + -DBUILD_MWINIIMPORTER=no \ + -DBUILD_OPENMW=no \ + -DBUILD_WIZARD=no + ;; + misc ) + echo " Subproject: Misc." + add_cmake_opts -DBUILD_OPENCS=no \ + -DBUILD_OPENMW=no + ;; + esac +fi if [ -z $VERBOSE ]; then printf " Configuring... " @@ -378,4 +546,11 @@ fi echo +echo "Copying Runtime DLLs..." +mkdir -p $CONFIGURATION +for DLL in $RUNTIME_DLLS; do + echo " `basename $DLL`." + cp "$DLL" $CONFIGURATION/ +done + exit $RET