Add some options from the Windows script to the MacOS script

Hopefully, they might even work, too.

Also move ccache installation to the CI script as it's not mandatory to use ccache for local builds.
This commit is contained in:
AnyOldName3 2025-09-06 01:29:44 +01:00
parent 98bb4af0cb
commit 998c738ed0
3 changed files with 92 additions and 6 deletions

View File

@ -555,11 +555,12 @@ Ubuntu_GCC_integration_tests_asan:
- ccache/
script:
- CI/before_install.macos.sh
- brew install ccache
- export CCACHE_BASEDIR="$(pwd)"
- export CCACHE_DIR="$(pwd)/ccache"
- mkdir -pv "${CCACHE_DIR}"
- ccache -z -M "${CCACHE_SIZE}"
- CI/before_script.macos.sh
- CI/before_script.macos.sh -C
- CI/macos/build.sh
- cd build
- for dmg in *.dmg; do mv "$dmg" "${dmg%.dmg}_${DMG_IDENTIFIER}_${CI_COMMIT_REF_NAME##*/}.dmg"; done

View File

@ -6,5 +6,4 @@ else
./CI/macos/before_install.arm64.sh
fi
command -v ccache >/dev/null 2>&1 || brew install ccache
command -v cmake >/dev/null 2>&1 || brew install cmake

View File

@ -1,7 +1,69 @@
#!/bin/bash -e
VERBOSE=""
USE_CCACHE=""
KEEP=""
USE_WERROR=""
while [ $# -gt 0 ]; do
ARGSTR=$1
shift
if [ ${ARGSTR:0:1} != "-" ]; then
echo "Unknown argument $ARGSTR"
echo "Try '$0 -h'"
wrappedExit 1
fi
for (( i=1; i<${#ARGSTR}; i++ )); do
ARG=${ARGSTR:$i:1}
case $ARG in
V )
VERBOSE=true ;;
C )
USE_CCACHE=true ;;
k )
KEEP=true ;;
E )
USE_WERROR=true ;;
h )
cat <<EOF
Usage: $0 [-VCkETh]
Options:
-C
Use ccache.
-h
Show this message.
-k
Keep the old build directory, default is to delete it.
-V
Run verbosely
-E
Use warnings as errors (-Werror)
EOF
exit 0
;;
* )
echo "Unknown argument $ARG."
echo "Try '$0 -h'"
exit 1 ;;
esac
done
done
if [[ -z $KEEP ]]; then
if [[ -n $VERBOSE && -d "build" ]]; then
echo "Deleting existing build directory"
fi
rm -fr build
mkdir build
fi
mkdir -p build
cd build
DEPENDENCIES_ROOT="/tmp/openmw-deps"
@ -16,10 +78,14 @@ else
OPENAL_PATH=$(brew --prefix openal-soft)
fi
if [[ -n $VERBOSE ]]; then
echo "Using Qt path: ${QT_PATH}"
echo "Using ICU path: ${ICU_PATH}"
echo "Using OpenAL path: ${OPENAL_PATH}"
fi
declare -a CMAKE_CONF_OPTS=(
-D CMAKE_PREFIX_PATH="$DEPENDENCIES_ROOT;$QT_PATH;$OPENAL_PATH"
-D CMAKE_C_COMPILER_LAUNCHER="ccache"
-D CMAKE_CXX_COMPILER_LAUNCHER="ccache"
-D CMAKE_CXX_FLAGS="-stdlib=libc++"
-D CMAKE_C_COMPILER="clang"
-D CMAKE_CXX_COMPILER="clang++"
@ -59,6 +125,26 @@ else
)
fi
if [[ -n $USE_CCACHE ]]; then
CMAKE_CONF_OPTS+=(
-D CMAKE_C_COMPILER_LAUNCHER="ccache"
-D CMAKE_CXX_COMPILER_LAUNCHER="ccache"
)
fi
if [[ -n $USE_WERROR ]]; then
CMAKE_CONF_OPTS+=(
-D OPENMW_CXX_FLAGS="-Werror"
)
fi
if [[ -n $VERBOSE ]]; then
echo CMake arguments: \
"${CMAKE_CONF_OPTS[@]}" \
"${BUILD_OPTS[@]}" \
..
fi
cmake \
"${CMAKE_CONF_OPTS[@]}" \
"${BUILD_OPTS[@]}" \