Bring Ogre pre-build script up to OSG standard

coverity_scan
Alexander "Ace" Olofsson 10 years ago
parent e49cf2888d
commit a1e29162bd

@ -8,6 +8,15 @@ while [ $# -gt 0 ]; do
-v ) -v )
VERBOSE=true ;; VERBOSE=true ;;
-d )
SKIP_DOWNLOAD=true ;;
-e )
SKIP_EXTRACT=true ;;
-k )
KEEP=true ;;
* ) * )
echo "Unknown arg $ARG." echo "Unknown arg $ARG."
exit 1 ;; exit 1 ;;
@ -61,29 +70,46 @@ run_cmd() {
} }
download() { download() {
if ! [ -f $2 ]; then if [ $# -lt 3 ]; then
printf " Downloading $2... " echo "Invalid parameters to download."
return 1
fi
if [ -z $VERBOSE ]; then NAME=$1
curl --silent --retry 10 -kLy 5 -o $2 $1 shift
RET=$?
else
curl --retry 10 -kLy 5 -o $2 $1
RET=$?
fi
if [ $RET -ne 0 ]; then echo "$NAME..."
echo "Failed!"
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 else
echo "Done" echo " $FILE exists, skipping."
fi fi
done
return $RET if [ $# -ne 0 ]; then
else echo "Missing parameter."
echo " $2 exists, skipping."
fi fi
return 0
} }
real_pwd() { real_pwd() {
@ -95,6 +121,11 @@ add_cmake_opts() {
CMAKE_OPTS="$CMAKE_OPTS $@" CMAKE_OPTS="$CMAKE_OPTS $@"
} }
RUNTIME_DLLS=""
add_runtime_dlls() {
RUNTIME_DLLS="$RUNTIME_DLLS $@"
}
if [ -z $PLATFORM ]; then if [ -z $PLATFORM ]; then
PLATFORM=`uname -m` PLATFORM=`uname -m`
fi fi
@ -128,6 +159,21 @@ case $PLATFORM in
;; ;;
esac esac
case $CONFIGURATION in
debug|Debug|DEBUG )
CONFIGURATION=Debug
;;
release|Release|RELEASE )
CONFIGURATION=Release
;;
relwithdebinfo|RelWithDebInfo|RELWITHDEBINFO )
CONFIGURATION=RelWithDebInfo
;;
esac
echo echo
echo "==========================" echo "=========================="
echo "Starting prebuild on win$BITS" echo "Starting prebuild on win$BITS"
@ -139,58 +185,71 @@ cd deps
DEPS="`pwd`" DEPS="`pwd`"
echo "Downloading dependency packages." if [ -z $SKIP_DOWNLOAD ]; then
echo echo "Downloading dependency packages."
# 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
echo 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 # Boost
echo "MyGUI 3.2.2..." if [ -z $APPVEYOR ]; then
download http://www.lysator.liu.se/~ace/OpenMW/deps/MyGUI-3.2.2-win$BITS.7z MyGUI-3.2.2-win$BITS.7z download "Boost 1.58.0" \
echo 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 # Bullet
echo "Ogre 1.9..." download "Bullet 2.83.5" \
download http://www.lysator.liu.se/~ace/OpenMW/deps/Ogre-1.9-win$BITS.7z Ogre-1.9-win$BITS.7z http://www.lysator.liu.se/~ace/OpenMW/deps/Bullet-2.83.5-win$BITS.7z \
echo 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 cd ..
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
# Qt # Set up dependencies
echo "Qt 4.8.6..." if [ -z $KEEP ]; then
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
echo printf "Preparing build directory... "
# SDL2 rm -rf Build_$BITS
echo "SDL 2.0.3 binaries..." mkdir -p Build_$BITS/deps
download https://www.libsdl.org/release/SDL2-devel-2.0.3-VC.zip SDL2-2.0.3.zip
echo
cd .. echo Done.
fi
mkdir -p Build_$BITS/deps
cd Build_$BITS/deps
# Set up dependencies DEPS_INSTALL=`pwd`
rm -rf build_$BITS
mkdir -p build_$BITS/deps
cd deps
echo echo
echo "Extracting dependencies..." echo "Extracting dependencies..."
@ -198,11 +257,16 @@ echo "Extracting dependencies..."
# Boost # Boost
if [ -z $APPVEYOR ]; then if [ -z $APPVEYOR ]; then
printf "Boost 1.58.0... " printf "Boost 1.58.0... "
cd ../build_$BITS/deps cd $DEPS_INSTALL
BOOST_SDK="`real_pwd`/Boost" 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" \ add_cmake_opts -DBOOST_ROOT="$BOOST_SDK" \
-DBOOST_LIBRARYDIR="$BOOST_SDK/lib$BITS-msvc-12.0" -DBOOST_LIBRARYDIR="$BOOST_SDK/lib$BITS-msvc-12.0"
@ -218,11 +282,16 @@ else
fi fi
# Bullet # Bullet
printf "Bullet 2.83.4... " printf "Bullet 2.83.5... "
cd ../build_$BITS/deps cd $DEPS_INSTALL
eval 7z x -y $DEPS/Bullet-2.83.4-win$BITS.7z $STRIP if [ -d Bullet ]; then
mv Bullet-2.83.4-win$BITS Bullet 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" BULLET_SDK="`real_pwd`/Bullet"
add_cmake_opts -DBULLET_INCLUDE_DIR="$BULLET_SDK/include/bullet" \ add_cmake_opts -DBULLET_INCLUDE_DIR="$BULLET_SDK/include/bullet" \
@ -239,14 +308,20 @@ echo Done.
# FFmpeg # FFmpeg
printf "FFmpeg 2.5.2... " 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.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-dev.7z $STRIP
mv ffmpeg-2.5.2-win$BITS-shared FFmpeg mv ffmpeg-2.5.2-win$BITS-shared FFmpeg
cp -r ffmpeg-2.5.2-win$BITS-dev/* FFmpeg/ cp -r ffmpeg-2.5.2-win$BITS-dev/* FFmpeg/
rm -rf ffmpeg-2.5.2-win$BITS-dev rm -rf ffmpeg-2.5.2-win$BITS-dev
fi
FFMPEG_SDK="`real_pwd`/FFmpeg" FFMPEG_SDK="`real_pwd`/FFmpeg"
add_cmake_opts -DAVCODEC_INCLUDE_DIRS="$FFMPEG_SDK/include" \ 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_INCLUDE_DIRS="$FFMPEG_SDK/include" \
-DSWSCALE_LIBRARIES="$FFMPEG_SDK/lib/swscale.lib" -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 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
@ -272,34 +349,64 @@ cd $DEPS
echo Done. echo Done.
# Ogre # MyGUI
printf "Ogre 1.9... " printf "MyGUI 3.2.2... "
cd ../build_$BITS/deps 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 MYGUI_SDK="`real_pwd`/MyGUI"
mv Ogre-1.9-win$BITS Ogre
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 cd $DEPS
echo Done. echo Done.
# MyGUI # Ogre
printf "MyGUI 3.2.2... " printf "Ogre 1.9... "
cd ../build_$BITS/deps 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 OGRE_SDK="`real_pwd`/Ogre"
mv MyGUI-3.2.2-win$BITS MyGUI
MYGUI_SDK="`real_pwd`/MyGUI" add_cmake_opts -DOGRE_SDK="$OGRE_SDK"
add_cmake_opts -DMYGUISDK="$MYGUI_SDK" \ if [ $CONFIGURATION == "Debug" ]; then
-DMYGUI_PLATFORM_INCLUDE_DIRS="$MYGUI_SDK/include/MYGUI" \ SUFFIX="_d"
-DMYGUI_INCLUDE_DIRS="$MYGUI_SDK/include" \ else
-DMYGUI_PREQUEST_FILE="$MYGUI_SDK/include/MYGUI/MyGUI_Prerequest.h" 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 cd $DEPS
@ -307,21 +414,33 @@ echo Done.
# OpenAL # OpenAL
printf "OpenAL-Soft 1.16.0... " 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" 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" -DOPENAL_LIBRARY="$OPENAL_SDK/libs/Win$BITS/OpenAL32.lib"
echo Done. echo Done.
# Qt # Qt
printf "Qt 4.8.6... " printf "Qt 4.8.6... "
cd ../build_$BITS/deps cd $DEPS_INSTALL
eval 7z x -y $DEPS/qt$BITS-4.8.6.7z $STRIP if [ -d Qt ] && head -n2 Qt/BUILDINFO.txt | grep "4.8.6" > /dev/null; then
mv qt-4.8.6-* Qt 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" QT_SDK="`real_pwd`/Qt"
@ -330,13 +449,26 @@ eval qtbinpatcher.exe $STRIP
add_cmake_opts -DQT_QMAKE_EXECUTABLE="$QT_SDK/bin/qmake.exe" 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 cd $DEPS
echo Done. echo Done.
# SDL2 # SDL2
printf "SDL 2.0.3... " 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" SDL_SDK="`real_pwd`/SDL2-2.0.3"
add_cmake_opts -DSDL2_INCLUDE_DIR="$SDL_SDK/include" \ 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_PATH="$SDL_SDK/lib/x$ARCHSUFFIX/SDL2.lib" \
-DSDL2_LIBRARY_ONLY="$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 cd $DEPS
echo Done. echo Done.
echo echo
cd ../build_$BITS cd $DEPS_INSTALL/..
echo "Building OpenMW..." echo "Setting up OpenMW build..."
add_cmake_opts -DBUILD_BSATOOL=no \ add_cmake_opts -DBUILD_BSATOOL=no \
-DBUILD_ESMTOOL=no \ -DBUILD_ESMTOOL=no \
-DBUILD_MYGUI_PLUGIN=no \ -DBUILD_MYGUI_PLUGIN=no \
-DBUILD_OPENCS=no \ -DOPENMW_MP_BUILD=yes
-DBUILD_WIZARD=no \
-DBUILD_ESSIMPORTER=no \ if [ -z $APPVEYOR ]; then
-DBUILD_LAUNCHER=no \ echo " (Outside of AppVeyor, doing full build.)"
-DBUILD_MWINIIMPORTER=no 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 if [ -z $VERBOSE ]; then
printf " Configuring... " printf " Configuring... "
@ -378,4 +546,11 @@ fi
echo echo
echo "Copying Runtime DLLs..."
mkdir -p $CONFIGURATION
for DLL in $RUNTIME_DLLS; do
echo " `basename $DLL`."
cp "$DLL" $CONFIGURATION/
done
exit $RET exit $RET

Loading…
Cancel
Save