Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions .github/workflows/of.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ jobs:
build-msys2:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
msystem:
- mingw64
Expand All @@ -81,15 +82,29 @@ jobs:
with:
# key: ${{ matrix.os }}-${{ matrix.type }}
key: ${{ matrix.msystem }}
# pacman aborts the whole transaction when one mirror stalls
# ("Operation too slow"), so retry the setup once before failing.
- uses: msys2/setup-msys2@v2
id: msys2
continue-on-error: true
with:
cache: true
release: true
update: true
msystem: ${{matrix.msystem}}
# opencv is intentionally left out here and pinned to a 4.x build by
# scripts/msys2/install_dependencies.sh (ofxOpenCv isn't ported to
# OpenCV 5's C++-only API yet, and MSYS2's opencv package is now 5.x)
# no opencv package: ofxOpenCv links the Apothecary-built OpenCV 4
# static libs bundled in addons/ofxOpenCv/libs/opencv
pacboy: openssl:p python:p gcc:p assimp:p cairo:p curl:p freeglut:p freeimage:p glew:p glfw:p glm:p libsndfile:p libusb:p libxml2:p mpg123:p nlohmann-json:p openal:p pugixml:p rtaudio:p uriparser:p utf8cpp:p
install: >-
unzip
make
- uses: msys2/setup-msys2@v2
if: steps.msys2.outcome == 'failure'
with:
cache: false
release: true
update: true
msystem: ${{matrix.msystem}}
pacboy: openssl:p python:p gcc:p assimp:p cairo:p curl:p freeglut:p freeimage:p glew:p glfw:p glm:p libsndfile:p libusb:p libxml2:p mpg123:p nlohmann-json:p openal:p pugixml:p rtaudio:p uriparser:p utf8cpp:p
install: >-
unzip
Expand Down
16 changes: 11 additions & 5 deletions addons/ofxOpenCv/addon_config.mk
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,17 @@ linuxaarch64:
ADDON_LDFLAGS = -lblas -llapack

msys2:
# opencv4 by default; install_dependencies.sh rewrites to opencv5 or opencv if needed
ADDON_PKG_CONFIG_LIBRARIES = opencv4
ADDON_LIBS_EXCLUDE = libs/opencv/%
ADDON_INCLUDES_EXCLUDE = libs/opencv
ADDON_INCLUDES_EXCLUDE += libs/opencv/%
# Apothecary-built OpenCV 4 static libraries; no system opencv required.
# install_dependencies.sh deliberately installs no opencv package.
# % expands to the architecture directory shipped by the package
# (x86_64, aarch64, ...), so this works for every msystem.
ADDON_LIBS =
ADDON_LIBS += libs/opencv/lib/msys2/%/libopencv_world.a
ADDON_LIBS += libs/opencv/lib/msys2/%/liblibprotobuf.a
ADDON_LIBS += libs/opencv/lib/msys2/%/libittnotify.a
ADDON_LIBS += libs/opencv/lib/msys2/%/liblibpng.a
# zlib comes from the msys2 pacman package (libz.a), not the bundle
ADDON_LDFLAGS = -lz

android/x86:
ADDON_LIBS =
Expand Down
43 changes: 6 additions & 37 deletions scripts/msys2/install_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,8 @@ echo "using pacman: $PACMAN"
MSYS_PACKAGES="unzip make"

# List of MINGW packages to be installed (without prefix)
# opencv is pinned separately below (prefer 4.x; ofxOpenCv also compiles against 5)
# NB: no opencv here — ofxOpenCv uses the Apothecary-built static libraries
# bundled under addons/ofxOpenCv/libs/opencv (see below)
MINGW_PACKAGES="assimp cairo curl freeimage \
glew glfw glm fmt zlib brotli libpng \
harfbuzz libsndfile libusb libxml2 mpg123 \
Expand Down Expand Up @@ -205,42 +206,10 @@ if [ $exit_code != 0 ]; then
fi


# Prefer the last 4.x build (smaller / known-good). ofxOpenCv has an OpenCV 5
# compatibility layer, so falling back to current "opencv" (5.x) still compiles.
# MSYS2's unpinned "opencv" package now resolves to 5.x.
OPENCV4_PKG_VERSION="4.13.0-7"
OPENCV_REPO="${msystem:-ucrt64}"
OPENCV4_PKG_FILE="${MINGW_PACKAGE_PREFIX}-opencv-${OPENCV4_PKG_VERSION}-any.pkg.tar.zst"
OPENCV4_PKG_URL="https://repo.msys2.org/mingw/${OPENCV_REPO}/${OPENCV4_PKG_FILE}"
echo "Installing pinned OpenCV 4 from $OPENCV4_PKG_URL"
OPENCV_FLAGS=(-U --needed)
[[ "$FORCE_YES" == "1" ]] && OPENCV_FLAGS+=(--noconfirm)
"$PACMAN" "${OPENCV_FLAGS[@]}" "$OPENCV4_PKG_URL"
exit_code=$?
if [ $exit_code != 0 ]; then
echo "error installing pinned OpenCV 4 from $OPENCV4_PKG_URL"
echo "repo.msys2.org is up; that exact filename may have been removed."
echo "falling back to current ${MINGW_PACKAGE_PREFIX}-opencv from the synced database"
"$PACMAN" "${PACMAN_FLAGS[@]}" "${MINGW_PACKAGE_PREFIX}-opencv" || {
echo "error installing opencv — try: pacman -Syu"
exit 1
}
fi


# Update addon_config.mk files to use OpenCV 5, 4 or 3 depending on what's installed
ADDONS_DIR="$(cd "$SCRIPT_DIR/../../addons" && pwd)"
ADDON_CONFIG="$ADDONS_DIR/ofxOpenCv/addon_config.mk"
if pkg-config opencv5 --exists; then
echo "Updating ofxOpenCV to use openCV5"
sed -i -E 's/(ADDON_PKG_CONFIG_LIBRARIES =.*)\bopencv[45]?\b/\1opencv5/' "$ADDON_CONFIG"
elif pkg-config opencv4 --exists; then
echo "Updating ofxOpenCV to use openCV4"
sed -i -E 's/(ADDON_PKG_CONFIG_LIBRARIES =.*)\bopencv[45]?\b/\1opencv4/' "$ADDON_CONFIG"
else
echo "Updating ofxOpenCV to use openCV3"
sed -i -E 's/(ADDON_PKG_CONFIG_LIBRARIES =.*)\bopencv[45]?\b/\1opencv/' "$ADDON_CONFIG"
fi
# OpenCV is intentionally NOT installed from pacman here.
# ofxOpenCv links the Apothecary-built OpenCV 4 static libraries bundled under
# addons/ofxOpenCv/libs/opencv (see the msys2 section of addon_config.mk),
# so no system opencv (4.x, 5.x, pinned or otherwise) is required.

if [[ "${FROM_MSYS_SHELL:-0}" == "1" ]]; then
echo "done — open MSYS2 UCRT64 to compile"
Expand Down
Loading