Merge pull request #5788 from konero/webm-opt #201
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: MacOS Build | |
on: [push, pull_request] | |
jobs: | |
macOS: | |
timeout-minutes: 90 | |
# runs-on: macos-latest | |
# avoid the headache of arm64 builds? | |
runs-on: macos-13 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Remove symlinks | |
run: | | |
# Remove existing symlinks before installing Python | |
for symlink in 2to3 idle3 pydoc3 python3 python3-config \ | |
2to3-3.11 idle3.11 pydoc3.11 python3.11 python3.11-config \ | |
2to3-3.12 idle3.12 pydoc3.12 python3.12 python3.12-config \ | |
idle3.13 pydoc3.13 python3.13 python3.13-config; do | |
rm -f /usr/local/bin/$symlink | |
done | |
- name: Install libraries | |
run: | | |
checkPkgAndInstall() { | |
for pkg in "$@"; do | |
if brew ls --versions $pkg; then | |
brew upgrade $pkg | |
else | |
brew install $pkg | |
fi | |
done | |
} | |
brew update | |
brew cleanup | |
checkPkgAndInstall pkg-config glew lz4 libjpeg libpng lzo boost libusb libmypaint ccache jpeg-turbo ninja opencv qt@5 | |
brew unlink qt | |
- name: Set up cache | |
run: | | |
export PATH="/usr/local/opt/ccache/libexec:$PATH" | |
mkdir -p /Users/runner/.ccache | |
- uses: actions/cache@v4 | |
with: | |
path: /Users/runner/.ccache | |
key: ${{ runner.os }}-${{ github.sha }} | |
restore-keys: ${{ runner.os }}- | |
- name: Build libtiff | |
run: | | |
cd thirdparty/tiff-4.0.3 | |
CFLAGS='-fPIC' CXXFLAGS='-fPIC' ./configure --disable-lzma | |
make -j $(sysctl -n hw.ncpu) | |
- name: Build | |
run: | | |
export PKG_CONFIG_PATH="/usr/local/opt/jpeg-turbo/lib/pkgconfig:$PKG_CONFIG_PATH" | |
cd toonz | |
mkdir -p build | |
cd build | |
cmake ../sources -G Ninja \ | |
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ | |
-DQT_PATH=$(brew --prefix qt@5)/lib \ | |
-DQt5_DIR=$(brew --prefix qt@5)/lib/cmake/Qt5 \ | |
-DCMAKE_PREFIX_PATH=$(brew --prefix qt@5)/lib/cmake/Qt5 \ | |
-DWITH_TRANSLATION=OFF | |
ninja -j $(sysctl -n hw.ncpu) | |
- name: Introduce Libraries and Stuff | |
run: | | |
cd toonz/build/toonz | |
cp -pr ../../../stuff OpenToonz.app/portablestuff | |
/usr/local/opt/qt@5/bin/macdeployqt OpenToonz.app -verbose=0 -always-overwrite \ | |
-executable=OpenToonz.app/Contents/MacOS/lzocompress \ | |
-executable=OpenToonz.app/Contents/MacOS/lzodecompress \ | |
-executable=OpenToonz.app/Contents/MacOS/tcleanup \ | |
-executable=OpenToonz.app/Contents/MacOS/tcomposer \ | |
-executable=OpenToonz.app/Contents/MacOS/tconverter \ | |
-executable=OpenToonz.app/Contents/MacOS/tfarmcontroller \ | |
-executable=OpenToonz.app/Contents/MacOS/tfarmserver | |
- name: Modify Library Paths | |
run: | | |
cd toonz/build/toonz/OpenToonz.app/Contents/Frameworks | |
for TARGETLIB in *.dylib; do | |
otool -L "$TARGETLIB" | grep ".dylib" | grep -v "$TARGETLIB" | grep -v "@executable_path/../Frameworks" | awk '{print $1}' | while read -r FROMPATH; do | |
LIBNAME=$(basename "$FROMPATH") | |
if [[ -e ./$LIBNAME ]]; then | |
install_name_tool -change "$FROMPATH" "@executable_path/../Frameworks/$LIBNAME" "$TARGETLIB" | |
fi | |
done | |
done | |
- name: Create Artifact | |
run: | | |
cd toonz/build/toonz | |
echo "Creating DMG..." | |
for ATTEMPT in {1..10}; do | |
echo "Attempt $ATTEMPT to build DMG..." | |
/usr/local/opt/qt@5/bin/macdeployqt OpenToonz.app -dmg -verbose=0 | |
if [ -f OpenToonz.dmg ]; then | |
echo "DMG created successfully." | |
exit 0 # Exit if successful | |
fi | |
echo "DMG creation failed. Retrying in 10 seconds..." | |
sleep 10 | |
done | |
echo ">>> DMG file creation failed after 10 attempts. Aborting!" | |
exit 1 # Exit with failure status | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: Opentoonz-${{ runner.os }}-${{ github.sha }} | |
path: toonz/build/toonz/OpenToonz.dmg |