openmw/CI/before_script.linux.sh
Bret Curtis 2a98519451 initial conversion to cxxopts for mwiniimporter
clang-format

clang-format again

add cxxopts to cmake and 3 oses

use version and not tag for cxxopts

add the include dir for windows maybe

add the include dir for windows maybe: part 2

give _DIR a try and point to cmake dir

try prefix path

add FindCXXOPTS.cmake

slim down findcxxopts

remove boost stuff from mwiiniimporter cmake; set include path in windows

one too many S

add support for fetching

formatting

validated that we need  MaybeQuotedPath

naive attempt to use vcpkg

remove findCXXOPTS.cmake

naive attempt to use vcpkg

more cleanup; make use of cxxopts::cxxopts

remove offending bad line

try to integration the cxxopts install via vcpkg

add vcpkg.cmake toolchain file

use the right path?

go the fetch route for windows

fetch cxxopts workaround

make use of CONFIG and also put in TODO

add code coverage

fix clang-format

fix clang-format again

add some tooling for tests

const params and use order of operations

allow to be run from anywhere

appease the jvoisin

u8 all the things

make sure we can run on all systems; but require that it run in the same directory as the binary we wish to test

give CLI11 a try

get things building on windows too

give this a try...

clean-format fix1

clean-format fix2

clang-format fix3

do not check if file already exists; overwrite existing

try to abstract out _wsystem and std::system

appease the clang-format gods

purge cli11

bring back tests
2024-02-05 14:27:46 +01:00

131 lines
3.4 KiB
Bash
Executable file

#!/bin/bash
set -xeo pipefail
free -m
# Silence a git warning
git config --global advice.detachedHead false
BUILD_UNITTESTS=OFF
BUILD_BENCHMARKS=OFF
if [[ "${BUILD_TESTS_ONLY}" ]]; then
BUILD_UNITTESTS=ON
BUILD_BENCHMARKS=ON
fi
# setup our basic cmake build options
declare -a CMAKE_CONF_OPTS=(
-DCMAKE_C_COMPILER="${CC:-/usr/bin/cc}"
-DCMAKE_CXX_COMPILER="${CXX:-/usr/bin/c++}"
-DCMAKE_C_COMPILER_LAUNCHER=ccache
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
-DCMAKE_INSTALL_PREFIX=install
-DBUILD_SHARED_LIBS=OFF
-DUSE_SYSTEM_TINYXML=ON
-DOPENMW_USE_SYSTEM_RECASTNAVIGATION=ON
-DOPENMW_CXX_FLAGS="-Werror -Werror=implicit-fallthrough" # flags specific to OpenMW project
)
if [[ "${CMAKE_EXE_LINKER_FLAGS}" ]]; then
CMAKE_CONF_OPTS+=(
-DCMAKE_EXE_LINKER_FLAGS="${CMAKE_EXE_LINKER_FLAGS}"
)
fi
if [[ $CI_OPENMW_USE_STATIC_DEPS ]]; then
CMAKE_CONF_OPTS+=(
-DOPENMW_USE_SYSTEM_MYGUI=OFF
-DOPENMW_USE_SYSTEM_OSG=OFF
-DOPENMW_USE_SYSTEM_BULLET=OFF
-DOPENMW_USE_SYSTEM_SQLITE3=OFF
-DOPENMW_USE_SYSTEM_RECASTNAVIGATION=OFF
)
fi
if [[ $CI_CLANG_TIDY ]]; then
CMAKE_CONF_OPTS+=(
-DCMAKE_CXX_CLANG_TIDY="clang-tidy;--warnings-as-errors=*"
-DBUILD_UNITTESTS=ON
-DBUILD_OPENCS_TESTS=ON
-DBUILD_TOOL_TESTS=ON
-DBUILD_BENCHMARKS=ON
)
fi
if [[ "${CMAKE_BUILD_TYPE}" ]]; then
CMAKE_CONF_OPTS+=(
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
)
else
CMAKE_CONF_OPTS+=(
-DCMAKE_BUILD_TYPE=RelWithDebInfo
)
fi
if [[ "${CMAKE_CXX_FLAGS_DEBUG}" ]]; then
CMAKE_CONF_OPTS+=(
-DCMAKE_CXX_FLAGS_DEBUG="${CMAKE_CXX_FLAGS_DEBUG}"
)
fi
if [[ "${BUILD_WITH_CODE_COVERAGE}" ]]; then
CMAKE_CONF_OPTS+=(
-DBUILD_WITH_CODE_COVERAGE="${BUILD_WITH_CODE_COVERAGE}"
)
fi
mkdir -p build
cd build
if [[ "${BUILD_TESTS_ONLY}" ]]; then
# flags specific to our test suite
CXX_FLAGS="-Wno-error=deprecated-declarations -Wno-error=nonnull -Wno-error=deprecated-copy"
if [[ "${CXX}" == 'clang++' ]]; then
CXX_FLAGS="${CXX_FLAGS} -Wno-error=unused-lambda-capture -Wno-error=gnu-zero-variadic-macro-arguments"
fi
CMAKE_CONF_OPTS+=(
-DCMAKE_CXX_FLAGS="${CXX_FLAGS}"
)
${ANALYZE} cmake \
"${CMAKE_CONF_OPTS[@]}" \
-DBUILD_OPENMW=OFF \
-DBUILD_BSATOOL=OFF \
-DBUILD_ESMTOOL=OFF \
-DBUILD_LAUNCHER=OFF \
-DBUILD_MWINIIMPORTER=OFF \
-DBUILD_ESSIMPORTER=OFF \
-DBUILD_OPENCS=OFF \
-DBUILD_WIZARD=OFF \
-DBUILD_NAVMESHTOOL=OFF \
-DBUILD_BULLETOBJECTTOOL=OFF \
-DBUILD_NIFTEST=OFF \
-DBUILD_UNITTESTS=${BUILD_UNITTESTS} \
-DBUILD_OPENCS_TESTS=${BUILD_UNITTESTS} \
-DBUILD_TOOL_TESTS=${BUILD_UNITTESTS} \
-DBUILD_BENCHMARKS=${BUILD_BENCHMARKS} \
..
elif [[ "${BUILD_OPENMW_ONLY}" ]]; then
${ANALYZE} cmake \
"${CMAKE_CONF_OPTS[@]}" \
-DBUILD_OPENMW=ON \
-DBUILD_BSATOOL=OFF \
-DBUILD_ESMTOOL=OFF \
-DBUILD_LAUNCHER=OFF \
-DBUILD_MWINIIMPORTER=OFF \
-DBUILD_ESSIMPORTER=OFF \
-DBUILD_OPENCS=OFF \
-DBUILD_WIZARD=OFF \
-DBUILD_NAVMESHTOOL=OFF \
-DBUILD_BULLETOBJECTTOOL=OFF \
-DBUILD_NIFTEST=OFF \
..
else
${ANALYZE} cmake \
"${CMAKE_CONF_OPTS[@]}" \
..
fi