Skip to content

Commit

Permalink
修复macOS 构建速度太慢 (#227)
Browse files Browse the repository at this point in the history
* workflow: Change to macOS 12

* Show webp and boost version

* Disable libpsl

* Update webp to 1.3.2; boost to 1.83.0

* Add version check when merging dylibs
  • Loading branch information
xfangfang authored Nov 8, 2023
1 parent 3b92f23 commit 1b18a89
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 7 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ jobs:

build-macos:
needs: [ version ]
runs-on: macos-11
runs-on: macos-12
strategy:
matrix:
arch: [ IntelChip, AppleSilicon, Universal ]
Expand All @@ -311,7 +311,8 @@ jobs:
- name: install deps
if: matrix.arch != 'Universal' || ( matrix.arch == 'Universal' && github.event.inputs.universal_macos == 'true')
run: |
brew install create-dmg dylibbundler webp boost
brew install create-dmg dylibbundler boost
brew list webp boost
brew tap xfangfang/wiliwili
brew install -v mpv-wiliwili
Expand All @@ -333,7 +334,7 @@ jobs:
if: matrix.arch != 'Universal' || ( matrix.arch == 'Universal' && github.event.inputs.universal_macos == 'true')
id: compile
run: |
cmake -B build -DPLATFORM_DESKTOP=ON -DCMAKE_BUILD_TYPE=Release -DMAC_${{ matrix.arch }}=ON -DMAC_DOWNLOAD_DYLIB=ON
cmake -B build -DPLATFORM_DESKTOP=ON -DCMAKE_BUILD_TYPE=Release -DMAC_${{ matrix.arch }}=ON -DMAC_DOWNLOAD_DYLIB=ON -DCURL_USE_LIBPSL=OFF
make -C build wiliwili.app -j$(sysctl -n hw.ncpu)
- name: Name
Expand Down
2 changes: 1 addition & 1 deletion cmake/macos.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ if (APPLE)
if (MAC_DOWNLOAD_DYLIB)
set(APP_PLATFORM_LIB
${CMAKE_BINARY_DIR}/deps/${MAC_OS_ARCH}/libmpv.2.dylib
${CMAKE_BINARY_DIR}/deps/${MAC_OS_ARCH}/libwebp.7.1.7.dylib
${CMAKE_BINARY_DIR}/deps/${MAC_OS_ARCH}/libwebp.7.1.8.dylib
${CMAKE_BINARY_DIR}/deps/${MAC_OS_ARCH}/libboost_filesystem-mt.dylib)
if (NOT USE_SYSTEM_CURL)
list(APPEND APP_PLATFORM_LIB
Expand Down
2 changes: 1 addition & 1 deletion scripts/macos_dylib_downloader.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ set -e
mkdir -p deps

BASEURL="https://github.com/xfangfang/wiliwili/releases/download/v0.1.0"
PACKAGE="macos_dylib_ffmpeg6_mpv36_$1.tar.gz"
PACKAGE="macos_dylib_ffmpeg6_mpv36_r2_$1.tar.gz"
DOWNLOAD_FLAG="${PACKAGE}.done"

if [ ! -f "${DOWNLOAD_FLAG}" ];then
Expand Down
18 changes: 16 additions & 2 deletions scripts/macos_dylib_merge.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env bash
set -e

files=(libass.9.dylib
Expand Down Expand Up @@ -33,9 +34,22 @@ files=(libass.9.dylib
libtasn1.6.dylib
libunibreak.5.dylib
libunistring.5.dylib
libwebp.7.1.7.dylib)
libwebp.7.1.8.dylib)

i=1
for file in "${files[@]}"; do
echo "$file"
echo $i "$file"
arm64_ret=$(otool -l ./arm64/"$file" | { grep minos || true;} | { grep 11.0 || true;})
x86_ret=$(otool -l ./x86_64/"$file" | { grep 10.11 || true;})

if [ -z "$arm64_ret" ]; then
echo -e "\t\033[31m arm64 不满足 11.0 \033[0m"
fi

if [ -z "$x86_ret" ]; then
echo -e "\t\033[31m x86_64 不满足 10.11 \033[0m"
fi

lipo -create -output ./universal/"$file" ./x86_64/"$file" ./arm64/"$file"
((i++))
done

0 comments on commit 1b18a89

Please sign in to comment.