1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-06-19 06:41:36 +00:00

Merge branch 'ci-werror' into 'master'

Windows, MSVC: Enable warnings as errors on CI

See merge request OpenMW/openmw!2146
This commit is contained in:
psi29a 2022-07-17 15:49:51 +00:00
commit 6cc3ec12db
5 changed files with 115 additions and 99 deletions

View file

@ -84,7 +84,7 @@ Coverity:
CXX: clang++ CXX: clang++
CXXFLAGS: -O0 CXXFLAGS: -O0
artifacts: artifacts:
paths: paths:
- /builds/OpenMW/openmw/cov-int/build-log.txt - /builds/OpenMW/openmw/cov-int/build-log.txt
Ubuntu_GCC: Ubuntu_GCC:
@ -376,7 +376,7 @@ macOS12_Xcode13:
- $env:CCACHE_BASEDIR = Get-Location - $env:CCACHE_BASEDIR = Get-Location
- $env:CCACHE_DIR = "$(Get-Location)\ccache" - $env:CCACHE_DIR = "$(Get-Location)\ccache"
- New-Item -Type Directory -Force -Path $env:CCACHE_DIR - New-Item -Type Directory -Force -Path $env:CCACHE_DIR
- sh CI/before_script.msvc.sh -c $config -p Win64 -v 2019 -k -V -N -b -t -C $multiview - sh CI/before_script.msvc.sh -c $config -p Win64 -v 2019 -k -V -N -b -t -C $multiview -E
- cd MSVC2019_64_Ninja - cd MSVC2019_64_Ninja
- .\ActivateMSVC.ps1 - .\ActivateMSVC.ps1
- cmake --build . --config $config - cmake --build . --config $config
@ -478,7 +478,7 @@ macOS12_Xcode13:
- $env:CCACHE_BASEDIR = Get-Location - $env:CCACHE_BASEDIR = Get-Location
- $env:CCACHE_DIR = "$(Get-Location)\ccache" - $env:CCACHE_DIR = "$(Get-Location)\ccache"
- New-Item -Type Directory -Force -Path $env:CCACHE_DIR - New-Item -Type Directory -Force -Path $env:CCACHE_DIR
- sh CI/before_script.msvc.sh -c $config -p Win64 -v 2019 -k -V -b -t -C $multiview - sh CI/before_script.msvc.sh -c $config -p Win64 -v 2019 -k -V -b -t -C $multiview -E
- cd MSVC2019_64 - cd MSVC2019_64
- cmake --build . --config $config - cmake --build . --config $config
- ccache --show-stats - ccache --show-stats

View file

@ -76,6 +76,8 @@ GOOGLE_INSTALL_ROOT=""
INSTALL_PREFIX="." INSTALL_PREFIX="."
BUILD_BENCHMARKS="" BUILD_BENCHMARKS=""
OSG_MULTIVIEW_BUILD="" OSG_MULTIVIEW_BUILD=""
USE_WERROR=""
USE_CLANG_TIDY=""
ACTIVATE_MSVC="" ACTIVATE_MSVC=""
SINGLE_CONFIG="" SINGLE_CONFIG=""
@ -116,7 +118,7 @@ while [ $# -gt 0 ]; do
n ) n )
NMAKE=true ;; NMAKE=true ;;
N ) N )
NINJA=true ;; NINJA=true ;;
@ -140,10 +142,16 @@ while [ $# -gt 0 ]; do
b ) b )
BUILD_BENCHMARKS=true ;; BUILD_BENCHMARKS=true ;;
M ) M )
OSG_MULTIVIEW_BUILD=true ;; 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]
@ -182,8 +190,12 @@ Options:
CMake install prefix CMake install prefix
-b -b
Build benchmarks Build benchmarks
-M -M
Use a multiview build of OSG Use a multiview build of OSG
-E
Use warnings as errors (/WX)
-T
Run clang-tidy
EOF EOF
wrappedExit 0 wrappedExit 0
;; ;;
@ -518,6 +530,14 @@ if ! [ -z $USE_CCACHE ]; then
add_cmake_opts "-DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache" add_cmake_opts "-DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache"
fi fi
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
ICU_VER="70_1" ICU_VER="70_1"
OSG_ARCHIVE_NAME="OSGoS 3.6.5" OSG_ARCHIVE_NAME="OSGoS 3.6.5"
@ -835,108 +855,77 @@ printf "${OSG_ARCHIVE_NAME}... "
cd $DEPS cd $DEPS
echo echo
# Qt # Qt
if [ -z $APPVEYOR ]; then printf "Qt 5.15.2... "
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
qt_version="5.15.0" cd $DEPS_INSTALL
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.15.2"
qt_version="5.14.2"
QT_SDK="$(real_pwd)/Qt/${qt_version}/msvc${MSVC_REAL_YEAR}${SUFFIX}"
if [ -d "Qt/${qt_version}" ]; then
printf "Exists. "
elif [ -z $SKIP_EXTRACT ]; then
if [ $MISSINGPYTHON -ne 0 ]; then
echo "Can't be automatically installed without Python."
wrappedExit 1
fi fi
QT_SDK="$(real_pwd)/Qt/${qt_version}/msvc${MSVC_REAL_YEAR}${SUFFIX}" pushd "$DEPS" > /dev/null
if ! [ -d 'aqt-venv' ]; then
if [ -d "Qt/${qt_version}" ]; then echo " Creating Virtualenv for aqt..."
printf "Exists. " run_cmd python -m venv aqt-venv
elif [ -z $SKIP_EXTRACT ]; then fi
if [ $MISSINGPYTHON -ne 0 ]; then if [ -d 'aqt-venv/bin' ]; then
echo "Can't be automatically installed without Python." VENV_BIN_DIR='bin'
wrappedExit 1 elif [ -d 'aqt-venv/Scripts' ]; then
fi VENV_BIN_DIR='Scripts'
else
pushd "$DEPS" > /dev/null echo "Error: Failed to create virtualenv in expected location."
if ! [ -d 'aqt-venv' ]; then wrappedExit 1
echo " Creating Virtualenv for aqt..."
run_cmd python -m venv aqt-venv
fi
if [ -d 'aqt-venv/bin' ]; then
VENV_BIN_DIR='bin'
elif [ -d 'aqt-venv/Scripts' ]; then
VENV_BIN_DIR='Scripts'
else
echo "Error: Failed to create virtualenv in expected location."
wrappedExit 1
fi
# check version
aqt-venv/${VENV_BIN_DIR}/pip list | grep 'aqtinstall\s*1.1.3' || [ $? -ne 0 ]
if [ $? -eq 0 ]; then
echo " Installing aqt wheel into virtualenv..."
run_cmd "aqt-venv/${VENV_BIN_DIR}/pip" install aqtinstall==1.1.3
fi
popd > /dev/null
rm -rf Qt
mkdir Qt
cd Qt
run_cmd "${DEPS}/aqt-venv/${VENV_BIN_DIR}/aqt" install $qt_version windows desktop "win${BITS}_msvc${MSVC_REAL_YEAR}${SUFFIX}"
printf " Cleaning up extraneous data... "
rm -rf Qt/{aqtinstall.log,Tools}
echo Done.
fi fi
cd $QT_SDK # check version
add_cmake_opts -DQT_QMAKE_EXECUTABLE="${QT_SDK}/bin/qmake.exe" \ aqt-venv/${VENV_BIN_DIR}/pip list | grep 'aqtinstall\s*1.1.3' || [ $? -ne 0 ]
-DCMAKE_PREFIX_PATH="$QT_SDK" if [ $? -eq 0 ]; then
for CONFIGURATION in ${CONFIGURATIONS[@]}; do echo " Installing aqt wheel into virtualenv..."
if [ $CONFIGURATION == "Debug" ]; then run_cmd "aqt-venv/${VENV_BIN_DIR}/pip" install aqtinstall==1.1.3
DLLSUFFIX="d" fi
else popd > /dev/null
DLLSUFFIX=""
fi rm -rf Qt
add_runtime_dlls $CONFIGURATION "$(pwd)/bin/Qt5"{Core,Gui,Network,OpenGL,Widgets}${DLLSUFFIX}.dll
add_qt_platform_dlls $CONFIGURATION "$(pwd)/plugins/platforms/qwindows${DLLSUFFIX}.dll" mkdir Qt
add_qt_style_dlls $CONFIGURATION "$(pwd)/plugins/styles/qwindowsvistastyle${DLLSUFFIX}.dll" cd Qt
done
echo Done. run_cmd "${DEPS}/aqt-venv/${VENV_BIN_DIR}/aqt" install $qt_version windows desktop "win${BITS}_msvc${MSVC_REAL_YEAR}${SUFFIX}"
else
# default to msvc2019 which pre-loads Qt 5.15.2 printf " Cleaning up extraneous data... "
qt_version="5.15.2" rm -rf Qt/{aqtinstall.log,Tools}
if [ "msvc${MSVC_REAL_YEAR}" == "msvc2017" ]; then
qt_version="5.13"
fi
QT_SDK="C:/Qt/${qt_version}/msvc${MSVC_REAL_YEAR}${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. echo Done.
fi fi
cd $QT_SDK
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
add_runtime_dlls $CONFIGURATION "$(pwd)/bin/Qt5"{Core,Gui,Network,OpenGL,Widgets}${DLLSUFFIX}.dll
add_qt_platform_dlls $CONFIGURATION "$(pwd)/plugins/platforms/qwindows${DLLSUFFIX}.dll"
add_qt_style_dlls $CONFIGURATION "$(pwd)/plugins/styles/qwindowsvistastyle${DLLSUFFIX}.dll"
done
echo Done.
} }
cd $DEPS cd $DEPS
echo echo

View file

@ -715,6 +715,10 @@ if (WIN32)
set(WARNINGS "${WARNINGS} /wd${d}") set(WARNINGS "${WARNINGS} /wd${d}")
endforeach(d) endforeach(d)
if(OPENMW_MSVC_WERROR)
set(WARNINGS "${WARNINGS} /WX")
endif()
set_target_properties(components PROPERTIES COMPILE_FLAGS "${WARNINGS}") set_target_properties(components PROPERTIES COMPILE_FLAGS "${WARNINGS}")
set_target_properties(osg-ffmpeg-videoplayer PROPERTIES COMPILE_FLAGS "${WARNINGS}") set_target_properties(osg-ffmpeg-videoplayer PROPERTIES COMPILE_FLAGS "${WARNINGS}")
@ -767,7 +771,8 @@ if (WIN32)
endif() endif()
if (BUILD_BULLETOBJECTTOOL) if (BUILD_BULLETOBJECTTOOL)
set_target_properties(openmw-bulletobjecttool PROPERTIES COMPILE_FLAGS "${WARNINGS} ${MT_BUILD}") set(WARNINGS "${WARNINGS} ${MT_BUILD}")
set_target_properties(openmw-bulletobjecttool PROPERTIES COMPILE_FLAGS "${WARNINGS}")
endif() endif()
endif(MSVC) endif(MSVC)

View file

@ -225,6 +225,14 @@ namespace NifOsg
std::vector<FloatInterpolator> mKeyFrames; std::vector<FloatInterpolator> mKeyFrames;
}; };
#ifdef _MSC_VER
#pragma warning( push )
/*
* Warning C4250: 'NifOsg::KeyframeController': inherits 'osg::Callback::osg::Callback::asCallback' via dominance,
* there is no way to solved this if an object must inherit from both osg::Object and osg::Callback
*/
#pragma warning( disable : 4250 )
#endif
class KeyframeController : public SceneUtil::KeyframeController, public SceneUtil::NodeCallback<KeyframeController, NifOsg::MatrixTransform*> class KeyframeController : public SceneUtil::KeyframeController, public SceneUtil::NodeCallback<KeyframeController, NifOsg::MatrixTransform*>
{ {
public: public:
@ -253,6 +261,9 @@ namespace NifOsg
osg::Quat getXYZRotation(float time) const; osg::Quat getXYZRotation(float time) const;
}; };
#ifdef _MSC_VER
#pragma warning( pop )
#endif
class UVController : public SceneUtil::StateSetUpdater, public SceneUtil::Controller class UVController : public SceneUtil::StateSetUpdater, public SceneUtil::Controller
{ {

View file

@ -35,6 +35,14 @@ namespace SceneUtil
Resource::Animation* mAnimation; Resource::Animation* mAnimation;
}; };
#ifdef _MSC_VER
#pragma warning( push )
/*
* Warning C4250: 'SceneUtil::OsgAnimationController': inherits 'osg::Callback::osg::Callback::asCallback' via dominance,
* there is no way to solved this if an object must inherit from both osg::Object and osg::Callback
*/
#pragma warning( disable : 4250 )
#endif
class OsgAnimationController : public SceneUtil::KeyframeController, public SceneUtil::NodeCallback<OsgAnimationController> class OsgAnimationController : public SceneUtil::KeyframeController, public SceneUtil::NodeCallback<OsgAnimationController>
{ {
public: public:
@ -68,6 +76,9 @@ namespace SceneUtil
std::vector<osg::ref_ptr<Resource::Animation>> mMergedAnimationTracks; // Used only by osgAnimation-based formats (e.g. dae) std::vector<osg::ref_ptr<Resource::Animation>> mMergedAnimationTracks; // Used only by osgAnimation-based formats (e.g. dae)
std::vector<EmulatedAnimation> mEmulatedAnimations; std::vector<EmulatedAnimation> mEmulatedAnimations;
}; };
#ifdef _MSC_VER
#pragma warning( pop )
#endif
} }
#endif #endif