Skip to content

Commit

Permalink
Add macOS vcpkg and cleanup CI
Browse files Browse the repository at this point in the history
  • Loading branch information
twistedfall committed Apr 16, 2024
1 parent 63a0ba9 commit 36649b7
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 24 deletions.
1 change: 1 addition & 0 deletions .github/workflows/opencv-rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ jobs:
os-image:
- ubuntu-22.04
- windows-2022
- macos-14
vcpkg-version:
- 2024.03.25
runs-on: ${{ matrix.os-image }}
Expand Down
20 changes: 0 additions & 20 deletions ci/install-macos-brew.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,6 @@ set -xeu

brew list --versions
brew -v update

# fixes the install on 2023-12-10
rm -f /usr/local/bin/2to3-3.11
rm -f /usr/local/bin/idle3.11
rm -f /usr/local/bin/pydoc3.11
rm -f /usr/local/bin/python3.11
rm -f /usr/local/bin/python3.11-config
rm -f /usr/local/bin/2to3-3.12
rm -f /usr/local/bin/idle3.12
rm -f /usr/local/bin/pydoc3.12
rm -f /usr/local/bin/python3.12
rm -f /usr/local/bin/python3.12-config
rm -f /usr/local/bin/2to3
rm -f /usr/local/bin/idle3
rm -f /usr/local/bin/pydoc3
rm -f /usr/local/bin/python3
rm -f /usr/local/bin/python3-config

brew uninstall --force node@18

brew upgrade --force --display-times
brew list --versions
brew -v install --force --display-times opencv"$BREW_OPENCV_VERSION"
Expand Down
44 changes: 44 additions & 0 deletions ci/install-macos-vcpkg.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/bash

set -xeu

if [[ "${VCPKG_VERSION:-}" == "" ]]; then
echo "Must set VCPKG_VERSION environment var"
exit 1
fi

export VCPKG_ROOT="$HOME/build/vcpkg"
if [[ -e "$VCPKG_ROOT" && ! -e "$VCPKG_ROOT/.git" ]]; then
rm -rf "$VCPKG_ROOT"
fi
if [ ! -e "$VCPKG_ROOT" ]; then
git clone https://github.com/Microsoft/vcpkg.git "$VCPKG_ROOT"
fi
pushd "$VCPKG_ROOT"
git fetch --all --prune --tags
git status
git checkout .
git checkout "$VCPKG_VERSION"
./bootstrap-vcpkg.sh -disableMetrics
#./vcpkg integrate install
echo "set(VCPKG_BUILD_TYPE release)" >> triplets/arm64-osx.cmake
echo "set(VCPKG_BUILD_TYPE release)" >> triplets/x64-osx.cmake
export VCPKG_DEFAULT_TRIPLET=arm64-osx
(
set +e
cmake --version
# 2024-04-15, cmake 3.29.1 doesn't work so well with vcpkg, remove this hack when cmake is 3.29.2+
# https://github.com/microsoft/vcpkg/issues/37968
# mv -vf /usr/local/bin/cmake /usr/local/bin/cmake.bad
if ! ./vcpkg install --clean-after-build --recurse "opencv[contrib,nonfree]"; then
for log in "$VCPKG_ROOT/buildtrees"/**/*out.log; do
echo "=== $log"
cat "$log"
done
exit 1
fi
# mv -vf /usr/local/bin/cmake.bad /usr/local/bin/cmake
)
# remove build artifacts to save CI cache space
rm -rf "$VCPKG_ROOT/downloads" "$VCPKG_ROOT/buildtrees" "$VCPKG_ROOT/packages"
popd
6 changes: 3 additions & 3 deletions ci/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ ci_dir="$(dirname "$0")"

if [[ "$OS_FAMILY" == "Linux" ]]; then
# free up disk space in Github Actions image: https://github.com/actions/runner-images/issues/2840
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf /usr/share/dotnet /opt/ghc /usr/local/share/boost
if [[ "${VCPKG_VERSION:-}" != "" ]]; then # vcpkg build
"$ci_dir/install-ubuntu-vcpkg.sh"
else
Expand All @@ -17,6 +15,8 @@ if [[ "$OS_FAMILY" == "Linux" ]]; then
elif [[ "$OS_FAMILY" == "macOS" ]]; then
if [[ "${BREW_OPENCV_VERSION:-}" != "" ]]; then # brew build
"$ci_dir/install-macos-brew.sh"
elif [[ "${VCPKG_VERSION:-}" != "" ]]; then # vcpkg build
"$ci_dir/install-macos-vcpkg.sh"
else
"$ci_dir/install-macos-framework.sh"
fi
Expand Down
1 change: 1 addition & 0 deletions ci/msrv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ rustc --version
rustc --print=cfg

cargo update
rm -vf examples/cuda.rs # no CUDA support in CI
cargo check -vv --all-targets --all-features --workspace --tests
2 changes: 1 addition & 1 deletion ci/script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ elif [[ "$OS_FAMILY" == "Linux" ]]; then
"$VCPKG_ROOT/vcpkg" list
else
if [[ "${OPENCV_LINKAGE:-dynamic}" == "static" ]]; then # static build
export OPENCV_LINK_LIBS=opencv_highgui,opencv_objdetect,opencv_dnn,opencv_videostab,opencv_calib3d,opencv_features2d,opencv_stitching,opencv_flann,opencv_videoio,opencv_rgbd,opencv_aruco,opencv_video,opencv_ml,opencv_imgcodecs,opencv_imgproc,opencv_core,ittnotify,tbb,liblibwebp,liblibtiff,liblibjpeg-turbo,liblibpng,liblibopenjp2,ippiw,ippicv,liblibprotobuf,quirc,zlib
export OPENCV_LINK_LIBS=opencv_gapi,opencv_highgui,opencv_objdetect,opencv_dnn,opencv_videostab,opencv_calib3d,opencv_features2d,opencv_stitching,opencv_flann,opencv_videoio,opencv_rgbd,opencv_aruco,opencv_video,opencv_ml,opencv_imgcodecs,opencv_imgproc,opencv_core,ittnotify,tbb,liblibwebp,liblibtiff,liblibjpeg-turbo,liblibpng,liblibopenjp2,ippiw,ippicv,liblibprotobuf,quirc,zlib
fi
fi
fi
Expand Down

0 comments on commit 36649b7

Please sign in to comment.