diff --git a/CI/before_script.msvc.sh b/CI/before_script.msvc.sh new file mode 100755 index 000000000..5aa8d3e9d --- /dev/null +++ b/CI/before_script.msvc.sh @@ -0,0 +1,678 @@ +#!/bin/bash + +while [ $# -gt 0 ]; do + ARGSTR=$1 + shift + + if [ ${ARGSTR:0:1} != "-" ]; then + echo "Unknown argument $ARGSTR" + echo "Try '$0 -h'" + exit 1 + fi + + for (( i=1; i<${#ARGSTR}; i++ )); do + ARG=${ARGSTR:$i:1} + case $ARG in + V ) + VERBOSE=true ;; + + v ) + VS_VERSION=$1 + shift ;; + + d ) + SKIP_DOWNLOAD=true ;; + + e ) + SKIP_EXTRACT=true ;; + + k ) + KEEP=true ;; + + u ) + UNITY_BUILD=true ;; + + p ) + PLATFORM=$1 + shift ;; + + c ) + CONFIGURATION=$1 + shift ;; + + h ) + cat < + Set the configuration, can also be set with environment variable CONFIGURATION. + -d + Skip checking the downloads. + -e + Skip extracting dependencies. + -h + Show this message. + -k + Keep the old build directory, default is to delete it. + -p + Set the build platform, can also be set with environment variable PLATFORM. + -u + Configure for unity builds. + -v <2013/2015> + Choose the Visual Studio version to use. + -V + Run verbosely +EOF + exit 0 + ;; + + * ) + echo "Unknown argument $ARG." + echo "Try '$0 -h'" + exit 1 ;; + esac + done +done + +if [ -z $VERBOSE ]; then + STRIP="> /dev/null 2>&1" +fi +if [ -z $VS_VERSION ]; then + VS_VERSION="2013" +fi + +if [ -z $APPVEYOR ]; then + echo "Running prebuild outside of Appveyor." + + DIR=$(echo "$0" | sed "s,\\\\,/,g" | sed "s,\(.\):,/\\1,") + cd $(dirname "$DIR")/.. +else + echo "Running prebuild in Appveyor." + + cd $APPVEYOR_BUILD_FOLDER + VERSION="$(cat README.md | grep Version: | awk '{ print $3; }')-$(git rev-parse --short HEAD)" + appveyor UpdateBuild -Version "$VERSION" > /dev/null & +fi + +run_cmd() { + CMD="$1" + shift + + if [ -z $VERBOSE ]; then + eval $CMD $@ > output.log 2>&1 + RET=$? + + if [ $RET -ne 0 ]; then + if [ -z $APPVEYOR ]; then + echo "Command $CMD failed, output can be found in `real_pwd`/output.log" + else + echo + echo "Command $CMD failed;" + cat output.log + fi + else + rm output.log + fi + + return $RET + else + eval $CMD $@ + return $? + fi +} + +download() { + if [ $# -lt 3 ]; then + echo "Invalid parameters to download." + return 1 + fi + + NAME=$1 + shift + + 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 " $FILE exists, skipping." + fi + done + + if [ $# -ne 0 ]; then + echo "Missing parameter." + fi +} + +real_pwd() { + pwd | sed "s,/\(.\),\1:," +} + +CMAKE_OPTS="" +add_cmake_opts() { + CMAKE_OPTS="$CMAKE_OPTS $@" +} + +RUNTIME_DLLS="" +add_runtime_dlls() { + RUNTIME_DLLS="$RUNTIME_DLLS $@" +} + +OSG_PLUGINS="" +add_osg_dlls() { + OSG_PLUGINS="$OSG_PLUGINS $@" +} + +if [ -z $PLATFORM ]; then + PLATFORM=`uname -m` +fi + +if [ -z $CONFIGURATION ]; then + CONFIGURATION="Debug" +fi + +case $VS_VERSION in + 14|2015 ) + GENERATOR="Visual Studio 14 2015" + XP_TOOLSET="v140_xp" + ;; + +# 12|2013| + * ) + GENERATOR="Visual Studio 12 2013" + XP_TOOLSET="v120_xp" + ;; +esac + +case $PLATFORM in + x64|x86_64|x86-64|win64|Win64 ) + ARCHNAME=x86-64 + ARCHSUFFIX=64 + BITS=64 + + BASE_OPTS="-G\"$GENERATOR Win64\"" + add_cmake_opts "-G\"$GENERATOR Win64\"" + ;; + + x32|x86|i686|i386|win32|Win32 ) + ARCHNAME=x86 + ARCHSUFFIX=86 + BITS=32 + + BASE_OPTS="-G\"$GENERATOR\" -T$XP_TOOLSET" + add_cmake_opts "-G\"$GENERATOR\"" -T$XP_TOOLSET + ;; + + * ) + echo "Unknown platform $PLATFORM." + exit 1 + ;; +esac + +if ! [ -z $UNITY_BUILD ]; then + add_cmake_opts "-DOPENMW_UNITY_BUILD=True" +fi + +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" +echo "==========================" +echo + +# cd OpenMW/AppVeyor-test +mkdir -p deps +cd deps + +DEPS="`pwd`" + +if [ -z $SKIP_DOWNLOAD ]; then + echo "Downloading dependency packages." + 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 + + # 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-binaries/openal-soft-1.16.0-bin.zip \ + OpenAL-Soft-1.16.0.zip + + # OSG + download "OpenSceneGraph 3.3.8" \ + http://www.lysator.liu.se/~ace/OpenMW/deps/OSG-3.3.8-win$BITS.7z \ + OSG-3.3.8-win$BITS.7z + + # Qt + if [ -z $APPVEYOR ]; then + 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 + fi + + # SDL2 + download "SDL 2.0.3" \ + https://www.libsdl.org/release/SDL2-devel-2.0.3-VC.zip \ + SDL2-2.0.3.zip +fi + +cd .. #/.. + +# Set up dependencies +if [ -z $KEEP ]; then + echo + printf "Preparing build directory... " + + rm -rf Build_$BITS + mkdir -p Build_$BITS/deps + + echo Done. +fi +mkdir -p Build_$BITS/deps +cd Build_$BITS/deps + +DEPS_INSTALL=`pwd` +cd $DEPS + +echo +echo "Extracting dependencies..." + + +# Boost +printf "Boost 1.58.0... " +{ + if [ -z $APPVEYOR ]; then + cd $DEPS_INSTALL + + BOOST_SDK="`real_pwd`/Boost" + + 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" + + echo Done. + else + # Appveyor unstable has all the boost we need already + BOOST_SDK="c:/Libraries/boost" + add_cmake_opts -DBOOST_ROOT="$BOOST_SDK" \ + -DBOOST_LIBRARYDIR="$BOOST_SDK/lib$BITS-msvc-12.0" + + echo AppVeyor. + fi +} +cd $DEPS + +# 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" \ + -DBULLET_COLLISION_LIBRARY="$BULLET_SDK/lib/BulletCollision.lib" \ + -DBULLET_COLLISION_LIBRARY_DEBUG="$BULLET_SDK/lib/BulletCollision_Debug.lib" \ + -DBULLET_MATH_LIBRARY="$BULLET_SDK/lib/LinearMath.lib" \ + -DBULLET_MATH_LIBRARY_DEBUG="$BULLET_SDK/lib/LinearMath_Debug.lib" + + echo Done. +} +cd $DEPS + +# FFmpeg +printf "FFmpeg 2.5.2... " +{ + 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 + + 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" \ + -DAVCODEC_LIBRARIES="$FFMPEG_SDK/lib/avcodec.lib" \ + -DAVDEVICE_INCLUDE_DIRS="$FFMPEG_SDK/include" \ + -DAVDEVICE_LIBRARIES="$FFMPEG_SDK/lib/avdevice.lib" \ + -DAVFORMAT_INCLUDE_DIRS="$FFMPEG_SDK/include" \ + -DAVFORMAT_LIBRARIES="$FFMPEG_SDK/lib/avformat.lib" \ + -DAVUTIL_INCLUDE_DIRS="$FFMPEG_SDK/include" \ + -DAVUTIL_LIBRARIES="$FFMPEG_SDK/lib/avutil.lib" \ + -DPOSTPROC_INCLUDE_DIRS="$FFMPEG_SDK/include" \ + -DPOSTPROC_LIBRARIES="$FFMPEG_SDK/lib/postproc.lib" \ + -DSWRESAMPLE_INCLUDE_DIRS="$FFMPEG_SDK/include" \ + -DSWRESAMPLE_LIBRARIES="$FFMPEG_SDK/lib/swresample.lib" \ + -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 + + echo Done. +} +cd $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 + + MYGUI_SDK="`real_pwd`/MyGUI" + + add_cmake_opts -DMYGUISDK="$MYGUI_SDK" \ + -DMYGUI_INCLUDE_DIRS="$MYGUI_SDK/include/MYGUI" \ + -DMYGUI_PREQUEST_FILE="$MYGUI_SDK/include/MYGUI/MyGUI_Prerequest.h" + + if [ $CONFIGURATION == "Debug" ]; then + SUFFIX="_d" + else + SUFFIX="" + fi + add_runtime_dlls `pwd`/MyGUI/bin/$CONFIGURATION/MyGUIEngine$SUFFIX.dll + + echo Done. +} +cd $DEPS + +# OpenAL +printf "OpenAL-Soft 1.16.0... " +{ + 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/AL" \ + -DOPENAL_LIBRARY="$OPENAL_SDK/libs/Win$BITS/OpenAL32.lib" + + echo Done. +} +cd $DEPS + +# OSG +printf "OSG 3.3.8... " +{ + cd $DEPS_INSTALL + + if [ -d OSG ] && \ + grep "OPENSCENEGRAPH_MAJOR_VERSION 3" OSG/include/osg/Version > /dev/null && \ + grep "OPENSCENEGRAPH_MINOR_VERSION 3" OSG/include/osg/Version > /dev/null && \ + grep "OPENSCENEGRAPH_PATCH_VERSION 8" OSG/include/osg/Version > /dev/null + then + printf "Exists. " + elif [ -z $SKIP_EXTRACT ]; then + rm -rf OSG + eval 7z x -y $DEPS/OSG-3.3.8-win$BITS.7z $STRIP + mv OSG-3.3.8-win$BITS OSG + fi + + OSG_SDK="`real_pwd`/OSG" + + add_cmake_opts -DOSG_DIR="$OSG_SDK" + + if [ $CONFIGURATION == "Debug" ]; then + SUFFIX="d" + else + SUFFIX="" + fi + + add_runtime_dlls `pwd`/OSG/bin/{OpenThreads,zlib}$SUFFIX.dll \ + `pwd`/OSG/bin/osg{,Animation,DB,FX,GA,Particle,Qt,Text,Util,Viewer}$SUFFIX.dll + + add_osg_dlls `pwd`/OSG/bin/osgPlugins-3.3.8/osgdb_{bmp,dds,gif,jpeg,png,tga}$SUFFIX.dll + + echo Done. +} +cd $DEPS + +# Qt +if [ -z $APPVEYOR ]; then + printf "Qt 4.8.6... " +else + printf "Qt 5.4... " +fi +{ + if [ -z $APPVEYOR ]; then + cd $DEPS_INSTALL + QT_SDK="`real_pwd`/Qt" + + 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 + cd Qt + eval ./qtbinpatcher.exe $STRIP + fi + + cd $QT_SDK + + add_cmake_opts -DDESIRED_QT_VERSION=4 \ + -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 + + echo Done. + else + if [ $BITS -eq 32 ]; then + QT_SDK="C:/Qt/5.4/msvc2013_opengl" + else + QT_SDK="C:/Qt/5.4/msvc2013_64_opengl" + fi + + add_cmake_opts -DDESIRED_QT_VERSION=5 \ + -DQT_QMAKE_EXECUTABLE="$QT_SDK/bin/qmake.exe" \ + -DCMAKE_PREFIX_PATH="$QT_SDK" + + echo AppVeyor. + fi +} +cd $DEPS + +# SDL2 +printf "SDL 2.0.3... " +{ + 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" \ + -DSDL2MAIN_LIBRARY="$SDL_SDK/lib/x$ARCHSUFFIX/SDL2main.lib" \ + -DSDL2_LIBRARY_PATH="$SDL_SDK/lib/x$ARCHSUFFIX/SDL2.lib" + + add_runtime_dlls `pwd`/SDL2-2.0.3/lib/x$ARCHSUFFIX/SDL2.dll + + echo Done. +} + + +cd $DEPS_INSTALL/.. + +echo +echo "Setting up OpenMW build..." + +add_cmake_opts -DBUILD_BSATOOL=no \ + -DBUILD_ESMTOOL=no \ + -DBUILD_MYGUI_PLUGIN=no \ + -DOPENMW_MP_BUILD=on + +if [ -z $CI ]; then + echo " (Outside of CI, 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 + ;; + 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 + ;; + * ) + echo " Building everything." + ;; + esac +fi + +if [ -z $VERBOSE ]; then + printf " Configuring... " +else + echo " cmake .. $CMAKE_OPTS" +fi + +run_cmd cmake .. $CMAKE_OPTS +RET=$? + +if [ -z $VERBOSE ]; then + if [ $RET -eq 0 ]; then echo Done. + else echo Failed.; fi +fi + +echo + +# NOTE: Disable this when/if we want to run test cases +if [ -z $CI ]; then + echo "Copying Runtime DLLs..." + mkdir -p $CONFIGURATION + for DLL in $RUNTIME_DLLS; do + echo " `basename $DLL`." + cp "$DLL" $CONFIGURATION/ + done + echo "OSG Plugin DLLs..." + mkdir -p $CONFIGURATION/osgPlugins-3.3.8 + for DLL in $OSG_PLUGINS; do + echo " `basename $DLL`." + cp "$DLL" $CONFIGURATION/osgPlugins-3.3.8 + done + echo +fi + +exit $RET diff --git a/CI/build.msvc.sh b/CI/build.msvc.sh new file mode 100644 index 000000000..731c51eda --- /dev/null +++ b/CI/build.msvc.sh @@ -0,0 +1,59 @@ +#!/bin/bash + +if [ -z $PLATFORM ]; then + PLATFORM=`uname -m` +fi + +if [ -z $CONFIGURATION ]; then + CONFIGURATION="Debug" +fi + +case $PLATFORM in + x32|x86|i686|i386|win32|Win32 ) + BITS=32 + PLATFORM=Win32 + ;; + + x64|x86_64|x86-64|win64|Win64 ) + BITS=64 + PLATFORM=x64 + ;; + + * ) + echo "Unknown platform $PLATFORM." + exit 1 ;; +esac + +if [ -z $APPVEYOR ]; then + echo "Running $BITS-bit $CONFIGURATION build outside of Appveyor." + + DIR=$(echo "$0" | sed "s,\\\\,/,g" | sed "s,\(.\):,/\\1,") + cd $(dirname "$DIR")/.. +else + echo "Running $BITS-bit $CONFIGURATION build in Appveyor." + + cd $APPVEYOR_BUILD_FOLDER +fi + +cd build_$BITS + +which msbuild > /dev/null +if [ $? -ne 0 ]; then + msbuild() { + /c/Program\ Files\ \(x86\)/MSBuild/12.0/Bin/MSBuild.exe "$@" + } +fi + +if [ -z $APPVEYOR ]; then + msbuild OpenMW.sln //t:Build //m:8 +else + msbuild OpenMW.sln //t:Build //m:8 //logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" +fi + +RET=$? +if [ $RET -eq 0 ] && [ ! -z $PACKAGE ]; then + msbuild PACKAGE.vcxproj //t:Build //m:8 + RET=$? +fi + +exit $RET diff --git a/CMakeLists.txt b/CMakeLists.txt index fd7e3d564..cc9c74df9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -116,8 +116,37 @@ if (WIN32) option(USE_DEBUG_CONSOLE "whether a debug console should be enabled for debug builds, if false debug output is redirected to Visual Studio output" ON) endif() -# We probably support older versions than this. -cmake_minimum_required(VERSION 2.6) +if (NOT BUILD_LAUNCHER AND NOT BUILD_OPENCS AND NOT BUILD_WIZARD) + set(USE_QT FALSE) +else() + set(USE_QT TRUE) +endif() + +# Dependencies +if (USE_QT) + set(DESIRED_QT_VERSION 4 CACHE STRING "The QT version OpenMW should use (4 or 5)") + set_property(CACHE DESIRED_QT_VERSION PROPERTY STRINGS 4 5) + message(STATUS "Using Qt${DESIRED_QT_VERSION}") + + if (DESIRED_QT_VERSION MATCHES 4) + find_package(Qt4 REQUIRED COMPONENTS QtCore QtGui QtNetwork QtOpenGL) + else() + find_package(Qt5Widgets REQUIRED) + find_package(Qt5Core REQUIRED) + find_package(Qt5Network REQUIRED) + find_package(Qt5OpenGL REQUIRED) + # Instruct CMake to run moc automatically when needed. + #set(CMAKE_AUTOMOC ON) + endif() +endif() + +if (USE_QT AND DESIRED_QT_VERSION MATCHES 5) + # 2.8.11+ is required to make Qt5 happy and allow linking QtMain on Windows. + cmake_minimum_required(VERSION 2.8.11) +else() + # We probably support older versions than this. + cmake_minimum_required(VERSION 2.6) +endif() # Sound setup unset(FFMPEG_LIBRARIES CACHE) @@ -171,30 +200,6 @@ if (OPENGL_ES) add_definitions(-DOPENGL_ES) endif(OPENGL_ES) -if (NOT BUILD_LAUNCHER AND NOT BUILD_OPENCS AND NOT BUILD_WIZARD) - set(USE_QT FALSE) -else() - set(USE_QT TRUE) -endif() - -# Dependencies -if (USE_QT) - set(DESIRED_QT_VERSION 4 CACHE STRING "The QT version OpenMW should use (4 or 5)") - set_property(CACHE DESIRED_QT_VERSION PROPERTY STRINGS 4 5) - message(STATUS "Using Qt${DESIRED_QT_VERSION}") - - if (DESIRED_QT_VERSION MATCHES 4) - find_package(Qt4 REQUIRED COMPONENTS QtCore QtGui QtNetwork QtOpenGL) - else() - find_package(Qt5Widgets REQUIRED) - find_package(Qt5Core REQUIRED) - find_package(Qt5Network REQUIRED) - find_package(Qt5OpenGL REQUIRED) - # Instruct CMake to run moc automatically when needed. - #set(CMAKE_AUTOMOC ON) - endif() -endif() - # Fix for not visible pthreads functions for linker with glibc 2.15 if (UNIX AND NOT APPLE) find_package (Threads) diff --git a/README.md b/README.md index 9cfb0440d..b55a89945 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ OpenMW ====== -[![Build Status](https://img.shields.io/travis/OpenMW/openmw.svg)](https://travis-ci.org/OpenMW/openmw) [![Coverity Scan Build Status](https://scan.coverity.com/projects/3740/badge.svg)](https://scan.coverity.com/projects/3740) +[![Build Status](https://img.shields.io/travis/OpenMW/openmw.svg)](https://travis-ci.org/OpenMW/openmw) [![Build status](https://ci.appveyor.com/api/projects/status/e6bqw8oouy8ufd46?svg=true)](https://ci.appveyor.com/project/ace13/openmw) [![Coverity Scan Build Status](https://scan.coverity.com/projects/3740/badge.svg)](https://scan.coverity.com/projects/3740) OpenMW is a recreation of the engine for the popular role-playing game Morrowind by Bethesda Softworks. You need to own and install the original game for OpenMW to work. diff --git a/apps/launcher/CMakeLists.txt b/apps/launcher/CMakeLists.txt index 75f76a532..207f6a84b 100644 --- a/apps/launcher/CMakeLists.txt +++ b/apps/launcher/CMakeLists.txt @@ -99,9 +99,6 @@ if (DESIRED_QT_VERSION MATCHES 4) endif(WIN32) else() qt5_use_modules(openmw-launcher Widgets Core) - if (WIN32) - target_link_libraries(Qt5::WinMain) - endif() endif() if (BUILD_WITH_CODE_COVERAGE) diff --git a/apps/opencs/CMakeLists.txt b/apps/opencs/CMakeLists.txt index dde531051..0bde541bf 100644 --- a/apps/opencs/CMakeLists.txt +++ b/apps/opencs/CMakeLists.txt @@ -215,9 +215,6 @@ if (DESIRED_QT_VERSION MATCHES 4) endif() else() qt5_use_modules(openmw-cs Widgets Core Network OpenGL) - if (WIN32) - target_link_libraries(Qt5::WinMain) - endif() endif() if (WIN32) diff --git a/apps/wizard/CMakeLists.txt b/apps/wizard/CMakeLists.txt index 89438640c..4be5fb2b7 100644 --- a/apps/wizard/CMakeLists.txt +++ b/apps/wizard/CMakeLists.txt @@ -129,9 +129,6 @@ if (DESIRED_QT_VERSION MATCHES 4) endif() else() qt5_use_modules(openmw-wizard Widgets Core) - if (WIN32) - target_link_libraries(Qt5::WinMain) - endif() endif() if (OPENMW_USE_UNSHIELD) diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 000000000..1bc0d3ca6 --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,54 @@ +version: "{build}" + +branches: + only: + - master + - /openmw-.*$/ + - appveyor + +platform: + - Win32 +# - x64 + +configuration: Debug + +matrix: + fast_finish: true + +# For the Qt, Boost, CMake, etc installs +os: unstable + +# We want the git revision for versioning, +# so shallow clones don't work. +clone_depth: 1 + +cache: + - C:\projects\openmw\deps\Bullet-2.83.5-win32.7z + - C:\projects\openmw\deps\Bullet-2.83.5-win64.7z + - C:\projects\openmw\deps\MyGUI-3.2.2-win32.7z + - C:\projects\openmw\deps\MyGUI-3.2.2-win64.7z + - C:\projects\openmw\deps\OSG-3.3.8-win32.7z + - C:\projects\openmw\deps\OSG-3.3.8-win64.7z + - C:\projects\openmw\deps\ffmpeg32-2.5.2.7z + - C:\projects\openmw\deps\ffmpeg32-2.5.2-dev.7z + - C:\projects\openmw\deps\ffmpeg64-2.5.2.7z + - C:\projects\openmw\deps\ffmpeg64-2.5.2-dev.7z + +clone_folder: C:\projects\openmw + +before_build: + - cmd: sh %APPVEYOR_BUILD_FOLDER%\CI\before_script.msvc.sh -u -p %PLATFORM% + +build_script: + - cmd: if %PLATFORM%==Win32 set build=Build_32 + - cmd: if %PLATFORM%==x64 set build=Build_64 + - cmd: msbuild %build%\OpenMW.sln /t:Build /p:Configuration=%configuration% /m:2 /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" + +test: off + +#notifications: +# - provider: Email +# to: +# - +# on_build_failure: true +# on_build_status_changed: true