Merge branch 'shooting-at-macs-without-looking' into 'master'

Some MacOS tidying

See merge request OpenMW/openmw!4905
This commit is contained in:
Alexei Kotov 2025-09-14 01:18:50 +03:00
commit fbb726cee0
8 changed files with 108 additions and 41 deletions

View File

@ -82,7 +82,7 @@ jobs:
max-size: 1000M max-size: 1000M
- name: Configure - name: Configure
run: CI/before_script.macos.sh run: CI/before_script.macos.sh -C
- name: Build - name: Build
run: CI/macos/build.sh run: CI/macos/build.sh

View File

@ -555,11 +555,12 @@ Ubuntu_GCC_integration_tests_asan:
- ccache/ - ccache/
script: script:
- CI/before_install.macos.sh - CI/before_install.macos.sh
- brew install ccache
- export CCACHE_BASEDIR="$(pwd)" - export CCACHE_BASEDIR="$(pwd)"
- export CCACHE_DIR="$(pwd)/ccache" - export CCACHE_DIR="$(pwd)/ccache"
- mkdir -pv "${CCACHE_DIR}" - mkdir -pv "${CCACHE_DIR}"
- CI/macos/ccache_prep.sh - ccache -z -M "${CCACHE_SIZE}"
- CI/before_script.macos.sh - CI/before_script.macos.sh -C
- CI/macos/build.sh - CI/macos/build.sh
- cd build - cd build
- for dmg in *.dmg; do mv "$dmg" "${dmg%.dmg}_${DMG_IDENTIFIER}_${CI_COMMIT_REF_NAME##*/}.dmg"; done - for dmg in *.dmg; do mv "$dmg" "${dmg%.dmg}_${DMG_IDENTIFIER}_${CI_COMMIT_REF_NAME##*/}.dmg"; done
@ -578,7 +579,7 @@ Ubuntu_GCC_integration_tests_asan:
s3cmd put "${dmg}" s3://openmw-artifacts/${artifactDirectory} s3cmd put "${dmg}" s3://openmw-artifacts/${artifactDirectory}
done done
fi fi
- ../CI/macos/ccache_show_stats.sh - ccache -svv
artifacts: artifacts:
paths: paths:
- build/OpenMW-*.dmg - build/OpenMW-*.dmg

View File

@ -1,7 +1,12 @@
#!/bin/sh -ex #!/bin/sh -ex
brew tap --repair
brew update --quiet
if [[ "${MACOS_AMD64}" ]]; then if [[ "${MACOS_AMD64}" ]]; then
./CI/macos/before_install.amd64.sh ./CI/macos/before_install.amd64.sh
else else
./CI/macos/before_install.arm64.sh ./CI/macos/before_install.arm64.sh
fi fi
command -v cmake >/dev/null 2>&1 || brew install cmake

View File

@ -1,28 +1,91 @@
#!/bin/sh -e #!/bin/bash -e
# Silence a git warning VERBOSE=""
git config --global advice.detachedHead false USE_CCACHE=""
KEEP=""
USE_WERROR=""
rm -fr build while [ $# -gt 0 ]; do
mkdir build 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
fi
mkdir -p build
cd build cd build
DEPENDENCIES_ROOT="/tmp/openmw-deps" DEPENDENCIES_ROOT="/tmp/openmw-deps"
if [[ "${MACOS_AMD64}" ]]; then if [[ "${MACOS_AMD64}" ]]; then
QT_PATH=$(arch -x86_64 /usr/local/bin/brew --prefix qt@6) QT_PATH=$(arch -x86_64 /bin/bash -c "qmake -v | sed -rn -e 's/Using Qt version [.0-9]+ in //p'")
ICU_PATH=$(arch -x86_64 /usr/local/bin/brew --prefix icu4c) ICU_PATH=$(arch -x86_64 /usr/local/bin/brew --prefix icu4c)
OPENAL_PATH=$(arch -x86_64 /usr/local/bin/brew --prefix openal-soft) OPENAL_PATH=$(arch -x86_64 /usr/local/bin/brew --prefix openal-soft)
else else
QT_PATH=$(brew --prefix qt@6) QT_PATH=$(qmake -v | sed -rn -e "s/Using Qt version [.0-9]+ in //p")
ICU_PATH=$(brew --prefix icu4c) ICU_PATH=$(brew --prefix icu4c)
OPENAL_PATH=$(brew --prefix openal-soft) OPENAL_PATH=$(brew --prefix openal-soft)
fi 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=( declare -a CMAKE_CONF_OPTS=(
-D CMAKE_PREFIX_PATH="$DEPENDENCIES_ROOT;$QT_PATH;$OPENAL_PATH" -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_CXX_FLAGS="-stdlib=libc++"
-D CMAKE_C_COMPILER="clang" -D CMAKE_C_COMPILER="clang"
-D CMAKE_CXX_COMPILER="clang++" -D CMAKE_CXX_COMPILER="clang++"
@ -62,14 +125,27 @@ else
) )
fi fi
if [[ "${MACOS_AMD64}" ]]; then if [[ -n $USE_CCACHE ]]; then
arch -x86_64 cmake \ CMAKE_CONF_OPTS+=(
"${CMAKE_CONF_OPTS[@]}" \ -D CMAKE_C_COMPILER_LAUNCHER="ccache"
"${BUILD_OPTS[@]}" \ -D CMAKE_CXX_COMPILER_LAUNCHER="ccache"
.. )
else fi
cmake \
if [[ -n $USE_WERROR ]]; then
CMAKE_CONF_OPTS+=(
-D OPENMW_CXX_FLAGS="-Werror"
)
fi
if [[ -n $VERBOSE ]]; then
echo CMake arguments: \
"${CMAKE_CONF_OPTS[@]}" \ "${CMAKE_CONF_OPTS[@]}" \
"${BUILD_OPTS[@]}" \ "${BUILD_OPTS[@]}" \
.. ..
fi fi
cmake \
"${CMAKE_CONF_OPTS[@]}" \
"${BUILD_OPTS[@]}" \
..

View File

@ -1,8 +1,10 @@
#!/bin/sh -ex #!/bin/sh -ex
arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" command -v /usr/local/bin/brew || arch -x86_64 bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
arch -x86_64 /usr/local/bin/brew install curl xquartz gd fontconfig freetype harfbuzz brotli ccache cmake qt@6 openal-soft icu4c yaml-cpp sqlite arch -x86_64 bash -c "command -v qmake >/dev/null 2>&1 && qmake -v | grep -F 'Using Qt version 6.' >/dev/null || /usr/local/bin/brew install qt@6"
arch -x86_64 /usr/local/bin/brew install curl xquartz gd fontconfig freetype harfbuzz brotli openal-soft icu4c yaml-cpp sqlite
curl -fSL -R -J https://gitlab.com/OpenMW/openmw-deps/-/raw/main/macos/openmw-deps-20240802.zip -o ~/openmw-deps.zip curl -fSL -R -J https://gitlab.com/OpenMW/openmw-deps/-/raw/main/macos/openmw-deps-20240802.zip -o ~/openmw-deps.zip
unzip -o ~/openmw-deps.zip -d /tmp > /dev/null unzip -o ~/openmw-deps.zip -d /tmp > /dev/null

View File

@ -1,11 +1,8 @@
#!/bin/sh -ex #!/bin/sh -ex
brew tap --repair command -v qmake >/dev/null 2>&1 && qmake -v | grep -F "Using Qt version 6." >/dev/null || brew install qt@6
brew update --quiet
command -v cmake >/dev/null 2>&1 || brew install cmake brew install curl xquartz gd fontconfig freetype harfbuzz brotli openal-soft icu4c yaml-cpp sqlite
brew install curl xquartz gd fontconfig freetype harfbuzz brotli qt@6 ccache openal-soft icu4c yaml-cpp sqlite
curl -fSL -R -J https://gitlab.com/OpenMW/openmw-deps/-/raw/main/macos/openmw-deps-20240818-arm64.tar.xz -o ~/openmw-deps.tar.xz curl -fSL -R -J https://gitlab.com/OpenMW/openmw-deps/-/raw/main/macos/openmw-deps-20240818-arm64.tar.xz -o ~/openmw-deps.tar.xz
tar xf ~/openmw-deps.tar.xz -C /tmp > /dev/null tar xf ~/openmw-deps.tar.xz -C /tmp > /dev/null

View File

@ -1,7 +0,0 @@
#!/bin/sh -ex
if [[ "${MACOS_AMD64}" ]]; then
arch -x86_64 ccache -z -M "${CCACHE_SIZE}"
else
ccache -z -M "${CCACHE_SIZE}"
fi

View File

@ -1,7 +0,0 @@
#!/bin/sh -ex
if [[ "${MACOS_AMD64}" ]]; then
arch -x86_64 ccache -svv
else
ccache -svv
fi