fix build

This commit is contained in:
Max Henzerling 2023-07-07 16:10:34 -07:00
parent 37a4b2a103
commit 29c7595f49
2 changed files with 327 additions and 253 deletions

View File

@ -62,6 +62,7 @@ VERBOSE=""
STRIP="" STRIP=""
SKIP_DOWNLOAD="" SKIP_DOWNLOAD=""
SKIP_EXTRACT="" SKIP_EXTRACT=""
USE_CCACHE=""
KEEP="" KEEP=""
UNITY_BUILD="" UNITY_BUILD=""
VS_VERSION="" VS_VERSION=""
@ -74,6 +75,9 @@ TEST_FRAMEWORK=""
GOOGLE_INSTALL_ROOT="" GOOGLE_INSTALL_ROOT=""
INSTALL_PREFIX="." INSTALL_PREFIX="."
BUILD_BENCHMARKS="" BUILD_BENCHMARKS=""
OSG_MULTIVIEW_BUILD=""
USE_WERROR=""
USE_CLANG_TIDY=""
ACTIVATE_MSVC="" ACTIVATE_MSVC=""
SINGLE_CONFIG="" SINGLE_CONFIG=""
@ -100,6 +104,9 @@ while [ $# -gt 0 ]; do
e ) e )
SKIP_EXTRACT=true ;; SKIP_EXTRACT=true ;;
C )
USE_CCACHE=true ;;
k ) k )
KEEP=true ;; KEEP=true ;;
@ -137,6 +144,15 @@ while [ $# -gt 0 ]; do
b ) b )
BUILD_BENCHMARKS=true ;; BUILD_BENCHMARKS=true ;;
M )
OSG_MULTIVIEW_BUILD=true ;;
E )
USE_WERROR=true ;;
T )
USE_CLANG_TIDY=true ;;
h ) h )
cat <<EOF cat <<EOF
Usage: $0 [-cdehkpuvVi] Usage: $0 [-cdehkpuvVi]
@ -145,6 +161,8 @@ Options:
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 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. For single-config generators, several configurations can be set up at once by specifying -c multiple times.
-C
Use ccache.
-d -d
Skip checking the downloads. Skip checking the downloads.
-e -e
@ -159,7 +177,7 @@ Options:
Build unit tests / Google test Build unit tests / Google test
-u -u
Configure for unity builds. Configure for unity builds.
-v <2017/2019> -v <2019/2022>
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. Cannot be used with -N. Produce NMake makefiles instead of a Visual Studio solution. Cannot be used with -N.
@ -173,6 +191,12 @@ Options:
CMake install prefix CMake install prefix
-b -b
Build benchmarks Build benchmarks
-M
Use a multiview build of OSG
-E
Use warnings as errors (/WX)
-T
Run clang-tidy
EOF EOF
wrappedExit 0 wrappedExit 0
;; ;;
@ -258,10 +282,10 @@ download() {
if [ -z $VERBOSE ]; then if [ -z $VERBOSE ]; then
RET=0 RET=0
curl --silent --retry 10 -Ly 5 -o $FILE $URL || RET=$? curl --silent --fail --retry 10 -Ly 5 -o $FILE $URL || RET=$?
else else
RET=0 RET=0
curl --retry 10 -Ly 5 -o $FILE $URL || RET=$? curl --fail --retry 10 -Ly 5 -o $FILE $URL || RET=$?
fi fi
if [ $RET -ne 0 ]; then if [ $RET -ne 0 ]; then
@ -338,34 +362,49 @@ if [ -z $PLATFORM ]; then
fi fi
if [ -z $VS_VERSION ]; then if [ -z $VS_VERSION ]; then
VS_VERSION="2017" VS_VERSION="2019"
fi fi
case $VS_VERSION in case $VS_VERSION in
17|17.0|2022 )
GENERATOR="Visual Studio 17 2022"
TOOLSET="vc143"
MSVC_REAL_VER="17"
MSVC_VER="14.3"
MSVC_DISPLAY_YEAR="2022"
OSG_MSVC_YEAR="2019"
MYGUI_MSVC_YEAR="2019"
LUA_MSVC_YEAR="2019"
QT_MSVC_YEAR="2019"
BULLET_MSVC_YEAR="2019"
BOOST_VER="1.80.0"
BOOST_VER_URL="1_80_0"
BOOST_VER_SDK="108000"
;;
16|16.0|2019 ) 16|16.0|2019 )
GENERATOR="Visual Studio 16 2019" GENERATOR="Visual Studio 16 2019"
TOOLSET="vc142" TOOLSET="vc142"
MSVC_REAL_VER="16" MSVC_REAL_VER="16"
MSVC_VER="14.2" MSVC_VER="14.2"
MSVC_YEAR="2015"
MSVC_REAL_YEAR="2019"
MSVC_DISPLAY_YEAR="2019" MSVC_DISPLAY_YEAR="2019"
BOOST_VER="1.71.0"
BOOST_VER_URL="1_71_0" OSG_MSVC_YEAR="2019"
BOOST_VER_SDK="107100" MYGUI_MSVC_YEAR="2019"
LUA_MSVC_YEAR="2019"
QT_MSVC_YEAR="2019"
BULLET_MSVC_YEAR="2019"
BOOST_VER="1.80.0"
BOOST_VER_URL="1_80_0"
BOOST_VER_SDK="108000"
;; ;;
15|15.0|2017 ) 15|15.0|2017 )
GENERATOR="Visual Studio 15 2017" echo "Visual Studio 2017 is no longer supported"
TOOLSET="vc141" wrappedExit 1
MSVC_REAL_VER="15"
MSVC_VER="14.1"
MSVC_YEAR="2015"
MSVC_REAL_YEAR="2017"
MSVC_DISPLAY_YEAR="2017"
BOOST_VER="1.67.0"
BOOST_VER_URL="1_67_0"
BOOST_VER_SDK="106700"
;; ;;
14|14.0|2015 ) 14|14.0|2015 )
@ -398,10 +437,6 @@ case $PLATFORM in
;; ;;
esac esac
if [ $BITS -eq 64 ] && [ $MSVC_REAL_VER -lt 16 ]; then
GENERATOR="${GENERATOR} Win64"
fi
if [ -n "$NMAKE" ]; then if [ -n "$NMAKE" ]; then
GENERATOR="NMake Makefiles" GENERATOR="NMake Makefiles"
SINGLE_CONFIG=true SINGLE_CONFIG=true
@ -485,7 +520,7 @@ for i in ${!CONFIGURATIONS[@]}; do
esac esac
done done
if [ $MSVC_REAL_VER -ge 16 ] && [ -z "$NMAKE" ] && [ -z "$NINJA" ]; then if [ -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"
else else
@ -503,6 +538,39 @@ if ! [ -z $UNITY_BUILD ]; then
add_cmake_opts "-DOPENMW_UNITY_BUILD=True" add_cmake_opts "-DOPENMW_UNITY_BUILD=True"
fi fi
if ! [ -z $USE_CCACHE ]; then
add_cmake_opts "-DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache"
fi
# turn on LTO by default
add_cmake_opts "-DOPENMW_LTO_BUILD=True"
if ! [ -z "$USE_WERROR" ]; then
add_cmake_opts "-DOPENMW_MSVC_WERROR=ON"
fi
if ! [ -z "$USE_CLANG_TIDY" ]; then
add_cmake_opts "-DCMAKE_CXX_CLANG_TIDY=\"clang-tidy --warnings-as-errors=*\""
fi
BULLET_VER="2.89"
FFMPEG_VER="4.2.2"
ICU_VER="70_1"
LUAJIT_VER="v2.1.0-beta3-452-g7a0cf5fd"
LZ4_VER="1.9.2"
OPENAL_VER="1.23.0"
QT_VER="5.15.2"
OSG_ARCHIVE_NAME="OSGoS 3.6.5"
OSG_ARCHIVE="OSGoS-3.6.5-123-g68c5c573d-msvc${OSG_MSVC_YEAR}-win${BITS}"
OSG_ARCHIVE_REPO_URL="https://gitlab.com/OpenMW/openmw-deps/-/raw/main"
if ! [ -z $OSG_MULTIVIEW_BUILD ]; then
OSG_ARCHIVE_NAME="OSG-3.6-multiview"
OSG_ARCHIVE="OSG-3.6-multiview-d2ee5aa8-msvc${OSG_MSVC_YEAR}-win${BITS}"
OSG_ARCHIVE_REPO_URL="https://gitlab.com/madsbuvi/openmw-deps/-/raw/openmw-vr-ovr_multiview"
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}"
@ -527,63 +595,67 @@ if [ -z $SKIP_DOWNLOAD ]; then
fi fi
# Bullet # Bullet
download "Bullet 2.89" \ download "Bullet ${BULLET_VER}" \
"https://gitlab.com/OpenMW/openmw-deps/-/raw/main/windows/Bullet-2.89-msvc${MSVC_YEAR}-win${BITS}-double.7z" \ "https://gitlab.com/OpenMW/openmw-deps/-/raw/main/windows/Bullet-${BULLET_VER}-msvc${BULLET_MSVC_YEAR}-win${BITS}-double-mt.7z" \
"Bullet-2.89-msvc${MSVC_YEAR}-win${BITS}-double.7z" "Bullet-${BULLET_VER}-msvc${BULLET_MSVC_YEAR}-win${BITS}-double-mt.7z"
# FFmpeg # FFmpeg
download "FFmpeg 4.2.2" \ download "FFmpeg ${FFMPEG_VER}" \
"https://gitlab.com/OpenMW/openmw-deps/-/raw/main/windows/ffmpeg-4.2.2-win${BITS}.zip" \ "https://gitlab.com/OpenMW/openmw-deps/-/raw/main/windows/ffmpeg-${FFMPEG_VER}-win${BITS}.zip" \
"ffmpeg-4.2.2-win${BITS}.zip" \ "ffmpeg-${FFMPEG_VER}-win${BITS}.zip" \
"https://gitlab.com/OpenMW/openmw-deps/-/raw/main/windows/ffmpeg-4.2.2-dev-win${BITS}.zip" \ "https://gitlab.com/OpenMW/openmw-deps/-/raw/main/windows/ffmpeg-${FFMPEG_VER}-dev-win${BITS}.zip" \
"ffmpeg-4.2.2-dev-win${BITS}.zip" "ffmpeg-${FFMPEG_VER}-dev-win${BITS}.zip"
# MyGUI # MyGUI
download "MyGUI 3.4.0" \ download "MyGUI 3.4.1" \
"https://gitlab.com/OpenMW/openmw-deps/-/raw/main/windows/MyGUI-3.4.0-msvc${MSVC_REAL_YEAR}-win${BITS}.7z" \ "https://gitlab.com/OpenMW/openmw-deps/-/raw/main/windows/MyGUI-3.4.1-msvc${MYGUI_MSVC_YEAR}-win${BITS}.7z" \
"MyGUI-3.4.0-msvc${MSVC_REAL_YEAR}-win${BITS}.7z" "MyGUI-3.4.1-msvc${MYGUI_MSVC_YEAR}-win${BITS}.7z"
if [ -n "$PDBS" ]; then if [ -n "$PDBS" ]; then
download "MyGUI symbols" \ download "MyGUI symbols" \
"https://gitlab.com/OpenMW/openmw-deps/-/raw/main/windows/MyGUI-3.4.0-msvc${MSVC_REAL_YEAR}-win${BITS}-sym.7z" \ "https://gitlab.com/OpenMW/openmw-deps/-/raw/main/windows/MyGUI-3.4.1-msvc${MYGUI_MSVC_YEAR}-win${BITS}-sym.7z" \
"MyGUI-3.4.0-msvc${MSVC_REAL_YEAR}-win${BITS}-sym.7z" "MyGUI-3.4.1-msvc${MYGUI_MSVC_YEAR}-win${BITS}-sym.7z"
fi fi
# OpenAL # OpenAL
download "OpenAL-Soft 1.20.1" \ download "OpenAL-Soft ${OPENAL_VER}" \
"https://gitlab.com/OpenMW/openmw-deps/-/raw/main/windows/OpenAL-Soft-1.20.1.zip" \ "https://gitlab.com/OpenMW/openmw-deps/-/raw/main/windows/OpenAL-Soft-${OPENAL_VER}.zip" \
"OpenAL-Soft-1.20.1.zip" "OpenAL-Soft-${OPENAL_VER}.zip"
# OSG # OSGoS
download "OpenSceneGraph 3.6.5" \ download "${OSG_ARCHIVE_NAME}" \
"https://gitlab.com/OpenMW/openmw-deps/-/raw/main/windows/OSG-3.6.5-msvc${MSVC_REAL_YEAR}-win${BITS}.7z" \ "${OSG_ARCHIVE_REPO_URL}/windows/${OSG_ARCHIVE}.7z" \
"OSG-3.6.5-msvc${MSVC_REAL_YEAR}-win${BITS}.7z" "${OSG_ARCHIVE}.7z"
if [ -n "$PDBS" ]; then if [ -n "$PDBS" ]; then
download "OpenSceneGraph symbols" \ download "${OSG_ARCHIVE_NAME} symbols" \
"https://gitlab.com/OpenMW/openmw-deps/-/raw/main/windows/OSG-3.6.5-msvc${MSVC_REAL_YEAR}-win${BITS}-sym.7z" \ "${OSG_ARCHIVE_REPO_URL}/windows/${OSG_ARCHIVE}-sym.7z" \
"OSG-3.6.5-msvc${MSVC_REAL_YEAR}-win${BITS}-sym.7z" "${OSG_ARCHIVE}-sym.7z"
fi fi
# SDL2 # SDL2
download "SDL 2.0.12" \ download "SDL 2.24.0" \
"https://gitlab.com/OpenMW/openmw-deps/-/raw/main/windows/SDL2-2.0.12.zip" \ "https://gitlab.com/OpenMW/openmw-deps/-/raw/main/windows/SDL2-devel-2.24.0-VC.zip" \
"SDL2-2.0.12.zip" "SDL2-devel-2.24.0-VC.zip"
# LZ4 # LZ4
download "LZ4 1.9.2" \ download "LZ4 ${LZ4_VER}" \
"https://gitlab.com/OpenMW/openmw-deps/-/raw/main/windows/lz4_win${BITS}_v1_9_2.7z" \ "https://gitlab.com/OpenMW/openmw-deps/-/raw/main/windows/lz4_win${BITS}_v${LZ4_VER//./_}.7z" \
"lz4_win${BITS}_v1_9_2.7z" "lz4_win${BITS}_v${LZ4_VER//./_}.7z"
# Google test and mock # LuaJIT
if [ ! -z $TEST_FRAMEWORK ]; then download "LuaJIT ${LUAJIT_VER}" \
echo "Google test 1.10.0..." "https://gitlab.com/OpenMW/openmw-deps/-/raw/main/windows/LuaJIT-${LUAJIT_VER}-msvc${LUA_MSVC_YEAR}-win${BITS}.7z" \
if [ -d googletest ]; then "LuaJIT-${LUAJIT_VER}-msvc${LUA_MSVC_YEAR}-win${BITS}.7z"
printf " Google test exists, skipping."
else # ICU
git clone -b release-1.10.0 https://github.com/google/googletest.git download "ICU ${ICU_VER/_/.}"\
fi "https://github.com/unicode-org/icu/releases/download/release-${ICU_VER/_/-}/icu4c-${ICU_VER}-Win${BITS}-MSVC2019.zip" \
fi "icu4c-${ICU_VER}-Win${BITS}-MSVC2019.zip"
download "zlib 1.2.11"\
"https://gitlab.com/OpenMW/openmw-deps/-/raw/main/windows/zlib-1.2.11-msvc2017-win64.7z" \
"zlib-1.2.11-msvc2017-win64.7z"
fi fi
cd .. #/.. cd .. #/..
@ -620,7 +692,6 @@ echo "---------------------------------------------------"
echo echo
# Boost
if [ -z $APPVEYOR ]; then if [ -z $APPVEYOR ]; then
printf "Boost ${BOOST_VER}... " printf "Boost ${BOOST_VER}... "
else else
@ -668,35 +739,33 @@ fi
} }
cd $DEPS cd $DEPS
echo echo
# Bullet printf "Bullet ${BULLET_VER}... "
printf "Bullet 2.89... "
{ {
cd $DEPS_INSTALL cd $DEPS_INSTALL
if [ -d Bullet ]; then if [ -d Bullet ]; then
printf -- "Exists. (No version checking) " printf -- "Exists. (No version checking) "
elif [ -z $SKIP_EXTRACT ]; then elif [ -z $SKIP_EXTRACT ]; then
rm -rf Bullet rm -rf Bullet
eval 7z x -y "${DEPS}/Bullet-2.89-msvc${MSVC_YEAR}-win${BITS}-double.7z" $STRIP eval 7z x -y "${DEPS}/Bullet-${BULLET_VER}-msvc${BULLET_MSVC_YEAR}-win${BITS}-double-mt.7z" $STRIP
mv "Bullet-2.89-msvc${MSVC_YEAR}-win${BITS}-double" Bullet mv "Bullet-${BULLET_VER}-msvc${BULLET_MSVC_YEAR}-win${BITS}-double-mt" Bullet
fi fi
add_cmake_opts -DBULLET_ROOT="$(real_pwd)/Bullet" add_cmake_opts -DBULLET_ROOT="$(real_pwd)/Bullet"
echo Done. echo Done.
} }
cd $DEPS cd $DEPS
echo echo
# FFmpeg printf "FFmpeg ${FFMPEG_VER}... "
printf "FFmpeg 4.2.2... "
{ {
cd $DEPS_INSTALL cd $DEPS_INSTALL
if [ -d FFmpeg ] && grep "4.2.2" FFmpeg/README.txt > /dev/null; then if [ -d FFmpeg ] && grep "${FFMPEG_VER}" FFmpeg/README.txt > /dev/null; then
printf "Exists. " printf "Exists. "
elif [ -z $SKIP_EXTRACT ]; then elif [ -z $SKIP_EXTRACT ]; then
rm -rf FFmpeg rm -rf FFmpeg
eval 7z x -y "${DEPS}/ffmpeg-4.2.2-win${BITS}.zip" $STRIP eval 7z x -y "${DEPS}/ffmpeg-${FFMPEG_VER}-win${BITS}.zip" $STRIP
eval 7z x -y "${DEPS}/ffmpeg-4.2.2-dev-win${BITS}.zip" $STRIP eval 7z x -y "${DEPS}/ffmpeg-${FFMPEG_VER}-dev-win${BITS}.zip" $STRIP
mv "ffmpeg-4.2.2-win${BITS}-shared" FFmpeg mv "ffmpeg-${FFMPEG_VER}-win${BITS}-shared" FFmpeg
cp -r "ffmpeg-4.2.2-win${BITS}-dev/"* FFmpeg/ cp -r "ffmpeg-${FFMPEG_VER}-win${BITS}-dev/"* FFmpeg/
rm -rf "ffmpeg-4.2.2-win${BITS}-dev" rm -rf "ffmpeg-${FFMPEG_VER}-win${BITS}-dev"
fi fi
export FFMPEG_HOME="$(real_pwd)/FFmpeg" export FFMPEG_HOME="$(real_pwd)/FFmpeg"
for config in ${CONFIGURATIONS[@]}; do for config in ${CONFIGURATIONS[@]}; do
@ -709,21 +778,20 @@ printf "FFmpeg 4.2.2... "
} }
cd $DEPS cd $DEPS
echo echo
# MyGUI printf "MyGUI 3.4.1... "
printf "MyGUI 3.4.0... "
{ {
cd $DEPS_INSTALL cd $DEPS_INSTALL
if [ -d MyGUI ] && \ if [ -d MyGUI ] && \
grep "MYGUI_VERSION_MAJOR 3" MyGUI/include/MYGUI/MyGUI_Prerequest.h > /dev/null && \ grep "MYGUI_VERSION_MAJOR 3" MyGUI/include/MYGUI/MyGUI_Prerequest.h > /dev/null && \
grep "MYGUI_VERSION_MINOR 4" MyGUI/include/MYGUI/MyGUI_Prerequest.h > /dev/null && \ grep "MYGUI_VERSION_MINOR 4" MyGUI/include/MYGUI/MyGUI_Prerequest.h > /dev/null && \
grep "MYGUI_VERSION_PATCH 0" MyGUI/include/MYGUI/MyGUI_Prerequest.h > /dev/null grep "MYGUI_VERSION_PATCH 1" MyGUI/include/MYGUI/MyGUI_Prerequest.h > /dev/null
then then
printf "Exists. " printf "Exists. "
elif [ -z $SKIP_EXTRACT ]; then elif [ -z $SKIP_EXTRACT ]; then
rm -rf MyGUI rm -rf MyGUI
eval 7z x -y "${DEPS}/MyGUI-3.4.0-msvc${MSVC_REAL_YEAR}-win${BITS}.7z" $STRIP eval 7z x -y "${DEPS}/MyGUI-3.4.1-msvc${MYGUI_MSVC_YEAR}-win${BITS}.7z" $STRIP
[ -n "$PDBS" ] && eval 7z x -y "${DEPS}/MyGUI-3.4.0-msvc${MSVC_REAL_YEAR}-win${BITS}-sym.7z" $STRIP [ -n "$PDBS" ] && eval 7z x -y "${DEPS}/MyGUI-3.4.1-msvc${MYGUI_MSVC_YEAR}-win${BITS}-sym.7z" $STRIP
mv "MyGUI-3.4.0-msvc${MSVC_REAL_YEAR}-win${BITS}" MyGUI mv "MyGUI-3.4.1-msvc${MYGUI_MSVC_YEAR}-win${BITS}" MyGUI
fi fi
export MYGUI_HOME="$(real_pwd)/MyGUI" export MYGUI_HOME="$(real_pwd)/MyGUI"
for CONFIGURATION in ${CONFIGURATIONS[@]}; do for CONFIGURATION in ${CONFIGURATIONS[@]}; do
@ -740,27 +808,25 @@ printf "MyGUI 3.4.0... "
} }
cd $DEPS cd $DEPS
echo echo
# OpenAL printf "OpenAL-Soft ${OPENAL_VER}... "
printf "OpenAL-Soft 1.20.1... "
{ {
if [ -d openal-soft-1.20.1-bin ]; then if [ -d openal-soft-${OPENAL_VER}-bin ]; then
printf "Exists. " printf "Exists. "
elif [ -z $SKIP_EXTRACT ]; then elif [ -z $SKIP_EXTRACT ]; then
rm -rf openal-soft-1.20.1-bin rm -rf openal-soft-${OPENAL_VER}-bin
eval 7z x -y OpenAL-Soft-1.20.1.zip $STRIP eval 7z x -y OpenAL-Soft-${OPENAL_VER}.zip $STRIP
fi fi
OPENAL_SDK="$(real_pwd)/openal-soft-1.20.1-bin" OPENAL_SDK="$(real_pwd)/openal-soft-${OPENAL_VER}-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"
for config in ${CONFIGURATIONS[@]}; do for config in ${CONFIGURATIONS[@]}; do
add_runtime_dlls $config "$(pwd)/openal-soft-1.20.1-bin/bin/WIN${BITS}/soft_oal.dll:OpenAL32.dll" add_runtime_dlls $config "$(pwd)/openal-soft-${OPENAL_VER}-bin/bin/WIN${BITS}/soft_oal.dll:OpenAL32.dll"
done done
echo Done. echo Done.
} }
cd $DEPS cd $DEPS
echo echo
# OSG printf "${OSG_ARCHIVE_NAME}... "
printf "OSG 3.6.5... "
{ {
cd $DEPS_INSTALL cd $DEPS_INSTALL
if [ -d OSG ] && \ if [ -d OSG ] && \
@ -771,51 +837,56 @@ printf "OSG 3.6.5... "
printf "Exists. " printf "Exists. "
elif [ -z $SKIP_EXTRACT ]; then elif [ -z $SKIP_EXTRACT ]; then
rm -rf OSG rm -rf OSG
eval 7z x -y "${DEPS}/OSG-3.6.5-msvc${MSVC_REAL_YEAR}-win${BITS}.7z" $STRIP eval 7z x -y "${DEPS}/${OSG_ARCHIVE}.7z" $STRIP
[ -n "$PDBS" ] && eval 7z x -y "${DEPS}/OSG-3.6.5-msvc${MSVC_REAL_YEAR}-win${BITS}-sym.7z" $STRIP [ -n "$PDBS" ] && eval 7z x -y "${DEPS}/${OSG_ARCHIVE}-sym.7z" $STRIP
mv "OSG-3.6.5-msvc${MSVC_REAL_YEAR}-win${BITS}" OSG mv "${OSG_ARCHIVE}" OSG
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 for CONFIGURATION in ${CONFIGURATIONS[@]}; do
if [ $CONFIGURATION == "Debug" ]; then if [ $CONFIGURATION == "Debug" ]; then
SUFFIX="d" SUFFIX="d"
SUFFIX_UPCASE="D"
else else
SUFFIX="" SUFFIX=""
SUFFIX_UPCASE=""
fi fi
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 if ! [ -z $OSG_MULTIVIEW_BUILD ]; then
add_osg_dlls $CONFIGURATION "$(pwd)/OSG/bin/osgPlugins-3.6.5/osgdb_"{bmp,dds,freetype,jpeg,osg,png,tga}${SUFFIX}.dll add_runtime_dlls $CONFIGURATION "$(pwd)/OSG/bin/"{ot21-OpenThreads,libpng16}${SUFFIX}.dll \
"$(pwd)/OSG/bin/osg162-osg"{,Animation,DB,FX,GA,Particle,Text,Util,Viewer,Shadow,Sim}${SUFFIX}.dll
else
add_runtime_dlls $CONFIGURATION "$(pwd)/OSG/bin/"{OpenThreads,icuuc58,libpng16}${SUFFIX}.dll \
"$(pwd)/OSG/bin/libxml2"${SUFFIX_UPCASE}.dll \
"$(pwd)/OSG/bin/osg"{,Animation,DB,FX,GA,Particle,Text,Util,Viewer,Shadow,Sim}${SUFFIX}.dll
add_runtime_dlls $CONFIGURATION "$(pwd)/OSG/bin/icudt58.dll"
if [ $CONFIGURATION == "Debug" ]; then
add_runtime_dlls $CONFIGURATION "$(pwd)/OSG/bin/"{boost_system-vc141-mt-gd-1_63,collada-dom2.4-dp-vc141-mt-d}.dll
else
add_runtime_dlls $CONFIGURATION "$(pwd)/OSG/bin/"{boost_system-vc141-mt-1_63,collada-dom2.4-dp-vc141-mt}.dll
fi
fi
add_osg_dlls $CONFIGURATION "$(pwd)/OSG/bin/osgPlugins-3.6.5/osgdb_"{bmp,dae,dds,freetype,jpeg,osg,png,tga}${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 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 done
echo Done. echo Done.
} }
cd $DEPS cd $DEPS
echo echo
# Qt printf "Qt ${QT_VER}... "
if [ -z $APPVEYOR ]; then
printf "Qt 5.15.0... "
else
printf "Qt 5.13 AppVeyor... "
fi
{ {
if [ $BITS -eq 64 ]; then if [ $BITS -eq 64 ]; then
SUFFIX="_64" SUFFIX="_64"
else else
SUFFIX="" SUFFIX=""
fi fi
if [ -z $APPVEYOR ]; then
cd $DEPS_INSTALL cd $DEPS_INSTALL
qt_version="5.15.0"
if [ "win${BITS}_msvc${MSVC_REAL_YEAR}${SUFFIX}" == "win64_msvc2017_64" ]; then
echo "This combination of options is known not to work. Falling back to Qt 5.14.2."
qt_version="5.14.2"
fi
QT_SDK="$(real_pwd)/Qt/${qt_version}/msvc${MSVC_REAL_YEAR}${SUFFIX}" QT_SDK="$(real_pwd)/Qt/${QT_VER}/msvc${QT_MSVC_YEAR}${SUFFIX}"
if [ -d "Qt/${qt_version}" ]; then if [ -d "Qt/${QT_VER}" ]; then
printf "Exists. " printf "Exists. "
elif [ -z $SKIP_EXTRACT ]; then elif [ -z $SKIP_EXTRACT ]; then
if [ $MISSINGPYTHON -ne 0 ]; then if [ $MISSINGPYTHON -ne 0 ]; then
@ -850,7 +921,7 @@ fi
mkdir Qt mkdir Qt
cd Qt cd Qt
run_cmd "${DEPS}/aqt-venv/${VENV_BIN_DIR}/aqt" install $qt_version windows desktop "win${BITS}_msvc${MSVC_REAL_YEAR}${SUFFIX}" run_cmd "${DEPS}/aqt-venv/${VENV_BIN_DIR}/aqt" install ${QT_VER} windows desktop "win${BITS}_msvc${QT_MSVC_YEAR}${SUFFIX}"
printf " Cleaning up extraneous data... " printf " Cleaning up extraneous data... "
rm -rf Qt/{aqtinstall.log,Tools} rm -rf Qt/{aqtinstall.log,Tools}
@ -867,58 +938,43 @@ fi
else else
DLLSUFFIX="" DLLSUFFIX=""
fi fi
add_runtime_dlls $CONFIGURATION "$(pwd)/bin/Qt5"{Core,Gui,Network,OpenGL,Widgets}${DLLSUFFIX}.dll if [ "${QT_VER:0:1}" -eq "6" ]; then
add_runtime_dlls $CONFIGURATION "$(pwd)/bin/Qt${QT_VER:0:1}"{Core,Gui,Network,OpenGL,OpenGLWidgets,Widgets}${DLLSUFFIX}.dll
else
add_runtime_dlls $CONFIGURATION "$(pwd)/bin/Qt${QT_VER:0:1}"{Core,Gui,Network,OpenGL,Widgets}${DLLSUFFIX}.dll
fi
add_qt_platform_dlls $CONFIGURATION "$(pwd)/plugins/platforms/qwindows${DLLSUFFIX}.dll" add_qt_platform_dlls $CONFIGURATION "$(pwd)/plugins/platforms/qwindows${DLLSUFFIX}.dll"
add_qt_style_dlls $CONFIGURATION "$(pwd)/plugins/styles/qwindowsvistastyle${DLLSUFFIX}.dll" add_qt_style_dlls $CONFIGURATION "$(pwd)/plugins/styles/qwindowsvistastyle${DLLSUFFIX}.dll"
done done
echo Done. echo Done.
else
QT_SDK="C:/Qt/5.13/msvc2017${SUFFIX}"
add_cmake_opts -DQT_QMAKE_EXECUTABLE="${QT_SDK}/bin/qmake.exe" \
-DCMAKE_PREFIX_PATH="$QT_SDK"
for CONFIGURATION in ${CONFIGURATIONS[@]}; do
if [ $CONFIGURATION == "Debug" ]; then
DLLSUFFIX="d"
else
DLLSUFFIX=""
fi
DIR=$(windowsPathAsUnix "${QT_SDK}")
add_runtime_dlls $CONFIGURATION "${DIR}/bin/Qt5"{Core,Gui,Network,OpenGL,Widgets}${DLLSUFFIX}.dll
add_qt_platform_dlls $CONFIGURATION "${DIR}/plugins/platforms/qwindows${DLLSUFFIX}.dll"
add_qt_style_dlls $CONFIGURATION "${DIR}/plugins/styles/qwindowsvistastyle${DLLSUFFIX}.dll"
done
echo Done.
fi
} }
cd $DEPS cd $DEPS
echo echo
# SDL2 printf "SDL 2.24.0... "
printf "SDL 2.0.12... "
{ {
if [ -d SDL2-2.0.12 ]; then if [ -d SDL2-2.24.0 ]; then
printf "Exists. " printf "Exists. "
elif [ -z $SKIP_EXTRACT ]; then elif [ -z $SKIP_EXTRACT ]; then
rm -rf SDL2-2.0.12 rm -rf SDL2-2.24.0
eval 7z x -y SDL2-2.0.12.zip $STRIP eval 7z x -y SDL2-devel-2.24.0-VC.zip $STRIP
fi fi
export SDL2DIR="$(real_pwd)/SDL2-2.0.12" export SDL2DIR="$(real_pwd)/SDL2-2.24.0"
for config in ${CONFIGURATIONS[@]}; do for config in ${CONFIGURATIONS[@]}; do
add_runtime_dlls $config "$(pwd)/SDL2-2.0.12/lib/x${ARCHSUFFIX}/SDL2.dll" add_runtime_dlls $config "$(pwd)/SDL2-2.24.0/lib/x${ARCHSUFFIX}/SDL2.dll"
done done
echo Done. echo Done.
} }
cd $DEPS cd $DEPS
echo echo
# LZ4 printf "LZ4 ${LZ4_VER}... "
printf "LZ4 1.9.2... "
{ {
if [ -d LZ4_1.9.2 ]; then if [ -d LZ4_${LZ4_VER} ]; then
printf "Exists. " printf "Exists. "
elif [ -z $SKIP_EXTRACT ]; then elif [ -z $SKIP_EXTRACT ]; then
rm -rf LZ4_1.9.2 rm -rf LZ4_${LZ4_VER}
eval 7z x -y lz4_win${BITS}_v1_9_2.7z -o$(real_pwd)/LZ4_1.9.2 $STRIP eval 7z x -y lz4_win${BITS}_v${LZ4_VER//./_}.7z -o$(real_pwd)/LZ4_${LZ4_VER} $STRIP
fi fi
export LZ4DIR="$(real_pwd)/LZ4_1.9.2" export LZ4DIR="$(real_pwd)/LZ4_${LZ4_VER}"
add_cmake_opts -DLZ4_INCLUDE_DIR="${LZ4DIR}/include" \ add_cmake_opts -DLZ4_INCLUDE_DIR="${LZ4DIR}/include" \
-DLZ4_LIBRARY="${LZ4DIR}/lib/liblz4.lib" -DLZ4_LIBRARY="${LZ4DIR}/lib/liblz4.lib"
for CONFIGURATION in ${CONFIGURATIONS[@]}; do for CONFIGURATION in ${CONFIGURATIONS[@]}; do
@ -928,65 +984,74 @@ printf "LZ4 1.9.2... "
SUFFIX="" SUFFIX=""
LZ4_CONFIGURATION="Release" LZ4_CONFIGURATION="Release"
fi fi
add_runtime_dlls $CONFIGURATION "$(pwd)/LZ4_1.9.2/bin/${LZ4_CONFIGURATION}/liblz4.dll" add_runtime_dlls $CONFIGURATION "$(pwd)/LZ4_${LZ4_VER}/bin/${LZ4_CONFIGURATION}/liblz4.dll"
done done
echo Done. echo Done.
} }
cd $DEPS cd $DEPS
echo echo
# Google Test and Google Mock printf "LuaJIT ${LUAJIT_VER}... "
if [ ! -z $TEST_FRAMEWORK ]; then {
printf "Google test 1.10.0 ..." if [ -d LuaJIT ]; then
printf "Exists. "
cd googletest elif [ -z $SKIP_EXTRACT ]; then
mkdir -p build${MSVC_REAL_YEAR} rm -rf LuaJIT
eval 7z x -y LuaJIT-${LUAJIT_VER}-msvc${LUA_MSVC_YEAR}-win${BITS}.7z -o$(real_pwd)/LuaJIT $STRIP
cd build${MSVC_REAL_YEAR} fi
export LUAJIT_DIR="$(real_pwd)/LuaJIT"
GOOGLE_INSTALL_ROOT="${DEPS_INSTALL}/GoogleTest" add_cmake_opts -DLuaJit_INCLUDE_DIR="${LUAJIT_DIR}/include" \
-DLuaJit_LIBRARY="${LUAJIT_DIR}/lib/lua51.lib"
for CONFIGURATION in ${CONFIGURATIONS[@]}; do 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. add_runtime_dlls $CONFIGURATION "$(pwd)/LuaJIT/bin/lua51.dll"
GTEST_CONFIG=$([ $CONFIGURATION == "RelWithDebInfo" ] && echo "Release" || echo "$CONFIGURATION" )
if [ $GTEST_CONFIG == "Debug" ]; then
DEBUG_SUFFIX="d"
else
DEBUG_SUFFIX=""
fi
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_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 "${GTEST_CONFIG}"
cmake --install . --config "${GTEST_CONFIG}" --prefix "${GOOGLE_INSTALL_ROOT}"
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 done
add_cmake_opts -DBUILD_UNITTESTS=yes
# FindGTest and FindGMock do not work perfectly on Windows
# but we can help them by telling them everything we know about installation
add_cmake_opts -DGMOCK_ROOT="$GOOGLE_INSTALL_ROOT"
add_cmake_opts -DGTEST_ROOT="$GOOGLE_INSTALL_ROOT"
add_cmake_opts -DGTEST_LIBRARY="$GOOGLE_INSTALL_ROOT/lib/gtest.lib"
add_cmake_opts -DGTEST_MAIN_LIBRARY="$GOOGLE_INSTALL_ROOT/lib/gtest_main.lib"
add_cmake_opts -DGMOCK_LIBRARY="$GOOGLE_INSTALL_ROOT/lib/gmock.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_LIBRARY_TYPE=SHARED
add_cmake_opts -DGTEST_MAIN_LIBRARY_TYPE=SHARED
echo Done. echo Done.
}
fi cd $DEPS
echo
printf "ICU ${ICU_VER/_/.}... "
{
if [ -d ICU-${ICU_VER} ]; then
printf "Exists. "
elif [ -z $SKIP_EXTRACT ]; then
rm -rf ICU-${ICU_VER}
eval 7z x -y icu4c-${ICU_VER}-Win${BITS}-MSVC2019.zip -o$(real_pwd)/ICU-${ICU_VER} $STRIP
fi
ICU_ROOT="$(real_pwd)/ICU-${ICU_VER}"
add_cmake_opts -DICU_ROOT="${ICU_ROOT}" \
-DICU_INCLUDE_DIR="${ICU_ROOT}/include" \
-DICU_I18N_LIBRARY="${ICU_ROOT}/lib${BITS}/icuin.lib " \
-DICU_UC_LIBRARY="${ICU_ROOT}/lib${BITS}/icuuc.lib " \
-DICU_DEBUG=ON
for config in ${CONFIGURATIONS[@]}; do
add_runtime_dlls $config "$(pwd)/ICU-${ICU_VER}/bin${BITS}/icudt${ICU_VER/_*/}.dll"
add_runtime_dlls $config "$(pwd)/ICU-${ICU_VER}/bin${BITS}/icuin${ICU_VER/_*/}.dll"
add_runtime_dlls $config "$(pwd)/ICU-${ICU_VER}/bin${BITS}/icuuc${ICU_VER/_*/}.dll"
done
echo Done.
}
cd $DEPS
echo
printf "zlib 1.2.11... "
{
if [ -d zlib-1.2.11-msvc2017-win64 ]; then
printf "Exists. "
elif [ -z $SKIP_EXTRACT ]; then
rm -rf zlib-1.2.11-msvc2017-win64
eval 7z x -y zlib-1.2.11-msvc2017-win64.7z $STRIP
fi
add_cmake_opts -DZLIB_ROOT="$(real_pwd)/zlib-1.2.11-msvc2017-win64"
for config in ${CONFIGURATIONS[@]}; do
if [ $CONFIGURATION == "Debug" ]; then
add_runtime_dlls $config "$(pwd)/zlib-1.2.11-msvc2017-win64/bin/zlibd.dll"
else
add_runtime_dlls $config "$(pwd)/zlib-1.2.11-msvc2017-win64/bin/zlib.dll"
fi
done
echo Done.
}
echo echo
cd $DEPS_INSTALL/.. cd $DEPS_INSTALL/..
@ -994,6 +1059,8 @@ echo
echo "Setting up OpenMW build..." echo "Setting up OpenMW build..."
add_cmake_opts -DOPENMW_MP_BUILD=on add_cmake_opts -DOPENMW_MP_BUILD=on
add_cmake_opts -DCMAKE_INSTALL_PREFIX="${INSTALL_PREFIX}" add_cmake_opts -DCMAKE_INSTALL_PREFIX="${INSTALL_PREFIX}"
add_cmake_opts -DOPENMW_USE_SYSTEM_SQLITE3=OFF
add_cmake_opts -DOPENMW_USE_SYSTEM_YAML_CPP=OFF
if [ ! -z $CI ]; then if [ ! -z $CI ]; then
case $STEP in case $STEP in
components ) components )
@ -1077,6 +1144,11 @@ if [ "${BUILD_BENCHMARKS}" ]; then
add_cmake_opts -DBUILD_BENCHMARKS=ON add_cmake_opts -DBUILD_BENCHMARKS=ON
fi fi
if [ -n "${TEST_FRAMEWORK}" ]; then
add_cmake_opts -DBUILD_UNITTESTS=ON
add_cmake_opts -DBUILD_OPENCS_TESTS=ON
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; }

View File

@ -1,5 +1,7 @@
#include "filesystemarchive.hpp" #include "filesystemarchive.hpp"
#include <algorithm>
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>
#include <components/debug/debuglog.hpp> #include <components/debug/debuglog.hpp>