Skip to content

Commit 3bcc741

Browse files
committed
Bump CI
1 parent 0389f5c commit 3bcc741

File tree

6 files changed

+41
-9
lines changed

6 files changed

+41
-9
lines changed

.github/workflows/opencv-rust.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,21 @@ jobs:
1313
matrix:
1414
os-image:
1515
- ubuntu-22.04
16-
- macos-13
16+
- macos-14
1717
opencv-version:
18-
- 3.4.20
1918
- 4.10.0
2019
linkage:
2120
- dynamic
2221
include:
2322
- os-image: ubuntu-22.04
2423
opencv-version: 4.10.0
2524
linkage: static
25+
- os-image: ubuntu-22.04
26+
opencv-version: 3.4.20
27+
linkage: dynamic
28+
- os-image: macos-13
29+
opencv-version: 3.4.20
30+
linkage: dynamic
2631
runs-on: ${{ matrix.os-image }}
2732
env:
2833
Atlas_ROOT_DIR: /usr/include/ # for cmake to find lapacke.h

build/cmake_probe.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@ pub struct LinkLib(pub Linkage, pub String);
1717
impl LinkLib {
1818
#[inline]
1919
pub fn emit_cargo_rustc_link(&self) -> String {
20-
format!("cargo:rustc-link-lib={}{}", self.0.as_cargo_rustc_link_spec(), self.1) // replace with cargo:: syntax when MSRV is 1.77
20+
format!(
21+
"cargo:rustc-link-lib={}{}",
22+
self.0.as_cargo_rustc_link_spec_no_static(),
23+
self.1
24+
) // replace with cargo:: syntax when MSRV is 1.77
2125
}
2226

2327
/// Returns Some(new_file_name) if some parts of the filename were removed, None otherwise

build/library.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,18 @@ pub enum Linkage {
9696

9797
impl Linkage {
9898
pub fn as_cargo_rustc_link_spec(self) -> &'static str {
99-
// fixme: specifying static linkage breaks things in CI
10099
match self {
101100
Self::Default => "",
102-
Self::Dynamic => "", // "dylib=",
103-
Self::Static => "", // "static=",
101+
Self::Dynamic => "dylib=",
102+
Self::Static => "static=",
103+
Self::Framework => "framework=",
104+
}
105+
}
106+
107+
pub fn as_cargo_rustc_link_spec_no_static(self) -> &'static str {
108+
// fixme: specifying static linkage breaks things in CI
109+
match self {
110+
Self::Default | Self::Dynamic | Self::Static => "",
104111
Self::Framework => "framework=",
105112
}
106113
}

ci/install-macos-brew.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ brew upgrade --force --display-times
88
brew list --versions
99
brew -v install --force --display-times opencv"$BREW_OPENCV_VERSION"
1010
brew link opencv"$BREW_OPENCV_VERSION"
11+
rustup-init -y

ci/install-macos-framework.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
set -xeu
44

5+
macos_version="$(sw_vers -productVersion)"
6+
57
dist_dir="$HOME/dist/"
68
base_dir="$HOME/build/opencv/"
79
build_dir="$base_dir/opencv-$OPENCV_VERSION-build/"
@@ -23,7 +25,13 @@ if [ ! -d "$opencv_contrib_src" ]; then
2325
curl -L "https://github.com/opencv/opencv_contrib/archive/$OPENCV_VERSION.tar.gz" | tar -xz -C "$dist_dir"
2426
fi
2527

28+
if [[ "$OPENCV_VERSION" == "3.4.20" ]]; then # old OpenCV doesn't support choosing archs
29+
arch_arg=
30+
else
31+
arch_arg="--macos_archs $(uname -m)"
32+
fi
2633
python "$opencv_src/platforms/osx/build_framework.py" \
2734
--contrib "$opencv_contrib_src" \
2835
--enable_nonfree \
36+
$arch_arg \
2937
"$build_dir"

ci/script.sh

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,17 @@ elif [[ "$os_family" == "macOS" ]]; then
4242
elif [[ "${BREW_OPENCV_VERSION:-}" != "" ]]; then # brew build
4343
true
4444
else # framework build
45+
opencv_build_path="$HOME/build/opencv/opencv-$OPENCV_VERSION-build"
46+
export DYLD_FALLBACK_LIBRARY_PATH="$DYLD_FALLBACK_LIBRARY_PATH:$opencv_build_path/build/build-$(uname -m)-macosx/install/lib/"
4547
clang_dir="$(clang --print-search-dirs | awk -F= '/^libraries: =/ { print $2 }')"
46-
export OPENCV_LINK_PATHS="$HOME/build/opencv/opencv-$OPENCV_VERSION-build,$clang_dir/lib/darwin"
47-
export OPENCV_LINK_LIBS="opencv2.framework,OpenCL.framework,Cocoa.framework,Accelerate.framework,AVFoundation.framework,CoreGraphics.framework,CoreMedia.framework,CoreVideo.framework,QuartzCore.framework,clang_rt.osx"
48-
export OPENCV_INCLUDE_PATHS="$HOME/build/opencv/opencv-$OPENCV_VERSION-build"
48+
if [[ "$OPENCV_VERSION" == "3.4.20" ]]; then
49+
export OPENCV_LINK_PATHS="$opencv_build_path,$clang_dir/lib/darwin"
50+
export OPENCV_LINK_LIBS="opencv2.framework,OpenCL.framework,Cocoa.framework,Accelerate.framework,AVFoundation.framework,CoreGraphics.framework,CoreMedia.framework,CoreVideo.framework,QuartzCore.framework,clang_rt.osx"
51+
else
52+
export OPENCV_LINK_PATHS="$opencv_build_path,$clang_dir/lib/darwin,$opencv_build_path/build/build-$(uname -m)-macosx/install/lib/"
53+
export OPENCV_LINK_LIBS="opencv2.framework,OpenCL.framework,Cocoa.framework,Accelerate.framework,AVFoundation.framework,CoreGraphics.framework,CoreMedia.framework,CoreVideo.framework,QuartzCore.framework,clang_rt.osx,OrbbecSDK"
54+
fi
55+
export OPENCV_INCLUDE_PATHS="$opencv_build_path"
4956
fi
5057
echo "=== Installed brew packages:"
5158
brew list --versions

0 commit comments

Comments
 (0)