diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..c6d96ca9 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,1743 @@ +name: test +on: pull_request +# on: +# push: +# tags: +# - '*' + +env: + DEVELOPER_DIR: /Applications/Xcode_15.2.app/Contents/Developer + IOS_DEPLOYMENT_TARGET: '13.0' + MAC_DEPLOYMENT_TARGET: '11.0' + MAC_CATALYST_DEPLOYMENT_TARGET: '13.1' + WATCHOS_DEPLOYMENT_TARGET: '6.0' + TVOS_DEPLOYMENT_TARGET: '11.0' + VISIONOS_DEPLOYMENT_TARGET: '1.0' + ENABLE_BITCODE: OFF + ENABLE_ARC: OFF + ENABLE_VISIBILITY: OFF + EMSCRIPTEN_VERSION: 3.1.28 + +permissions: + contents: read + +jobs: + setup: + runs-on: ubuntu-latest + outputs: + VERSION: ${{ steps.get_version.outputs.VERSION }} + steps: + - uses: actions/checkout@v4 + - name: get-version + id: get_version + run: echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT + - name: opencv2-source + env: + opencv-version: 2.4.13.7 + run: | + wget -q https://github.com/opencv/opencv/archive/${{ env.opencv-version }}.zip -O opencv-${{ env.opencv-version }}.zip + unzip -q opencv-${{ env.opencv-version }}.zip + rm opencv-${{ env.opencv-version }}.zip + cd opencv-${{ env.opencv-version }} + truncate -s 0 cmake/OpenCVFindLibsGrfmt.cmake + + rm modules/core/src/gl_* + rm modules/core/src/gpumat.cpp + rm modules/core/src/opengl_* + rm modules/core/include/opencv2/core/cuda_* + rm modules/core/include/opencv2/core/devmem2d.hpp + rm modules/core/include/opencv2/core/gpumat.hpp + rm modules/core/include/opencv2/core/opengl_* + rm modules/core/include/opencv2/core/wimage.hpp + + rm -rf modules/dynamicuda + rm -rf modules/gpu + rm -rf modules/ocl + + patch -p1 -i ../patches/opencv-${{ env.opencv-version }}-no-gpu.patch + + patch -p1 -i ../patches/opencv-${{ env.opencv-version }}-no-rtti.patch + patch -p1 -i ../patches/opencv-${{ env.opencv-version }}-no-zlib.patch + patch -p1 -i ../patches/opencv-${{ env.opencv-version }}-fix-highgui-include.patch + patch -p1 -i ../patches/opencv-${{ env.opencv-version }}-no-link-stdc++.patch + patch -p1 -i ../patches/opencv-${{ env.opencv-version }}-enable-cxx11.patch + patch -p1 -i ../patches/opencv-${{ env.opencv-version }}-link-openmp.patch + patch -p1 -i ../patches/opencv-${{ env.opencv-version }}-newer-msvc.patch + patch -p1 -i ../patches/opencv-${{ env.opencv-version }}-minimal-install.patch + cp ../patches/draw_text.h ../patches/mono_font_data.h modules/core/src/ + patch -p1 -i ../patches/opencv-${{ env.opencv-version }}-drawing-mono-font.patch + rm -rf modules/highgui + cp -r ../highgui modules/ + rm -rf 3rdparty apps data doc samples platforms + rm -rf modules/java + rm -rf modules/python + rm -rf modules/ts + sed -e 's/__VERSION__/${{ env.opencv-version }}/g' ../patches/Info.plist > ./Info.plist + cp ../opencv2_cmake_options.txt ./options.txt + cd .. + mv opencv-${{ env.opencv-version }} opencv-mobile-${{ env.opencv-version }} + zip -9 -r opencv-mobile-${{ env.opencv-version }}.zip opencv-mobile-${{ env.opencv-version }} + - name: opencv3-source + env: + opencv-version: 3.4.20 + run: | + wget -q https://github.com/opencv/opencv/archive/${{ env.opencv-version }}.zip -O opencv-${{ env.opencv-version }}.zip + unzip -q opencv-${{ env.opencv-version }}.zip + rm opencv-${{ env.opencv-version }}.zip + cd opencv-${{ env.opencv-version }} + truncate -s 0 cmake/OpenCVFindLibsGrfmt.cmake + + rm modules/core/src/cuda_* + rm modules/core/src/direct* + rm modules/core/src/gl_* + rm modules/core/src/intel_gpu_* + rm modules/core/src/ocl* + rm modules/core/src/opengl.cpp + rm modules/core/src/ovx.cpp + rm modules/core/src/umatrix.hpp + rm modules/core/src/va_intel.cpp + + rm modules/core/include/opencv2/core/cuda*.hpp + rm modules/core/include/opencv2/core/directx.hpp + rm modules/core/include/opencv2/core/ippasync.hpp + rm modules/core/include/opencv2/core/ocl*.hpp + rm modules/core/include/opencv2/core/opengl.hpp + rm modules/core/include/opencv2/core/ovx.hpp + rm modules/core/include/opencv2/core/private.cuda.hpp + rm modules/core/include/opencv2/core/va_intel.hpp + rm modules/core/include/opencv2/core/wimage.hpp + rm -rf modules/core/include/opencv2/core/cuda + rm -rf modules/core/include/opencv2/core/opencl + rm -rf modules/core/include/opencv2/core/openvx + + rm modules/photo/src/denoising.cuda.cpp + rm modules/photo/include/opencv2/photo/cuda.hpp + + rm -rf modules/cuda* + rm -rf modules/cudev + + find modules -type d | xargs -i rm -rf {}/src/cuda + find modules -type d | xargs -i rm -rf {}/src/opencl + find modules -type d | xargs -i rm -rf {}/perf/cuda + find modules -type d | xargs -i rm -rf {}/perf/opencl + find modules -type f | xargs -i sed -i '/opencl_kernels/d' {} + find modules -type f | xargs -i sed -i '/cuda.hpp/d' {} + find modules -type f | xargs -i sed -i '/opengl.hpp/d' {} + find modules -type f | xargs -i sed -i '/ocl_defs.hpp/d' {} + find modules -type f | xargs -i sed -i '/ocl.hpp/d' {} + find modules -type f | xargs -i sed -i '/ovx_defs.hpp/d' {} + find modules -type f | xargs -i sed -i '/ovx.hpp/d' {} + find modules -type f | xargs -i sed -i '/va_intel.hpp/d' {} + + patch -p1 -i ../patches/opencv-${{ env.opencv-version }}-no-gpu.patch + + patch -p1 -i ../patches/opencv-${{ env.opencv-version }}-no-rtti.patch + patch -p1 -i ../patches/opencv-${{ env.opencv-version }}-no-zlib.patch + patch -p1 -i ../patches/opencv-${{ env.opencv-version }}-link-openmp.patch + patch -p1 -i ../patches/opencv-${{ env.opencv-version }}-fix-emscripten-include.patch + patch -p1 -i ../patches/opencv-${{ env.opencv-version }}-minimal-install.patch + cp ../patches/draw_text.h ../patches/mono_font_data.h modules/imgproc/src/ + patch -p1 -i ../patches/opencv-${{ env.opencv-version }}-drawing-mono-font.patch + rm -rf modules/highgui + cp -r ../highgui modules/ + rm -rf 3rdparty apps data doc samples platforms + rm -rf modules/java + rm -rf modules/js + rm -rf modules/python + rm -rf modules/ts + sed -e 's/__VERSION__/${{ env.opencv-version }}/g' ../patches/Info.plist > ./Info.plist + cp ../opencv3_cmake_options.txt ./options.txt + cd .. + mv opencv-${{ env.opencv-version }} opencv-mobile-${{ env.opencv-version }} + zip -9 -r opencv-mobile-${{ env.opencv-version }}.zip opencv-mobile-${{ env.opencv-version }} + - name: opencv4-source + env: + opencv-version: 4.9.0 + run: | + wget -q https://github.com/opencv/opencv/archive/${{ env.opencv-version }}.zip -O opencv-${{ env.opencv-version }}.zip + unzip -q opencv-${{ env.opencv-version }}.zip + rm opencv-${{ env.opencv-version }}.zip + cd opencv-${{ env.opencv-version }} + truncate -s 0 cmake/OpenCVFindLibsGrfmt.cmake + rm -rf modules/gapi + + rm modules/core/src/cuda_* + rm modules/core/src/direct* + rm modules/core/src/gl_* + rm modules/core/src/intel_gpu_* + rm modules/core/src/ocl* + rm modules/core/src/opengl.cpp + rm modules/core/src/ovx.cpp + rm modules/core/src/umatrix.hpp + rm modules/core/src/va_intel.cpp + rm modules/core/src/va_wrapper.impl.hpp + + rm modules/core/include/opencv2/core/cuda*.hpp + rm modules/core/include/opencv2/core/directx.hpp + rm modules/core/include/opencv2/core/ocl*.hpp + rm modules/core/include/opencv2/core/opengl.hpp + rm modules/core/include/opencv2/core/ovx.hpp + rm modules/core/include/opencv2/core/private.cuda.hpp + rm modules/core/include/opencv2/core/va_*.hpp + rm -rf modules/core/include/opencv2/core/cuda + rm -rf modules/core/include/opencv2/core/opencl + rm -rf modules/core/include/opencv2/core/openvx + + rm modules/photo/src/denoising.cuda.cpp + rm modules/photo/include/opencv2/photo/cuda.hpp + + find modules -type d | xargs -i rm -rf {}/src/cuda + find modules -type d | xargs -i rm -rf {}/src/opencl + find modules -type d | xargs -i rm -rf {}/perf/cuda + find modules -type d | xargs -i rm -rf {}/perf/opencl + find modules -type f | xargs -i sed -i '/opencl_kernels/d' {} + find modules -type f | xargs -i sed -i '/cuda.hpp/d' {} + find modules -type f | xargs -i sed -i '/opengl.hpp/d' {} + find modules -type f | xargs -i sed -i '/ocl_defs.hpp/d' {} + find modules -type f | xargs -i sed -i '/ocl.hpp/d' {} + find modules -type f | xargs -i sed -i '/ovx_defs.hpp/d' {} + find modules -type f | xargs -i sed -i '/ovx.hpp/d' {} + find modules -type f | xargs -i sed -i '/va_intel.hpp/d' {} + + patch -p1 -i ../patches/opencv-${{ env.opencv-version }}-no-gpu.patch + + patch -p1 -i ../patches/opencv-${{ env.opencv-version }}-no-rtti.patch + patch -p1 -i ../patches/opencv-${{ env.opencv-version }}-no-zlib.patch + patch -p1 -i ../patches/opencv-${{ env.opencv-version }}-link-openmp.patch + patch -p1 -i ../patches/opencv-${{ env.opencv-version }}-minimal-install.patch + cp ../patches/draw_text.h ../patches/mono_font_data.h modules/imgproc/src/ + patch -p1 -i ../patches/opencv-${{ env.opencv-version }}-drawing-mono-font.patch + rm -rf modules/highgui + cp -r ../highgui modules/ + rm -rf 3rdparty apps data doc samples platforms + rm -rf modules/java + rm -rf modules/js + rm -rf modules/python + rm -rf modules/ts + sed -e 's/__VERSION__/${{ env.opencv-version }}/g' ../patches/Info.plist > ./Info.plist + cp ../opencv4_cmake_options.txt ./options.txt + cd .. + mv opencv-${{ env.opencv-version }} opencv-mobile-${{ env.opencv-version }} + zip -9 -r opencv-mobile-${{ env.opencv-version }}.zip opencv-mobile-${{ env.opencv-version }} + - name: upload-opencv2-source + uses: actions/upload-artifact@v4 + with: + name: opencv-mobile-2.4.13.7-source + path: opencv-mobile-2.4.13.7.zip + - name: upload-opencv3-source + uses: actions/upload-artifact@v4 + with: + name: opencv-mobile-3.4.20-source + path: opencv-mobile-3.4.20.zip + - name: upload-opencv4-source + uses: actions/upload-artifact@v4 + with: + name: opencv-mobile-4.9.0-source + path: opencv-mobile-4.9.0.zip + + android: + needs: [setup] + runs-on: ubuntu-latest + strategy: + matrix: + opencv-version: [2.4.13.7, 3.4.20, 4.9.0] + env: + COMMON_CMAKE_OPTIONS: | + -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_LATEST_HOME/build/cmake/android.toolchain.cmake \ + -DANDROID_USE_LEGACY_TOOLCHAIN_FILE=False \ + -DANDROID_PLATFORM=android-21 \ + -DANDROID_CPP_FEATURES="no-rtti no-exceptions" \ + -DCMAKE_INSTALL_PREFIX=install \ + -DCMAKE_BUILD_TYPE=Release \ + steps: + - uses: actions/checkout@v4 + - name: ndk-fix-debug + run: sed -i -e '/^ -g$/d' $ANDROID_NDK_LATEST_HOME/build/cmake/android-legacy.toolchain.cmake + - uses: actions/download-artifact@v4 + with: + name: opencv-mobile-${{ matrix.opencv-version }}-source + - name: setup-opencv-source + run: | + unzip -q opencv-mobile-${{ matrix.opencv-version }}.zip + echo "SOURCE_DIR=opencv-mobile-${{ matrix.opencv-version }}" >> $GITHUB_ENV + echo "PACKAGE_NAME=opencv-mobile-${{ matrix.opencv-version }}-android" >> $GITHUB_ENV + - name: build-armeabi-v7a + run: | + cd ${{ env.SOURCE_DIR }} + mkdir build-armeabi-v7a && cd build-armeabi-v7a + cmake ${{ env.COMMON_CMAKE_OPTIONS }} -DANDROID_ABI="armeabi-v7a" -DANDROID_ARM_NEON=ON \ + `cat ../options.txt` -DBUILD_opencv_world=OFF -DOPENCV_DISABLE_FILESYSTEM_SUPPORT=ON .. + cmake --build . -j $(nproc) + cmake --build . --target install + - name: build-arm64-v8a + run: | + cd ${{ env.SOURCE_DIR }} + mkdir build-arm64-v8a && cd build-arm64-v8a + cmake ${{ env.COMMON_CMAKE_OPTIONS }} -DANDROID_ABI="arm64-v8a" \ + `cat ../options.txt` -DBUILD_opencv_world=OFF -DOPENCV_DISABLE_FILESYSTEM_SUPPORT=ON -DOPENCV_EXTRA_FLAGS="-mno-outline-atomics" .. + cmake --build . -j $(nproc) + cmake --build . --target install + - name: build-x86 + run: | + cd ${{ env.SOURCE_DIR }} + mkdir build-x86 && cd build-x86 + cmake ${{ env.COMMON_CMAKE_OPTIONS }} -DANDROID_ABI="x86" \ + `cat ../options.txt` -DBUILD_opencv_world=OFF -DOPENCV_DISABLE_FILESYSTEM_SUPPORT=ON .. + cmake --build . -j $(nproc) + cmake --build . --target install + - name: build-x86_64 + run: | + cd ${{ env.SOURCE_DIR }} + mkdir build-x86_64 && cd build-x86_64 + cmake ${{ env.COMMON_CMAKE_OPTIONS }} -DANDROID_ABI="x86_64" \ + `cat ../options.txt` -DBUILD_opencv_world=OFF -DOPENCV_DISABLE_FILESYSTEM_SUPPORT=ON .. + cmake --build . -j $(nproc) + cmake --build . --target install + - name: package + run: | + mkdir ${{ env.PACKAGE_NAME }} + cp -rf ${{ env.SOURCE_DIR }}/build-x86/install/* ${{ env.PACKAGE_NAME }}/ + cp -rf ${{ env.SOURCE_DIR }}/build-x86_64/install/* ${{ env.PACKAGE_NAME }}/ + cp -rf ${{ env.SOURCE_DIR }}/build-armeabi-v7a/install/* ${{ env.PACKAGE_NAME }}/ + cp -rf ${{ env.SOURCE_DIR }}/build-arm64-v8a/install/* ${{ env.PACKAGE_NAME }}/ + zip -9 -r ${{ env.PACKAGE_NAME }}.zip ${{ env.PACKAGE_NAME }} + - name: test-armeabi-v7a + run: | + cd test + mkdir build-armeabi-v7a && cd build-armeabi-v7a + cmake ${{ env.COMMON_CMAKE_OPTIONS }} -DANDROID_ABI="armeabi-v7a" -DANDROID_ARM_NEON=ON \ + -DOpenCV_DIR=$GITHUB_WORKSPACE/${{ env.PACKAGE_NAME }}/sdk/native/jni .. + cmake --build . -j $(nproc) + - name: test-arm64-v8a + run: | + cd test + mkdir build-arm64-v8a && cd build-arm64-v8a + cmake ${{ env.COMMON_CMAKE_OPTIONS }} -DANDROID_ABI="arm64-v8a" \ + -DOpenCV_DIR=$GITHUB_WORKSPACE/${{ env.PACKAGE_NAME }}/sdk/native/jni .. + cmake --build . -j $(nproc) + - name: test-x86 + run: | + cd test + mkdir build-x86 && cd build-x86 + cmake ${{ env.COMMON_CMAKE_OPTIONS }} -DANDROID_ABI="x86" \ + -DOpenCV_DIR=$GITHUB_WORKSPACE/${{ env.PACKAGE_NAME }}/sdk/native/jni .. + cmake --build . -j $(nproc) + - name: test-x86_64 + run: | + cd test + mkdir build-x86_64 && cd build-x86_64 + cmake ${{ env.COMMON_CMAKE_OPTIONS }} -DANDROID_ABI="x86_64" \ + -DOpenCV_DIR=$GITHUB_WORKSPACE/${{ env.PACKAGE_NAME }}/sdk/native/jni .. + cmake --build . -j $(nproc) + - name: upload + uses: actions/upload-artifact@v4 + with: + name: ${{ env.PACKAGE_NAME }} + path: ${{ env.PACKAGE_NAME }}.zip + + ios: + needs: [setup] + runs-on: macos-13 + strategy: + matrix: + opencv-version: [2.4.13.7, 3.4.20, 4.9.0] + env: + COMMON_CMAKE_OPTIONS: | + -DCMAKE_TOOLCHAIN_FILE=../../toolchains/ios.toolchain.cmake \ + -DPLATFORM=OS \ + -DDEPLOYMENT_TARGET=$IOS_DEPLOYMENT_TARGET \ + -DENABLE_BITCODE=$ENABLE_BITCODE \ + -DENABLE_ARC=$ENABLE_ARC \ + -DENABLE_VISIBILITY=$ENABLE_VISIBILITY \ + -DCMAKE_C_FLAGS="-fno-rtti -fno-exceptions" \ + -DCMAKE_CXX_FLAGS="-fno-rtti -fno-exceptions" \ + -DCMAKE_INSTALL_PREFIX=install \ + -DCMAKE_BUILD_TYPE=Release \ + steps: + - uses: actions/checkout@v4 + - uses: actions/download-artifact@v4 + with: + name: opencv-mobile-${{ matrix.opencv-version }}-source + - name: setup-opencv-source + run: | + unzip -q opencv-mobile-${{ matrix.opencv-version }}.zip + echo "SOURCE_DIR=opencv-mobile-${{ matrix.opencv-version }}" >> $GITHUB_ENV + echo "PACKAGE_NAME=opencv-mobile-${{ matrix.opencv-version }}-ios" >> $GITHUB_ENV + - name: workaround-opencv2-list + if: matrix.opencv-version == '2.4.13.7' + run: | + # workaround ar @list issue on macos + sed -i -e 's!\\"${objpath4}\\"!${objpath4}!g' ${{ env.SOURCE_DIR }}/modules/world/CMakeLists.txt + - name: build-arm64 + run: | + cd ${{ env.SOURCE_DIR }} + mkdir build-arm64 && cd build-arm64 + cmake ${{ env.COMMON_CMAKE_OPTIONS }} -DARCHS="arm64" \ + `cat ../options.txt` -DBUILD_opencv_world=ON -DOPENCV_DISABLE_FILESYSTEM_SUPPORT=ON .. + # workaround ar @list issue on macos + cmake --build . -j 4 || { cd modules/world; $DEVELOPER_DIR/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar qc ../../lib/libopencv_world.a `cat world_objects.rsp` CMakeFiles/opencv_world.dir/src/world_init.cpp.o; cd ../..; } + cmake --build . --target install + - name: package + run: | + rm -rf opencv2.framework + mkdir -p opencv2.framework/Versions/A/Headers + mkdir -p opencv2.framework/Versions/A/Resources + ln -s A opencv2.framework/Versions/Current + ln -s Versions/Current/Headers opencv2.framework/Headers + ln -s Versions/Current/Resources opencv2.framework/Resources + ln -s Versions/Current/opencv2 opencv2.framework/opencv2 + lipo -create \ + ${{ env.SOURCE_DIR }}/build-arm64/install/lib/libopencv_world.a \ + -o opencv2.framework/Versions/A/opencv2 + cp -r ${{ env.SOURCE_DIR }}/build-arm64/install/include/opencv4/opencv2/* opencv2.framework/Versions/A/Headers/ || : + cp -r ${{ env.SOURCE_DIR }}/build-arm64/install/include/opencv2/* opencv2.framework/Versions/A/Headers/ || : + cp ${{ env.SOURCE_DIR }}/Info.plist opencv2.framework/Versions/A/Resources/ + rm -f ${{ env.PACKAGE_NAME }}.zip + zip -9 -y -r ${{ env.PACKAGE_NAME }}.zip opencv2.framework + - name: test + run: | + cd test + mkdir build && cd build + cmake ${{ env.COMMON_CMAKE_OPTIONS }} -DARCHS="arm64" \ + -DOpenCV_DIR=$GITHUB_WORKSPACE .. + cmake --build . -j 4 + - name: upload-zip + uses: actions/upload-artifact@v4 + with: + name: ${{ env.PACKAGE_NAME }} + path: ${{ env.PACKAGE_NAME }}.zip + + ios-simulator: + needs: [setup] + runs-on: macos-13 + strategy: + matrix: + opencv-version: [2.4.13.7, 3.4.20, 4.9.0] + env: + COMMON_CMAKE_OPTIONS: | + -DCMAKE_TOOLCHAIN_FILE=../../toolchains/ios.toolchain.cmake \ + -DPLATFORM=SIMULATOR \ + -DDEPLOYMENT_TARGET=$IOS_DEPLOYMENT_TARGET \ + -DENABLE_BITCODE=$ENABLE_BITCODE \ + -DENABLE_ARC=$ENABLE_ARC \ + -DENABLE_VISIBILITY=$ENABLE_VISIBILITY \ + -DCMAKE_C_FLAGS="-fno-rtti -fno-exceptions" \ + -DCMAKE_CXX_FLAGS="-fno-rtti -fno-exceptions" \ + -DCMAKE_INSTALL_PREFIX=install \ + -DCMAKE_BUILD_TYPE=Release \ + steps: + - uses: actions/checkout@v4 + - uses: actions/download-artifact@v4 + with: + name: opencv-mobile-${{ matrix.opencv-version }}-source + - name: setup-opencv-source + run: | + unzip -q opencv-mobile-${{ matrix.opencv-version }}.zip + echo "SOURCE_DIR=opencv-mobile-${{ matrix.opencv-version }}" >> $GITHUB_ENV + echo "PACKAGE_NAME=opencv-mobile-${{ matrix.opencv-version }}-ios-simulator" >> $GITHUB_ENV + - name: workaround-opencv2-list + if: matrix.opencv-version == '2.4.13.7' + run: | + # workaround ar @list issue on macos + sed -i -e 's!\\"${objpath4}\\"!${objpath4}!g' ${{ env.SOURCE_DIR }}/modules/world/CMakeLists.txt + - name: build-x86_64 + run: | + cd ${{ env.SOURCE_DIR }} + mkdir build-x86_64 && cd build-x86_64 + cmake ${{ env.COMMON_CMAKE_OPTIONS }} -DARCHS="x86_64" \ + `cat ../options.txt` -DBUILD_opencv_world=ON -DOPENCV_DISABLE_FILESYSTEM_SUPPORT=ON .. + # workaround ar @list issue on macos + cmake --build . -j 4 || { cd modules/world; $DEVELOPER_DIR/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar qc ../../lib/libopencv_world.a `cat world_objects.rsp` CMakeFiles/opencv_world.dir/src/world_init.cpp.o; cd ../..; } + cmake --build . --target install + - name: build-arm64 + run: | + cd ${{ env.SOURCE_DIR }} + mkdir build-arm64 && cd build-arm64 + cmake ${{ env.COMMON_CMAKE_OPTIONS }} -DARCHS="arm64" \ + `cat ../options.txt` -DBUILD_opencv_world=ON -DOPENCV_DISABLE_FILESYSTEM_SUPPORT=ON .. + # workaround ar @list issue on macos + cmake --build . -j 4 || { cd modules/world; $DEVELOPER_DIR/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar qc ../../lib/libopencv_world.a `cat world_objects.rsp` CMakeFiles/opencv_world.dir/src/world_init.cpp.o; cd ../..; } + cmake --build . --target install + - name: package + run: | + rm -rf opencv2.framework + mkdir -p opencv2.framework/Versions/A/Headers + mkdir -p opencv2.framework/Versions/A/Resources + ln -s A opencv2.framework/Versions/Current + ln -s Versions/Current/Headers opencv2.framework/Headers + ln -s Versions/Current/Resources opencv2.framework/Resources + ln -s Versions/Current/opencv2 opencv2.framework/opencv2 + lipo -create \ + ${{ env.SOURCE_DIR }}/build-x86_64/install/lib/libopencv_world.a \ + ${{ env.SOURCE_DIR }}/build-arm64/install/lib/libopencv_world.a \ + -o opencv2.framework/Versions/A/opencv2 + cp -r ${{ env.SOURCE_DIR }}/build-x86_64/install/include/opencv4/opencv2/* opencv2.framework/Versions/A/Headers/ || : + cp -r ${{ env.SOURCE_DIR }}/build-x86_64/install/include/opencv2/* opencv2.framework/Versions/A/Headers/ || : + cp ${{ env.SOURCE_DIR }}/Info.plist opencv2.framework/Versions/A/Resources/ + rm -f ${{ env.PACKAGE_NAME }}.zip + zip -9 -y -r ${{ env.PACKAGE_NAME }}.zip opencv2.framework + - name: test + run: | + cd test + mkdir build && cd build + cmake ${{ env.COMMON_CMAKE_OPTIONS }} -DARCHS="x86_64;arm64" \ + -DOpenCV_DIR=$GITHUB_WORKSPACE .. + cmake --build . -j 4 + - name: upload-zip + uses: actions/upload-artifact@v4 + with: + name: ${{ env.PACKAGE_NAME }} + path: ${{ env.PACKAGE_NAME }}.zip + + armlinux: + needs: [setup] + runs-on: ubuntu-latest + strategy: + matrix: + opencv-version: [2.4.13.7, 3.4.20, 4.9.0] + env: + COMMON_CMAKE_OPTIONS: | + -DCMAKE_C_FLAGS="-fno-rtti -fno-exceptions" \ + -DCMAKE_CXX_FLAGS="-fno-rtti -fno-exceptions" \ + -DCMAKE_INSTALL_PREFIX=install \ + -DCMAKE_BUILD_TYPE=Release \ + steps: + - name: arm-gnu-toolchain + run: | + sudo apt-get update + sudo apt-get install g++-arm-linux-gnueabi g++-arm-linux-gnueabihf g++-aarch64-linux-gnu + + - uses: actions/checkout@v4 + - uses: actions/download-artifact@v4 + with: + name: opencv-mobile-${{ matrix.opencv-version }}-source + - name: setup-opencv-source + run: | + unzip -q opencv-mobile-${{ matrix.opencv-version }}.zip + echo "SOURCE_DIR=opencv-mobile-${{ matrix.opencv-version }}" >> $GITHUB_ENV + echo "PACKAGE_NAME=opencv-mobile-${{ matrix.opencv-version }}-armlinux" >> $GITHUB_ENV + - name: build-arm-linux-gnueabi + run: | + cd ${{ env.SOURCE_DIR }} + mkdir build-arm-linux-gnueabi && cd build-arm-linux-gnueabi + cmake ${{ env.COMMON_CMAKE_OPTIONS }} -DCMAKE_TOOLCHAIN_FILE=../../toolchains/arm-linux-gnueabi.toolchain.cmake \ + `cat ../options.txt` -DBUILD_opencv_world=OFF .. + cmake --build . -j $(nproc) + cmake --build . --target install + - name: build-arm-linux-gnueabihf + run: | + cd ${{ env.SOURCE_DIR }} + mkdir build-arm-linux-gnueabihf && cd build-arm-linux-gnueabihf + cmake ${{ env.COMMON_CMAKE_OPTIONS }} -DCMAKE_TOOLCHAIN_FILE=../../toolchains/arm-linux-gnueabihf.toolchain.cmake \ + `cat ../options.txt` -DBUILD_opencv_world=OFF .. + cmake --build . -j $(nproc) + cmake --build . --target install + - name: build-aarch64-linux-gnu + run: | + cd ${{ env.SOURCE_DIR }} + mkdir build-aarch64-linux-gnu && cd build-aarch64-linux-gnu + cmake ${{ env.COMMON_CMAKE_OPTIONS }} -DCMAKE_TOOLCHAIN_FILE=../../toolchains/aarch64-linux-gnu.toolchain.cmake \ + `cat ../options.txt` -DBUILD_opencv_world=OFF .. + cmake --build . -j $(nproc) + cmake --build . --target install + - name: package + run: | + mkdir ${{ env.PACKAGE_NAME }} + mkdir ${{ env.PACKAGE_NAME }}/arm-linux-gnueabi + mkdir ${{ env.PACKAGE_NAME }}/arm-linux-gnueabihf + mkdir ${{ env.PACKAGE_NAME }}/aarch64-linux-gnu + cp -rf ${{ env.SOURCE_DIR }}/build-arm-linux-gnueabi/install/* ${{ env.PACKAGE_NAME }}/arm-linux-gnueabi/ + cp -rf ${{ env.SOURCE_DIR }}/build-arm-linux-gnueabihf/install/* ${{ env.PACKAGE_NAME }}/arm-linux-gnueabihf/ + cp -rf ${{ env.SOURCE_DIR }}/build-aarch64-linux-gnu/install/* ${{ env.PACKAGE_NAME }}/aarch64-linux-gnu/ + zip -9 -r ${{ env.PACKAGE_NAME }}.zip ${{ env.PACKAGE_NAME }} + - name: set-opencv-dir + if: matrix.opencv-version == '2.4.13.7' || matrix.opencv-version == '3.4.20' + run: echo "OPENCV_SUBDIR=share/OpenCV" >> $GITHUB_ENV + - name: set-opencv-dir + if: matrix.opencv-version == '4.9.0' + run: echo "OPENCV_SUBDIR=lib/cmake/opencv4" >> $GITHUB_ENV + - name: test-arm-linux-gnueabi + run: | + cd test + mkdir build-arm-linux-gnueabi && cd build-arm-linux-gnueabi + cmake ${{ env.COMMON_CMAKE_OPTIONS }} -DCMAKE_TOOLCHAIN_FILE=../../toolchains/arm-linux-gnueabi.toolchain.cmake \ + -DOpenCV_DIR=$GITHUB_WORKSPACE/${{ env.PACKAGE_NAME }}/arm-linux-gnueabi/${{ env.OPENCV_SUBDIR }} .. + cmake --build . -j $(nproc) + - name: test-arm-linux-gnueabihf + run: | + cd test + mkdir build-arm-linux-gnueabihf && cd build-arm-linux-gnueabihf + cmake ${{ env.COMMON_CMAKE_OPTIONS }} -DCMAKE_TOOLCHAIN_FILE=../../toolchains/arm-linux-gnueabihf.toolchain.cmake \ + -DOpenCV_DIR=$GITHUB_WORKSPACE/${{ env.PACKAGE_NAME }}/arm-linux-gnueabihf/${{ env.OPENCV_SUBDIR }} .. + cmake --build . -j $(nproc) + - name: test-aarch64-linux-gnu + run: | + cd test + mkdir build-aarch64-linux-gnu && cd build-aarch64-linux-gnu + cmake ${{ env.COMMON_CMAKE_OPTIONS }} -DCMAKE_TOOLCHAIN_FILE=../../toolchains/aarch64-linux-gnu.toolchain.cmake \ + -DOpenCV_DIR=$GITHUB_WORKSPACE/${{ env.PACKAGE_NAME }}/aarch64-linux-gnu/${{ env.OPENCV_SUBDIR }} .. + cmake --build . -j $(nproc) + - name: upload-zip + uses: actions/upload-artifact@v4 + with: + name: ${{ env.PACKAGE_NAME }} + path: ${{ env.PACKAGE_NAME }}.zip + + macos: + needs: [setup] + runs-on: macos-13 + strategy: + matrix: + opencv-version: [2.4.13.7, 3.4.20, 4.9.0] + env: + COMMON_CMAKE_OPTIONS: | + -DCMAKE_TOOLCHAIN_FILE=../../toolchains/ios.toolchain.cmake \ + -DDEPLOYMENT_TARGET=$MAC_DEPLOYMENT_TARGET \ + -DENABLE_BITCODE=OFF \ + -DENABLE_ARC=$ENABLE_ARC \ + -DENABLE_VISIBILITY=$ENABLE_VISIBILITY \ + -DCMAKE_INSTALL_PREFIX=install \ + -DCMAKE_BUILD_TYPE=Release \ + steps: + - uses: actions/checkout@v4 + - uses: actions/download-artifact@v4 + with: + name: opencv-mobile-${{ matrix.opencv-version }}-source + - name: setup-opencv-source + run: | + unzip -q opencv-mobile-${{ matrix.opencv-version }}.zip + echo "SOURCE_DIR=opencv-mobile-${{ matrix.opencv-version }}" >> $GITHUB_ENV + echo "PACKAGE_NAME=opencv-mobile-${{ matrix.opencv-version }}-macos" >> $GITHUB_ENV + - name: workaround-opencv2-list + if: matrix.opencv-version == '2.4.13.7' + run: | + # workaround ar @list issue on macos + sed -i -e 's!\\"${objpath4}\\"!${objpath4}!g' ${{ env.SOURCE_DIR }}/modules/world/CMakeLists.txt + - name: build-x86_64 + run: | + cd ${{ env.SOURCE_DIR }} + mkdir build-x86_64 && cd build-x86_64 + cmake ${{ env.COMMON_CMAKE_OPTIONS }} -DPLATFORM=MAC -DARCHS="x86_64" \ + `cat ../options.txt` -DBUILD_opencv_world=ON .. + # workaround ar @list issue on macos + cmake --build . -j 4 || { cd modules/world; $DEVELOPER_DIR/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar qc ../../lib/libopencv_world.a `cat world_objects.rsp` CMakeFiles/opencv_world.dir/src/world_init.cpp.o; cd ../..; } + cmake --build . --target install + - name: build-arm64 + run: | + cd ${{ env.SOURCE_DIR }} + mkdir build-arm64 && cd build-arm64 + cmake ${{ env.COMMON_CMAKE_OPTIONS }} -DPLATFORM=MAC_ARM64 -DARCHS="arm64" \ + `cat ../options.txt` -DBUILD_opencv_world=ON .. + # workaround ar @list issue on macos + cmake --build . -j 4 || { cd modules/world; $DEVELOPER_DIR/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar qc ../../lib/libopencv_world.a `cat world_objects.rsp` CMakeFiles/opencv_world.dir/src/world_init.cpp.o; cd ../..; } + cmake --build . --target install + - name: package + run: | + rm -rf opencv2.framework + mkdir -p opencv2.framework/Versions/A/Headers + mkdir -p opencv2.framework/Versions/A/Resources + ln -s A opencv2.framework/Versions/Current + ln -s Versions/Current/Headers opencv2.framework/Headers + ln -s Versions/Current/Resources opencv2.framework/Resources + ln -s Versions/Current/opencv2 opencv2.framework/opencv2 + lipo -create \ + ${{ env.SOURCE_DIR }}/build-x86_64/install/lib/libopencv_world.a \ + ${{ env.SOURCE_DIR }}/build-arm64/install/lib/libopencv_world.a \ + -o opencv2.framework/Versions/A/opencv2 + cp -r ${{ env.SOURCE_DIR }}/build-x86_64/install/include/opencv4/opencv2/* opencv2.framework/Versions/A/Headers/ || : + cp -r ${{ env.SOURCE_DIR }}/build-x86_64/install/include/opencv2/* opencv2.framework/Versions/A/Headers/ || : + cp ${{ env.SOURCE_DIR }}/Info.plist opencv2.framework/Versions/A/Resources/ + rm -f ${{ env.PACKAGE_NAME }}.zip + zip -9 -y -r ${{ env.PACKAGE_NAME }}.zip opencv2.framework + - name: test-x86_64 + run: | + cd test + mkdir build-x86_64 && cd build-x86_64 + cmake ${{ env.COMMON_CMAKE_OPTIONS }} -DPLATFORM=MAC -DARCHS="x86_64" \ + -DOpenCV_DIR=$GITHUB_WORKSPACE .. + cmake --build . -j 4 + - name: test-arm64 + run: | + cd test + mkdir build-arm64 && cd build-arm64 + cmake ${{ env.COMMON_CMAKE_OPTIONS }} -DPLATFORM=MAC_ARM64 -DARCHS="arm64" \ + -DOpenCV_DIR=$GITHUB_WORKSPACE .. + cmake --build . -j 4 + - name: upload-zip + uses: actions/upload-artifact@v4 + with: + name: ${{ env.PACKAGE_NAME }} + path: ${{ env.PACKAGE_NAME }}.zip + + mac-catalyst: + needs: [setup] + runs-on: macos-13 + strategy: + matrix: + opencv-version: [2.4.13.7, 3.4.20, 4.9.0] + env: + COMMON_CMAKE_OPTIONS: | + -DCMAKE_TOOLCHAIN_FILE=../../toolchains/ios.toolchain.cmake \ + -DPLATFORM=MAC_CATALYST \ + -DDEPLOYMENT_TARGET=$MAC_CATALYST_DEPLOYMENT_TARGET \ + -DENABLE_BITCODE=$ENABLE_BITCODE \ + -DENABLE_ARC=$ENABLE_ARC \ + -DENABLE_VISIBILITY=$ENABLE_VISIBILITY \ + -DCMAKE_C_FLAGS="-fno-rtti -fno-exceptions" \ + -DCMAKE_CXX_FLAGS="-fno-rtti -fno-exceptions" \ + -DCMAKE_INSTALL_PREFIX=install \ + -DCMAKE_BUILD_TYPE=Release \ + steps: + - uses: actions/checkout@v4 + - uses: actions/download-artifact@v4 + with: + name: opencv-mobile-${{ matrix.opencv-version }}-source + - name: setup-opencv-source + run: | + unzip -q opencv-mobile-${{ matrix.opencv-version }}.zip + echo "SOURCE_DIR=opencv-mobile-${{ matrix.opencv-version }}" >> $GITHUB_ENV + echo "PACKAGE_NAME=opencv-mobile-${{ matrix.opencv-version }}-mac-catalyst" >> $GITHUB_ENV + - name: workaround-opencv2-list + if: matrix.opencv-version == '2.4.13.7' + run: | + # workaround ar @list issue on macos + sed -i -e 's!\\"${objpath4}\\"!${objpath4}!g' ${{ env.SOURCE_DIR }}/modules/world/CMakeLists.txt + - name: build-x86_64 + run: | + cd ${{ env.SOURCE_DIR }} + mkdir build-x86_64 && cd build-x86_64 + cmake ${{ env.COMMON_CMAKE_OPTIONS }} -DARCHS="x86_64" \ + `cat ../options.txt` -DBUILD_opencv_world=ON .. + # workaround ar @list issue on macos + cmake --build . -j 4 || { cd modules/world; $DEVELOPER_DIR/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar qc ../../lib/libopencv_world.a `cat world_objects.rsp` CMakeFiles/opencv_world.dir/src/world_init.cpp.o; cd ../..; } + cmake --build . --target install + - name: build-arm64 + run: | + cd ${{ env.SOURCE_DIR }} + mkdir build-arm64 && cd build-arm64 + cmake ${{ env.COMMON_CMAKE_OPTIONS }} -DARCHS="arm64" \ + `cat ../options.txt` -DBUILD_opencv_world=ON .. + # workaround ar @list issue on macos + cmake --build . -j 4 || { cd modules/world; $DEVELOPER_DIR/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar qc ../../lib/libopencv_world.a `cat world_objects.rsp` CMakeFiles/opencv_world.dir/src/world_init.cpp.o; cd ../..; } + cmake --build . --target install + - name: package + run: | + rm -rf opencv2.framework + mkdir -p opencv2.framework/Versions/A/Headers + mkdir -p opencv2.framework/Versions/A/Resources + ln -s A opencv2.framework/Versions/Current + ln -s Versions/Current/Headers opencv2.framework/Headers + ln -s Versions/Current/Resources opencv2.framework/Resources + ln -s Versions/Current/opencv2 opencv2.framework/opencv2 + lipo -create \ + ${{ env.SOURCE_DIR }}/build-x86_64/install/lib/libopencv_world.a \ + ${{ env.SOURCE_DIR }}/build-arm64/install/lib/libopencv_world.a \ + -o opencv2.framework/Versions/A/opencv2 + cp -r ${{ env.SOURCE_DIR }}/build-arm64/install/include/opencv4/opencv2/* opencv2.framework/Versions/A/Headers/ || : + cp -r ${{ env.SOURCE_DIR }}/build-arm64/install/include/opencv2/* opencv2.framework/Versions/A/Headers/ || : + cp ${{ env.SOURCE_DIR }}/Info.plist opencv2.framework/Versions/A/Resources/ + rm -f ${{ env.PACKAGE_NAME }}.zip + zip -9 -y -r ${{ env.PACKAGE_NAME }}.zip opencv2.framework + - name: test + run: | + cd test + mkdir build && cd build + cmake ${{ env.COMMON_CMAKE_OPTIONS }} -DARCHS="x86_64;arm64" \ + -DOpenCV_DIR=$GITHUB_WORKSPACE .. + cmake --build . -j 4 + - name: upload-zip + uses: actions/upload-artifact@v4 + with: + name: ${{ env.PACKAGE_NAME }} + path: ${{ env.PACKAGE_NAME }}.zip + + watchos: + needs: [setup] + runs-on: macos-13 + strategy: + matrix: + opencv-version: [2.4.13.7, 3.4.20, 4.9.0] + env: + COMMON_CMAKE_OPTIONS: | + -DCMAKE_TOOLCHAIN_FILE=../../toolchains/ios.toolchain.cmake \ + -DPLATFORM=WATCHOS \ + -DDEPLOYMENT_TARGET=$WATCHOS_DEPLOYMENT_TARGET \ + -DENABLE_BITCODE=$ENABLE_BITCODE \ + -DENABLE_ARC=$ENABLE_ARC \ + -DENABLE_VISIBILITY=$ENABLE_VISIBILITY \ + -DCMAKE_C_FLAGS="-fno-rtti -fno-exceptions" \ + -DCMAKE_CXX_FLAGS="-fno-rtti -fno-exceptions" \ + -DCMAKE_INSTALL_PREFIX=install \ + -DCMAKE_BUILD_TYPE=Release \ + steps: + - uses: actions/checkout@v4 + - uses: actions/download-artifact@v4 + with: + name: opencv-mobile-${{ matrix.opencv-version }}-source + - name: setup-opencv-source + run: | + unzip -q opencv-mobile-${{ matrix.opencv-version }}.zip + echo "SOURCE_DIR=opencv-mobile-${{ matrix.opencv-version }}" >> $GITHUB_ENV + echo "PACKAGE_NAME=opencv-mobile-${{ matrix.opencv-version }}-watchos" >> $GITHUB_ENV + - name: workaround-opencv2-list + if: matrix.opencv-version == '2.4.13.7' + run: | + # workaround ar @list issue on macos + sed -i -e 's!\\"${objpath4}\\"!${objpath4}!g' ${{ env.SOURCE_DIR }}/modules/world/CMakeLists.txt + - name: build-armv7k + run: | + cd ${{ env.SOURCE_DIR }} + mkdir build-armv7k && cd build-armv7k + cmake ${{ env.COMMON_CMAKE_OPTIONS }} -DARCHS="armv7k" \ + `cat ../options.txt` -DBUILD_opencv_world=ON .. + # workaround ar @list issue on macos + cmake --build . -j 4 || { cd modules/world; $DEVELOPER_DIR/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar qc ../../lib/libopencv_world.a `cat world_objects.rsp` CMakeFiles/opencv_world.dir/src/world_init.cpp.o; cd ../..; } + cmake --build . --target install + - name: build-arm64_32 + run: | + cd ${{ env.SOURCE_DIR }} + mkdir build-arm64_32 && cd build-arm64_32 + cmake ${{ env.COMMON_CMAKE_OPTIONS }} -DARCHS="arm64_32" \ + `cat ../options.txt` -DBUILD_opencv_world=ON .. + # workaround ar @list issue on macos + cmake --build . -j 4 || { cd modules/world; $DEVELOPER_DIR/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar qc ../../lib/libopencv_world.a `cat world_objects.rsp` CMakeFiles/opencv_world.dir/src/world_init.cpp.o; cd ../..; } + cmake --build . --target install + - name: package + run: | + rm -rf opencv2.framework + mkdir -p opencv2.framework/Versions/A/Headers + mkdir -p opencv2.framework/Versions/A/Resources + ln -s A opencv2.framework/Versions/Current + ln -s Versions/Current/Headers opencv2.framework/Headers + ln -s Versions/Current/Resources opencv2.framework/Resources + ln -s Versions/Current/opencv2 opencv2.framework/opencv2 + lipo -create \ + ${{ env.SOURCE_DIR }}/build-armv7k/install/lib/libopencv_world.a \ + ${{ env.SOURCE_DIR }}/build-arm64_32/install/lib/libopencv_world.a \ + -o opencv2.framework/Versions/A/opencv2 + cp -r ${{ env.SOURCE_DIR }}/build-arm64_32/install/include/opencv4/opencv2/* opencv2.framework/Versions/A/Headers/ || : + cp -r ${{ env.SOURCE_DIR }}/build-arm64_32/install/include/opencv2/* opencv2.framework/Versions/A/Headers/ || : + cp ${{ env.SOURCE_DIR }}/Info.plist opencv2.framework/Versions/A/Resources/ + rm -f ${{ env.PACKAGE_NAME }}.zip + zip -9 -y -r ${{ env.PACKAGE_NAME }}.zip opencv2.framework + - name: test + run: | + cd test + mkdir build && cd build + cmake ${{ env.COMMON_CMAKE_OPTIONS }} -DARCHS="armv7k;arm64_32" \ + -DOpenCV_DIR=$GITHUB_WORKSPACE .. + cmake --build . -j 4 + - name: upload-zip + uses: actions/upload-artifact@v4 + with: + name: ${{ env.PACKAGE_NAME }} + path: ${{ env.PACKAGE_NAME }}.zip + + watchos-simulator: + needs: [setup] + runs-on: macos-13 + strategy: + matrix: + opencv-version: [2.4.13.7, 3.4.20, 4.9.0] + env: + COMMON_CMAKE_OPTIONS: | + -DCMAKE_TOOLCHAIN_FILE=../../toolchains/ios.toolchain.cmake \ + -DPLATFORM=SIMULATOR_WATCHOS \ + -DDEPLOYMENT_TARGET=$WATCHOS_DEPLOYMENT_TARGET \ + -DENABLE_BITCODE=$ENABLE_BITCODE \ + -DENABLE_ARC=$ENABLE_ARC \ + -DENABLE_VISIBILITY=$ENABLE_VISIBILITY \ + -DCMAKE_C_FLAGS="-fno-rtti -fno-exceptions" \ + -DCMAKE_CXX_FLAGS="-fno-rtti -fno-exceptions" \ + -DCMAKE_INSTALL_PREFIX=install \ + -DCMAKE_BUILD_TYPE=Release \ + steps: + - uses: actions/checkout@v4 + - uses: actions/download-artifact@v4 + with: + name: opencv-mobile-${{ matrix.opencv-version }}-source + - name: setup-opencv-source + run: | + unzip -q opencv-mobile-${{ matrix.opencv-version }}.zip + echo "SOURCE_DIR=opencv-mobile-${{ matrix.opencv-version }}" >> $GITHUB_ENV + echo "PACKAGE_NAME=opencv-mobile-${{ matrix.opencv-version }}-watchos-simulator" >> $GITHUB_ENV + - name: workaround-opencv2-list + if: matrix.opencv-version == '2.4.13.7' + run: | + # workaround ar @list issue on macos + sed -i -e 's!\\"${objpath4}\\"!${objpath4}!g' ${{ env.SOURCE_DIR }}/modules/world/CMakeLists.txt + - name: build-x86_64 + run: | + cd ${{ env.SOURCE_DIR }} + mkdir build-x86_64 && cd build-x86_64 + cmake ${{ env.COMMON_CMAKE_OPTIONS }} -DARCHS="x86_64" \ + `cat ../options.txt` -DBUILD_opencv_world=ON .. + # workaround ar @list issue on macos + cmake --build . -j 4 || { cd modules/world; $DEVELOPER_DIR/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar qc ../../lib/libopencv_world.a `cat world_objects.rsp` CMakeFiles/opencv_world.dir/src/world_init.cpp.o; cd ../..; } + cmake --build . --target install + - name: build-arm64 + run: | + cd ${{ env.SOURCE_DIR }} + mkdir build-arm64 && cd build-arm64 + cmake ${{ env.COMMON_CMAKE_OPTIONS }} -DARCHS="arm64" \ + `cat ../options.txt` -DBUILD_opencv_world=ON .. + # workaround ar @list issue on macos + cmake --build . -j 4 || { cd modules/world; $DEVELOPER_DIR/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar qc ../../lib/libopencv_world.a `cat world_objects.rsp` CMakeFiles/opencv_world.dir/src/world_init.cpp.o; cd ../..; } + cmake --build . --target install + - name: package + run: | + rm -rf opencv2.framework + mkdir -p opencv2.framework/Versions/A/Headers + mkdir -p opencv2.framework/Versions/A/Resources + ln -s A opencv2.framework/Versions/Current + ln -s Versions/Current/Headers opencv2.framework/Headers + ln -s Versions/Current/Resources opencv2.framework/Resources + ln -s Versions/Current/opencv2 opencv2.framework/opencv2 + lipo -create \ + ${{ env.SOURCE_DIR }}/build-x86_64/install/lib/libopencv_world.a \ + ${{ env.SOURCE_DIR }}/build-arm64/install/lib/libopencv_world.a \ + -o opencv2.framework/Versions/A/opencv2 + cp -r ${{ env.SOURCE_DIR }}/build-arm64/install/include/opencv4/opencv2/* opencv2.framework/Versions/A/Headers/ || : + cp -r ${{ env.SOURCE_DIR }}/build-arm64/install/include/opencv2/* opencv2.framework/Versions/A/Headers/ || : + cp ${{ env.SOURCE_DIR }}/Info.plist opencv2.framework/Versions/A/Resources/ + rm -f ${{ env.PACKAGE_NAME }}.zip + zip -9 -y -r ${{ env.PACKAGE_NAME }}.zip opencv2.framework + - name: test + run: | + cd test + mkdir build && cd build + cmake ${{ env.COMMON_CMAKE_OPTIONS }} -DARCHS="x86_64;arm64" \ + -DOpenCV_DIR=$GITHUB_WORKSPACE .. + cmake --build . -j 4 + - name: upload-zip + uses: actions/upload-artifact@v4 + with: + name: ${{ env.PACKAGE_NAME }} + path: ${{ env.PACKAGE_NAME }}.zip + + tvos: + needs: [setup] + runs-on: macos-13 + strategy: + matrix: + opencv-version: [2.4.13.7, 3.4.20, 4.9.0] + env: + COMMON_CMAKE_OPTIONS: | + -DCMAKE_TOOLCHAIN_FILE=../../toolchains/ios.toolchain.cmake \ + -DPLATFORM=TVOS \ + -DDEPLOYMENT_TARGET=$TVOS_DEPLOYMENT_TARGET \ + -DENABLE_BITCODE=$ENABLE_BITCODE \ + -DENABLE_ARC=$ENABLE_ARC \ + -DENABLE_VISIBILITY=$ENABLE_VISIBILITY \ + -DCMAKE_C_FLAGS="-fno-rtti -fno-exceptions" \ + -DCMAKE_CXX_FLAGS="-fno-rtti -fno-exceptions" \ + -DCMAKE_INSTALL_PREFIX=install \ + -DCMAKE_BUILD_TYPE=Release \ + steps: + - uses: actions/checkout@v4 + - uses: actions/download-artifact@v4 + with: + name: opencv-mobile-${{ matrix.opencv-version }}-source + - name: setup-opencv-source + run: | + unzip -q opencv-mobile-${{ matrix.opencv-version }}.zip + echo "SOURCE_DIR=opencv-mobile-${{ matrix.opencv-version }}" >> $GITHUB_ENV + echo "PACKAGE_NAME=opencv-mobile-${{ matrix.opencv-version }}-tvos" >> $GITHUB_ENV + - name: workaround-opencv2-list + if: matrix.opencv-version == '2.4.13.7' + run: | + # workaround ar @list issue on macos + sed -i -e 's!\\"${objpath4}\\"!${objpath4}!g' ${{ env.SOURCE_DIR }}/modules/world/CMakeLists.txt + - name: build-arm64 + run: | + cd ${{ env.SOURCE_DIR }} + mkdir build-arm64 && cd build-arm64 + cmake ${{ env.COMMON_CMAKE_OPTIONS }} -DARCHS="arm64" \ + `cat ../options.txt` -DBUILD_opencv_world=ON .. + # workaround ar @list issue on macos + cmake --build . -j 4 || { cd modules/world; $DEVELOPER_DIR/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar qc ../../lib/libopencv_world.a `cat world_objects.rsp` CMakeFiles/opencv_world.dir/src/world_init.cpp.o; cd ../..; } + cmake --build . --target install + - name: build-arm64e + run: | + cd ${{ env.SOURCE_DIR }} + mkdir build-arm64e && cd build-arm64e + cmake ${{ env.COMMON_CMAKE_OPTIONS }} -DARCHS="arm64e" \ + `cat ../options.txt` -DBUILD_opencv_world=ON .. + # workaround ar @list issue on macos + cmake --build . -j 4 || { cd modules/world; $DEVELOPER_DIR/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar qc ../../lib/libopencv_world.a `cat world_objects.rsp` CMakeFiles/opencv_world.dir/src/world_init.cpp.o; cd ../..; } + cmake --build . --target install + - name: package + run: | + rm -rf opencv2.framework + mkdir -p opencv2.framework/Versions/A/Headers + mkdir -p opencv2.framework/Versions/A/Resources + ln -s A opencv2.framework/Versions/Current + ln -s Versions/Current/Headers opencv2.framework/Headers + ln -s Versions/Current/Resources opencv2.framework/Resources + ln -s Versions/Current/opencv2 opencv2.framework/opencv2 + lipo -create \ + ${{ env.SOURCE_DIR }}/build-arm64/install/lib/libopencv_world.a \ + ${{ env.SOURCE_DIR }}/build-arm64e/install/lib/libopencv_world.a \ + -o opencv2.framework/Versions/A/opencv2 + cp -r ${{ env.SOURCE_DIR }}/build-arm64e/install/include/opencv4/opencv2/* opencv2.framework/Versions/A/Headers/ || : + cp -r ${{ env.SOURCE_DIR }}/build-arm64e/install/include/opencv2/* opencv2.framework/Versions/A/Headers/ || : + cp ${{ env.SOURCE_DIR }}/Info.plist opencv2.framework/Versions/A/Resources/ + rm -f ${{ env.PACKAGE_NAME }}.zip + zip -9 -y -r ${{ env.PACKAGE_NAME }}.zip opencv2.framework + - name: test + run: | + cd test + mkdir build && cd build + cmake ${{ env.COMMON_CMAKE_OPTIONS }} -DARCHS="arm64;arm64e" \ + -DOpenCV_DIR=$GITHUB_WORKSPACE .. + cmake --build . -j 4 + - name: upload-zip + uses: actions/upload-artifact@v4 + with: + name: ${{ env.PACKAGE_NAME }} + path: ${{ env.PACKAGE_NAME }}.zip + + tvos-simulator: + needs: [setup] + runs-on: macos-13 + strategy: + matrix: + opencv-version: [2.4.13.7, 3.4.20, 4.9.0] + env: + COMMON_CMAKE_OPTIONS: | + -DCMAKE_TOOLCHAIN_FILE=../../toolchains/ios.toolchain.cmake \ + -DPLATFORM=SIMULATOR_TVOS \ + -DDEPLOYMENT_TARGET=$TVOS_DEPLOYMENT_TARGET \ + -DENABLE_BITCODE=$ENABLE_BITCODE \ + -DENABLE_ARC=$ENABLE_ARC \ + -DENABLE_VISIBILITY=$ENABLE_VISIBILITY \ + -DCMAKE_C_FLAGS="-fno-rtti -fno-exceptions" \ + -DCMAKE_CXX_FLAGS="-fno-rtti -fno-exceptions" \ + -DCMAKE_INSTALL_PREFIX=install \ + -DCMAKE_BUILD_TYPE=Release \ + steps: + - uses: actions/checkout@v4 + - uses: actions/download-artifact@v4 + with: + name: opencv-mobile-${{ matrix.opencv-version }}-source + - name: setup-opencv-source + run: | + unzip -q opencv-mobile-${{ matrix.opencv-version }}.zip + echo "SOURCE_DIR=opencv-mobile-${{ matrix.opencv-version }}" >> $GITHUB_ENV + echo "PACKAGE_NAME=opencv-mobile-${{ matrix.opencv-version }}-tvos-simulator" >> $GITHUB_ENV + - name: workaround-opencv2-list + if: matrix.opencv-version == '2.4.13.7' + run: | + # workaround ar @list issue on macos + sed -i -e 's!\\"${objpath4}\\"!${objpath4}!g' ${{ env.SOURCE_DIR }}/modules/world/CMakeLists.txt + - name: build-x86_64 + run: | + cd ${{ env.SOURCE_DIR }} + mkdir build-x86_64 && cd build-x86_64 + cmake ${{ env.COMMON_CMAKE_OPTIONS }} -DARCHS="x86_64" \ + `cat ../options.txt` -DBUILD_opencv_world=ON .. + # workaround ar @list issue on macos + cmake --build . -j 4 || { cd modules/world; $DEVELOPER_DIR/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar qc ../../lib/libopencv_world.a `cat world_objects.rsp` CMakeFiles/opencv_world.dir/src/world_init.cpp.o; cd ../..; } + cmake --build . --target install + - name: build-arm64 + run: | + cd ${{ env.SOURCE_DIR }} + mkdir build-arm64 && cd build-arm64 + cmake ${{ env.COMMON_CMAKE_OPTIONS }} -DARCHS="arm64" \ + `cat ../options.txt` -DBUILD_opencv_world=ON .. + # workaround ar @list issue on macos + cmake --build . -j 4 || { cd modules/world; $DEVELOPER_DIR/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar qc ../../lib/libopencv_world.a `cat world_objects.rsp` CMakeFiles/opencv_world.dir/src/world_init.cpp.o; cd ../..; } + cmake --build . --target install + - name: package + run: | + rm -rf opencv2.framework + mkdir -p opencv2.framework/Versions/A/Headers + mkdir -p opencv2.framework/Versions/A/Resources + ln -s A opencv2.framework/Versions/Current + ln -s Versions/Current/Headers opencv2.framework/Headers + ln -s Versions/Current/Resources opencv2.framework/Resources + ln -s Versions/Current/opencv2 opencv2.framework/opencv2 + lipo -create \ + ${{ env.SOURCE_DIR }}/build-x86_64/install/lib/libopencv_world.a \ + ${{ env.SOURCE_DIR }}/build-arm64/install/lib/libopencv_world.a \ + -o opencv2.framework/Versions/A/opencv2 + cp -r ${{ env.SOURCE_DIR }}/build-arm64/install/include/opencv4/opencv2/* opencv2.framework/Versions/A/Headers/ || : + cp -r ${{ env.SOURCE_DIR }}/build-arm64/install/include/opencv2/* opencv2.framework/Versions/A/Headers/ || : + cp ${{ env.SOURCE_DIR }}/Info.plist opencv2.framework/Versions/A/Resources/ + rm -f ${{ env.PACKAGE_NAME }}.zip + zip -9 -y -r ${{ env.PACKAGE_NAME }}.zip opencv2.framework + - name: test + run: | + cd test + mkdir build && cd build + cmake ${{ env.COMMON_CMAKE_OPTIONS }} -DARCHS="x86_64;arm64" \ + -DOpenCV_DIR=$GITHUB_WORKSPACE .. + cmake --build . -j 4 + - name: upload-zip + uses: actions/upload-artifact@v4 + with: + name: ${{ env.PACKAGE_NAME }} + path: ${{ env.PACKAGE_NAME }}.zip + + visionos: + needs: [setup] + runs-on: macos-13 + strategy: + matrix: + opencv-version: [2.4.13.7, 3.4.20, 4.9.0] + env: + COMMON_CMAKE_OPTIONS: | + -DCMAKE_TOOLCHAIN_FILE=../../toolchains/ios.toolchain.cmake \ + -DPLATFORM=VISIONOS \ + -DDEPLOYMENT_TARGET=$VISIONOS_DEPLOYMENT_TARGET \ + -DENABLE_BITCODE=$ENABLE_BITCODE \ + -DENABLE_ARC=$ENABLE_ARC \ + -DENABLE_VISIBILITY=$ENABLE_VISIBILITY \ + -DCMAKE_C_FLAGS="-fno-rtti -fno-exceptions" \ + -DCMAKE_CXX_FLAGS="-fno-rtti -fno-exceptions" \ + -DCMAKE_INSTALL_PREFIX=install \ + -DCMAKE_BUILD_TYPE=Release \ + steps: + - uses: actions/checkout@v4 + - uses: actions/download-artifact@v4 + with: + name: opencv-mobile-${{ matrix.opencv-version }}-source + - name: setup-opencv-source + run: | + unzip -q opencv-mobile-${{ matrix.opencv-version }}.zip + echo "SOURCE_DIR=opencv-mobile-${{ matrix.opencv-version }}" >> $GITHUB_ENV + echo "PACKAGE_NAME=opencv-mobile-${{ matrix.opencv-version }}-visionos" >> $GITHUB_ENV + - name: workaround-opencv2-list + if: matrix.opencv-version == '2.4.13.7' + run: | + # workaround ar @list issue on macos + sed -i -e 's!\\"${objpath4}\\"!${objpath4}!g' ${{ env.SOURCE_DIR }}/modules/world/CMakeLists.txt + - name: build-arm64 + run: | + cd ${{ env.SOURCE_DIR }} + mkdir build-arm64 && cd build-arm64 + cmake ${{ env.COMMON_CMAKE_OPTIONS }} -DARCHS="arm64" \ + `cat ../options.txt` -DBUILD_opencv_world=ON .. + # workaround ar @list issue on macos + cmake --build . -j 4 || { cd modules/world; $DEVELOPER_DIR/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar qc ../../lib/libopencv_world.a `cat world_objects.rsp` CMakeFiles/opencv_world.dir/src/world_init.cpp.o; cd ../..; } + cmake --build . --target install + - name: package + run: | + rm -rf opencv2.framework + mkdir -p opencv2.framework/Versions/A/Headers + mkdir -p opencv2.framework/Versions/A/Resources + ln -s A opencv2.framework/Versions/Current + ln -s Versions/Current/Headers opencv2.framework/Headers + ln -s Versions/Current/Resources opencv2.framework/Resources + ln -s Versions/Current/opencv2 opencv2.framework/opencv2 + lipo -create \ + ${{ env.SOURCE_DIR }}/build-arm64/install/lib/libopencv_world.a \ + -o opencv2.framework/Versions/A/opencv2 + cp -r ${{ env.SOURCE_DIR }}/build-arm64/install/include/opencv4/opencv2/* opencv2.framework/Versions/A/Headers/ || : + cp -r ${{ env.SOURCE_DIR }}/build-arm64/install/include/opencv2/* opencv2.framework/Versions/A/Headers/ || : + cp ${{ env.SOURCE_DIR }}/Info.plist opencv2.framework/Versions/A/Resources/ + rm -f ${{ env.PACKAGE_NAME }}.zip + zip -9 -y -r ${{ env.PACKAGE_NAME }}.zip opencv2.framework + - name: test + run: | + cd test + mkdir build && cd build + cmake ${{ env.COMMON_CMAKE_OPTIONS }} -DARCHS="arm64" \ + -DOpenCV_DIR=$GITHUB_WORKSPACE .. + cmake --build . -j 4 + - name: upload-zip + uses: actions/upload-artifact@v4 + with: + name: ${{ env.PACKAGE_NAME }} + path: ${{ env.PACKAGE_NAME }}.zip + + visionos-simulator: + needs: [setup] + runs-on: macos-13 + strategy: + matrix: + opencv-version: [2.4.13.7, 3.4.20, 4.9.0] + env: + COMMON_CMAKE_OPTIONS: | + -DCMAKE_TOOLCHAIN_FILE=../../toolchains/ios.toolchain.cmake \ + -DPLATFORM=SIMULATOR_VISIONOS \ + -DDEPLOYMENT_TARGET=$VISIONOS_DEPLOYMENT_TARGET \ + -DENABLE_BITCODE=$ENABLE_BITCODE \ + -DENABLE_ARC=$ENABLE_ARC \ + -DENABLE_VISIBILITY=$ENABLE_VISIBILITY \ + -DCMAKE_C_FLAGS="-fno-rtti -fno-exceptions" \ + -DCMAKE_CXX_FLAGS="-fno-rtti -fno-exceptions" \ + -DCMAKE_INSTALL_PREFIX=install \ + -DCMAKE_BUILD_TYPE=Release \ + steps: + - uses: actions/checkout@v4 + - uses: actions/download-artifact@v4 + with: + name: opencv-mobile-${{ matrix.opencv-version }}-source + - name: setup-opencv-source + run: | + unzip -q opencv-mobile-${{ matrix.opencv-version }}.zip + echo "SOURCE_DIR=opencv-mobile-${{ matrix.opencv-version }}" >> $GITHUB_ENV + echo "PACKAGE_NAME=opencv-mobile-${{ matrix.opencv-version }}-visionos-simulator" >> $GITHUB_ENV + - name: workaround-opencv2-list + if: matrix.opencv-version == '2.4.13.7' + run: | + # workaround ar @list issue on macos + sed -i -e 's!\\"${objpath4}\\"!${objpath4}!g' ${{ env.SOURCE_DIR }}/modules/world/CMakeLists.txt + - name: build-x86_64 + run: | + cd ${{ env.SOURCE_DIR }} + mkdir build-x86_64 && cd build-x86_64 + cmake ${{ env.COMMON_CMAKE_OPTIONS }} -DARCHS="x86_64" \ + `cat ../options.txt` -DBUILD_opencv_world=ON .. + # workaround ar @list issue on macos + cmake --build . -j 4 || { cd modules/world; $DEVELOPER_DIR/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar qc ../../lib/libopencv_world.a `cat world_objects.rsp` CMakeFiles/opencv_world.dir/src/world_init.cpp.o; cd ../..; } + cmake --build . --target install + - name: build-arm64 + run: | + cd ${{ env.SOURCE_DIR }} + mkdir build-arm64 && cd build-arm64 + cmake ${{ env.COMMON_CMAKE_OPTIONS }} -DARCHS="arm64" \ + `cat ../options.txt` -DBUILD_opencv_world=ON .. + # workaround ar @list issue on macos + cmake --build . -j 4 || { cd modules/world; $DEVELOPER_DIR/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar qc ../../lib/libopencv_world.a `cat world_objects.rsp` CMakeFiles/opencv_world.dir/src/world_init.cpp.o; cd ../..; } + cmake --build . --target install + - name: package + run: | + rm -rf opencv2.framework + mkdir -p opencv2.framework/Versions/A/Headers + mkdir -p opencv2.framework/Versions/A/Resources + ln -s A opencv2.framework/Versions/Current + ln -s Versions/Current/Headers opencv2.framework/Headers + ln -s Versions/Current/Resources opencv2.framework/Resources + ln -s Versions/Current/opencv2 opencv2.framework/opencv2 + lipo -create \ + ${{ env.SOURCE_DIR }}/build-x86_64/install/lib/libopencv_world.a \ + ${{ env.SOURCE_DIR }}/build-arm64/install/lib/libopencv_world.a \ + -o opencv2.framework/Versions/A/opencv2 + cp -r ${{ env.SOURCE_DIR }}/build-arm64/install/include/opencv4/opencv2/* opencv2.framework/Versions/A/Headers/ || : + cp -r ${{ env.SOURCE_DIR }}/build-arm64/install/include/opencv2/* opencv2.framework/Versions/A/Headers/ || : + cp ${{ env.SOURCE_DIR }}/Info.plist opencv2.framework/Versions/A/Resources/ + rm -f ${{ env.PACKAGE_NAME }}.zip + zip -9 -y -r ${{ env.PACKAGE_NAME }}.zip opencv2.framework + - name: test + run: | + cd test + mkdir build && cd build + cmake ${{ env.COMMON_CMAKE_OPTIONS }} -DARCHS="x86_64;arm64" \ + -DOpenCV_DIR=$GITHUB_WORKSPACE .. + cmake --build . -j 4 + - name: upload-zip + uses: actions/upload-artifact@v4 + with: + name: ${{ env.PACKAGE_NAME }} + path: ${{ env.PACKAGE_NAME }}.zip + + windows: + needs: [setup] + strategy: + matrix: + opencv-version: [2.4.13.7, 3.4.20, 4.9.0] + os-compiler: + - { msvc-version: vs2015, windows-version: 2019, toolset-version: v140 } + - { msvc-version: vs2017, windows-version: 2019, toolset-version: v141 } + - { msvc-version: vs2019, windows-version: 2019, toolset-version: v142 } + - { msvc-version: vs2022, windows-version: 2022, toolset-version: v143 } + runs-on: windows-${{ matrix.os-compiler.windows-version }} + env: + UseMultiToolTask: true + COMMON_CMAKE_OPTIONS: -T ${{ matrix.os-compiler.toolset-version }},host=x64 -DCMAKE_INSTALL_PREFIX=install + steps: + - uses: actions/checkout@v4 + - uses: actions/download-artifact@v4 + with: + name: opencv-mobile-${{ matrix.opencv-version }}-source + - name: setup-opencv-source + run: | + unzip -q opencv-mobile-${{ matrix.opencv-version }}.zip + echo "SOURCE_DIR=opencv-mobile-${{ matrix.opencv-version }}" >> $env:GITHUB_ENV + echo "PACKAGE_NAME=opencv-mobile-${{ matrix.opencv-version }}-windows-${{ matrix.os-compiler.msvc-version }}" >> $env:GITHUB_ENV + - name: build-x86 + run: | + cd ${{ env.SOURCE_DIR }} + mkdir build-x86; cd build-x86 + cmake ${{ env.COMMON_CMAKE_OPTIONS }} -A Win32 $(type ../options.txt) -DBUILD_opencv_world=OFF .. + cmake --build . --config Release -j 4 + cmake --build . --config Release --target install + - name: build-x64 + run: | + cd ${{ env.SOURCE_DIR }} + mkdir build-x64; cd build-x64 + cmake ${{ env.COMMON_CMAKE_OPTIONS }} -A x64 $(type ../options.txt) -DBUILD_opencv_world=OFF .. + cmake --build . --config Release -j 4 + cmake --build . --config Release --target install + - name: package + run: | + mkdir ${{ env.PACKAGE_NAME }} + mkdir ${{ env.PACKAGE_NAME }}/x86 + mkdir ${{ env.PACKAGE_NAME }}/x64 + Copy-Item -Verbose -Recurse -Path "${{ env.SOURCE_DIR }}\build-x86\install\*" -Destination "${{ env.PACKAGE_NAME }}\x86" + Copy-Item -Verbose -Recurse -Path "${{ env.SOURCE_DIR }}\build-x64\install\*" -Destination "${{ env.PACKAGE_NAME }}\x64" + 7z a -r ${{ env.PACKAGE_NAME }}.zip ${{ env.PACKAGE_NAME }} + - name: test-x86 + run: | + cd test + mkdir build-x86; cd build-x86 + cmake ${{ env.COMMON_CMAKE_OPTIONS }} -A Win32 -DOpenCV_DIR="$env:GITHUB_WORKSPACE\${{ env.PACKAGE_NAME }}\x86" -DOpenCV_STATIC=ON .. + cmake --build . --config Release -j 4 + - name: test-x64 + run: | + cd test + mkdir build-x64; cd build-x64 + cmake ${{ env.COMMON_CMAKE_OPTIONS }} -A x64 -DOpenCV_DIR="$env:GITHUB_WORKSPACE\${{ env.PACKAGE_NAME }}\x64" -DOpenCV_STATIC=ON .. + cmake --build . --config Release -j 4 + - name: upload-zip + uses: actions/upload-artifact@v4 + with: + name: ${{ env.PACKAGE_NAME }} + path: ${{ env.PACKAGE_NAME }}.zip + + ubuntu: + needs: [setup] + strategy: + matrix: + opencv-version: [2.4.13.7, 3.4.20, 4.9.0] + os-ubuntu: + - { ubuntu-id: 2004, ubuntu-version: 20.04 } + - { ubuntu-id: 2204, ubuntu-version: 22.04 } + runs-on: ubuntu-${{ matrix.os-ubuntu.ubuntu-version }} + env: + COMMON_CMAKE_OPTIONS: -DCMAKE_INSTALL_PREFIX=install -DCMAKE_BUILD_TYPE=Release + steps: + - uses: actions/checkout@v4 + - uses: actions/download-artifact@v4 + with: + name: opencv-mobile-${{ matrix.opencv-version }}-source + - name: setup-opencv-source + run: | + unzip -q opencv-mobile-${{ matrix.opencv-version }}.zip + echo "SOURCE_DIR=opencv-mobile-${{ matrix.opencv-version }}" >> $GITHUB_ENV + echo "PACKAGE_NAME=opencv-mobile-${{ matrix.opencv-version }}-ubuntu-${{ matrix.os-ubuntu.ubuntu-id }}" >> $GITHUB_ENV + - name: build + run: | + cd ${{ env.SOURCE_DIR }} + mkdir build && cd build + cmake ${{ env.COMMON_CMAKE_OPTIONS }} `cat ../options.txt` -DBUILD_opencv_world=OFF .. + cmake --build . -j $(nproc) + cmake --build . --target install + - name: package + run: | + rm -rf ${{ env.PACKAGE_NAME }} + mkdir -p ${{ env.PACKAGE_NAME }} + cp -rf ${{ env.SOURCE_DIR }}/build/install/* ${{ env.PACKAGE_NAME }}/ + rm -f ${{ env.PACKAGE_NAME }}.zip + zip -9 -r ${{ env.PACKAGE_NAME }}.zip ${{ env.PACKAGE_NAME }} + - name: set-opencv-dir + if: matrix.opencv-version == '2.4.13.7' || matrix.opencv-version == '3.4.20' + run: echo "OPENCV_SUBDIR=share/OpenCV" >> $GITHUB_ENV + - name: set-opencv-dir + if: matrix.opencv-version == '4.9.0' + run: echo "OPENCV_SUBDIR=lib/cmake/opencv4" >> $GITHUB_ENV + - name: test + run: | + cd test + mkdir build && cd build + cmake ${{ env.COMMON_CMAKE_OPTIONS }} -DOpenCV_DIR=$GITHUB_WORKSPACE/${{ env.PACKAGE_NAME }}/${{ env.OPENCV_SUBDIR }} .. + cmake --build . -j $(nproc) + - name: upload + uses: actions/upload-artifact@v4 + with: + name: ${{ env.PACKAGE_NAME }} + path: ${{ env.PACKAGE_NAME }}.zip + + webassembly: + needs: [setup] + runs-on: ubuntu-20.04 + strategy: + matrix: + opencv-version: [2.4.13.7, 3.4.20, 4.9.0] + env: + COMMON_CMAKE_OPTIONS: | + -DCMAKE_TOOLCHAIN_FILE=../emsdk/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake \ + -DCMAKE_INSTALL_PREFIX=install \ + -DCMAKE_BUILD_TYPE=Release \ + steps: + - uses: actions/checkout@v4 + - name: emsdk + run: | + git clone https://github.com/emscripten-core/emsdk.git + cd emsdk + ./emsdk install $EMSCRIPTEN_VERSION + ./emsdk activate $EMSCRIPTEN_VERSION + - uses: actions/download-artifact@v4 + with: + name: opencv-mobile-${{ matrix.opencv-version }}-source + - name: setup-opencv-source + run: | + unzip -q opencv-mobile-${{ matrix.opencv-version }}.zip + echo "SOURCE_DIR=opencv-mobile-${{ matrix.opencv-version }}" >> $GITHUB_ENV + echo "PACKAGE_NAME=opencv-mobile-${{ matrix.opencv-version }}-webassembly" >> $GITHUB_ENV + - name: build + run: | + source emsdk/emsdk_env.sh + cd ${{ env.SOURCE_DIR }} + patch -p1 -i ../patches/opencv-${{ matrix.opencv-version }}-unsafe-xadd.patch + mkdir build && cd build + cmake ${{ env.COMMON_CMAKE_OPTIONS }} \ + -DCPU_BASELINE="" -DCPU_DISPATCH="" -DWITH_PTHREADS_PF=OFF -DCV_ENABLE_INTRINSICS=OFF -DBUILD_WASM_INTRIN_TESTS=OFF \ + -DCMAKE_C_FLAGS="-fno-rtti -fno-exceptions -s WASM=1 -s USE_PTHREADS=0" \ + -DCMAKE_CXX_FLAGS="-fno-rtti -fno-exceptions -s WASM=1 -s USE_PTHREADS=0" \ + `cat ../options.txt` -DBUILD_opencv_world=OFF -DOPENCV_DISABLE_FILESYSTEM_SUPPORT=ON .. + cmake --build . -j $(nproc) + cmake --build . --target install + - name: build-simd + run: | + source emsdk/emsdk_env.sh + cd ${{ env.SOURCE_DIR }} + mkdir build-simd && cd build-simd + cmake ${{ env.COMMON_CMAKE_OPTIONS }} \ + -DCPU_BASELINE="" -DCPU_DISPATCH="" -DWITH_PTHREADS_PF=OFF -DCV_ENABLE_INTRINSICS=ON -DBUILD_WASM_INTRIN_TESTS=OFF \ + -DCMAKE_C_FLAGS="-fno-rtti -fno-exceptions -s WASM=1 -s USE_PTHREADS=0 -msimd128" \ + -DCMAKE_CXX_FLAGS="-fno-rtti -fno-exceptions -s WASM=1 -s USE_PTHREADS=0 -msimd128" \ + `cat ../options.txt` -DBUILD_opencv_world=OFF -DOPENCV_DISABLE_FILESYSTEM_SUPPORT=ON .. + cmake --build . -j $(nproc) + cmake --build . --target install + - name: build-threads + run: | + source emsdk/emsdk_env.sh + cd ${{ env.SOURCE_DIR }} + patch -p1 -R -i ../patches/opencv-${{ matrix.opencv-version }}-unsafe-xadd.patch + mkdir build-threads && cd build-threads + cmake ${{ env.COMMON_CMAKE_OPTIONS }} \ + -DCPU_BASELINE="" -DCPU_DISPATCH="" -DWITH_PTHREADS_PF=ON -DCV_ENABLE_INTRINSICS=OFF -DBUILD_WASM_INTRIN_TESTS=OFF \ + -DCMAKE_C_FLAGS="-fno-rtti -fno-exceptions -s WASM=1 -s USE_PTHREADS=1 -s PTHREAD_POOL_SIZE=4" \ + -DCMAKE_CXX_FLAGS="-fno-rtti -fno-exceptions -s WASM=1 -s USE_PTHREADS=1 -s PTHREAD_POOL_SIZE=4" \ + `cat ../options.txt` -DBUILD_opencv_world=OFF -DOPENCV_DISABLE_FILESYSTEM_SUPPORT=ON .. + cmake --build . -j $(nproc) + cmake --build . --target install + - name: build-simd-threads + run: | + source emsdk/emsdk_env.sh + cd ${{ env.SOURCE_DIR }} + mkdir build-simd-threads && cd build-simd-threads + cmake ${{ env.COMMON_CMAKE_OPTIONS }} \ + -DCPU_BASELINE="" -DCPU_DISPATCH="" -DWITH_PTHREADS_PF=ON -DCV_ENABLE_INTRINSICS=ON -DBUILD_WASM_INTRIN_TESTS=OFF \ + -DCMAKE_C_FLAGS="-fno-rtti -fno-exceptions -s WASM=1 -s USE_PTHREADS=1 -s PTHREAD_POOL_SIZE=4 -msimd128" \ + -DCMAKE_CXX_FLAGS="-fno-rtti -fno-exceptions -s WASM=1 -s USE_PTHREADS=1 -s PTHREAD_POOL_SIZE=4 -msimd128" \ + `cat ../options.txt` -DBUILD_opencv_world=OFF -DOPENCV_DISABLE_FILESYSTEM_SUPPORT=ON .. + cmake --build . -j $(nproc) + cmake --build . --target install + - name: package + run: | + rm -rf ${{ env.PACKAGE_NAME }} + mkdir -p ${{ env.PACKAGE_NAME }} + cp -rf ${{ env.SOURCE_DIR }}/build/install ${{ env.PACKAGE_NAME }}/basic + cp -rf ${{ env.SOURCE_DIR }}/build-simd/install ${{ env.PACKAGE_NAME }}/simd + cp -rf ${{ env.SOURCE_DIR }}/build-threads/install ${{ env.PACKAGE_NAME }}/threads + cp -rf ${{ env.SOURCE_DIR }}/build-simd-threads/install ${{ env.PACKAGE_NAME }}/simd-threads + rm -f ${{ env.PACKAGE_NAME }}.zip + zip -9 -r ${{ env.PACKAGE_NAME }}.zip ${{ env.PACKAGE_NAME }} + - name: set-opencv-dir + if: matrix.opencv-version == '2.4.13.7' || matrix.opencv-version == '3.4.20' + run: echo "OPENCV_SUBDIR=share/OpenCV" >> $GITHUB_ENV + - name: set-opencv-dir + if: matrix.opencv-version == '4.9.0' + run: echo "OPENCV_SUBDIR=lib/cmake/opencv4" >> $GITHUB_ENV + - name: test + run: | + cd test + mkdir build && cd build + cmake ${{ env.COMMON_CMAKE_OPTIONS }} \ + -DCMAKE_C_FLAGS="-fno-rtti -fno-exceptions -s WASM=1 -s USE_PTHREADS=0" \ + -DCMAKE_CXX_FLAGS="-fno-rtti -fno-exceptions -s WASM=1 -s USE_PTHREADS=0" \ + -DOpenCV_DIR=$GITHUB_WORKSPACE/${{ env.PACKAGE_NAME }}/basic/${{ env.OPENCV_SUBDIR }} .. + cmake --build . -j $(nproc) + - name: test-simd + run: | + cd test + mkdir build-simd && cd build-simd + cmake ${{ env.COMMON_CMAKE_OPTIONS }} \ + -DCMAKE_C_FLAGS="-fno-rtti -fno-exceptions -s WASM=1 -s USE_PTHREADS=0 -msimd128" \ + -DCMAKE_CXX_FLAGS="-fno-rtti -fno-exceptions -s WASM=1 -s USE_PTHREADS=0 -msimd128" \ + -DOpenCV_DIR=$GITHUB_WORKSPACE/${{ env.PACKAGE_NAME }}/simd/${{ env.OPENCV_SUBDIR }} .. + cmake --build . -j $(nproc) + - name: test-threads + run: | + cd test + mkdir build-threads && cd build-threads + cmake ${{ env.COMMON_CMAKE_OPTIONS }} \ + -DCMAKE_C_FLAGS="-fno-rtti -fno-exceptions -s WASM=1 -s USE_PTHREADS=1 -s PTHREAD_POOL_SIZE=4" \ + -DCMAKE_CXX_FLAGS="-fno-rtti -fno-exceptions -s WASM=1 -s USE_PTHREADS=1 -s PTHREAD_POOL_SIZE=4" \ + -DOpenCV_DIR=$GITHUB_WORKSPACE/${{ env.PACKAGE_NAME }}/threads/${{ env.OPENCV_SUBDIR }} .. + cmake --build . -j $(nproc) + - name: test-simd-threads + run: | + cd test + mkdir build-simd-threads && cd build-simd-threads + cmake ${{ env.COMMON_CMAKE_OPTIONS }} \ + -DCMAKE_C_FLAGS="-fno-rtti -fno-exceptions -s WASM=1 -s USE_PTHREADS=1 -s PTHREAD_POOL_SIZE=4 -msimd128" \ + -DCMAKE_CXX_FLAGS="-fno-rtti -fno-exceptions -s WASM=1 -s USE_PTHREADS=1 -s PTHREAD_POOL_SIZE=4 -msimd128" \ + -DOpenCV_DIR=$GITHUB_WORKSPACE/${{ env.PACKAGE_NAME }}/simd-threads/${{ env.OPENCV_SUBDIR }} .. + cmake --build . -j $(nproc) + - name: upload + uses: actions/upload-artifact@v4 + with: + name: ${{ env.PACKAGE_NAME }} + path: ${{ env.PACKAGE_NAME }}.zip + + apple: + needs: [macos, ios, ios-simulator, mac-catalyst, watchos, watchos-simulator, tvos, tvos-simulator, visionos, visionos-simulator] + runs-on: macos-13 + strategy: + matrix: + opencv-version: [2.4.13.7, 3.4.20, 4.9.0] + steps: + - run: sudo xcode-select --switch /Applications/Xcode_15.2.app + - uses: actions/checkout@v4 + - name: setup-opencv-package + run: | + echo "MACOS_PACKAGE_NAME=opencv-mobile-${{ matrix.opencv-version }}-macos" >> $GITHUB_ENV + echo "IOS_PACKAGE_NAME=opencv-mobile-${{ matrix.opencv-version }}-ios" >> $GITHUB_ENV + echo "IOS_SIMULATOR_PACKAGE_NAME=opencv-mobile-${{ matrix.opencv-version }}-ios-simulator" >> $GITHUB_ENV + echo "MAC_CATALYST_PACKAGE_NAME=opencv-mobile-${{ matrix.opencv-version }}-mac-catalyst" >> $GITHUB_ENV + echo "WATCHOS_PACKAGE_NAME=opencv-mobile-${{ matrix.opencv-version }}-watchos" >> $GITHUB_ENV + echo "WATCHOS_SIMULATOR_PACKAGE_NAME=opencv-mobile-${{ matrix.opencv-version }}-watchos-simulator" >> $GITHUB_ENV + echo "TVOS_PACKAGE_NAME=opencv-mobile-${{ matrix.opencv-version }}-tvos" >> $GITHUB_ENV + echo "TVOS_SIMULATOR_PACKAGE_NAME=opencv-mobile-${{ matrix.opencv-version }}-tvos-simulator" >> $GITHUB_ENV + echo "VISIONOS_PACKAGE_NAME=opencv-mobile-${{ matrix.opencv-version }}-visionos" >> $GITHUB_ENV + echo "VISIONOS_SIMULATOR_PACKAGE_NAME=opencv-mobile-${{ matrix.opencv-version }}-visionos-simulator" >> $GITHUB_ENV + echo "PACKAGE_NAME=opencv-mobile-${{ matrix.opencv-version }}-apple" >> $GITHUB_ENV + - name: download-macos-package + uses: actions/download-artifact@v4 + with: + name: ${{ env.MACOS_PACKAGE_NAME }} + - name: download-ios-package + uses: actions/download-artifact@v4 + with: + name: ${{ env.IOS_PACKAGE_NAME }} + - name: download-ios-simulator-package + uses: actions/download-artifact@v4 + with: + name: ${{ env.IOS_SIMULATOR_PACKAGE_NAME }} + - name: download-mac-catalyst-package + uses: actions/download-artifact@v4 + with: + name: ${{ env.MAC_CATALYST_PACKAGE_NAME }} + - name: download-watchos-package + uses: actions/download-artifact@v4 + with: + name: ${{ env.WATCHOS_PACKAGE_NAME }} + - name: download-watchos-simulator-package + uses: actions/download-artifact@v4 + with: + name: ${{ env.WATCHOS_SIMULATOR_PACKAGE_NAME }} + - name: download-tvos-package + uses: actions/download-artifact@v4 + with: + name: ${{ env.TVOS_PACKAGE_NAME }} + - name: download-tvos-simulator-package + uses: actions/download-artifact@v4 + with: + name: ${{ env.TVOS_SIMULATOR_PACKAGE_NAME }} + - name: download-visionos-package + uses: actions/download-artifact@v4 + with: + name: ${{ env.VISIONOS_PACKAGE_NAME }} + - name: download-visionos-simulator-package + uses: actions/download-artifact@v4 + with: + name: ${{ env.VISIONOS_SIMULATOR_PACKAGE_NAME }} + - name: create-xcframwork + run: | + mkdir -p ${{ env.MACOS_PACKAGE_NAME }} + mkdir -p ${{ env.IOS_PACKAGE_NAME }} + mkdir -p ${{ env.IOS_SIMULATOR_PACKAGE_NAME }} + mkdir -p ${{ env.MAC_CATALYST_PACKAGE_NAME }} + mkdir -p ${{ env.WATCHOS_PACKAGE_NAME }} + mkdir -p ${{ env.WATCHOS_SIMULATOR_PACKAGE_NAME }} + mkdir -p ${{ env.TVOS_PACKAGE_NAME }} + mkdir -p ${{ env.TVOS_SIMULATOR_PACKAGE_NAME }} + mkdir -p ${{ env.VISIONOS_PACKAGE_NAME }} + mkdir -p ${{ env.VISIONOS_SIMULATOR_PACKAGE_NAME }} + unzip -q ${{ env.MACOS_PACKAGE_NAME }}.zip -d ${{ env.MACOS_PACKAGE_NAME }} + unzip -q ${{ env.IOS_PACKAGE_NAME }}.zip -d ${{ env.IOS_PACKAGE_NAME }} + unzip -q ${{ env.IOS_SIMULATOR_PACKAGE_NAME }}.zip -d ${{ env.IOS_SIMULATOR_PACKAGE_NAME }} + unzip -q ${{ env.MAC_CATALYST_PACKAGE_NAME }}.zip -d ${{ env.MAC_CATALYST_PACKAGE_NAME }} + unzip -q ${{ env.WATCHOS_PACKAGE_NAME }}.zip -d ${{ env.WATCHOS_PACKAGE_NAME }} + unzip -q ${{ env.WATCHOS_SIMULATOR_PACKAGE_NAME }}.zip -d ${{ env.WATCHOS_SIMULATOR_PACKAGE_NAME }} + unzip -q ${{ env.TVOS_PACKAGE_NAME }}.zip -d ${{ env.TVOS_PACKAGE_NAME }} + unzip -q ${{ env.TVOS_SIMULATOR_PACKAGE_NAME }}.zip -d ${{ env.TVOS_SIMULATOR_PACKAGE_NAME }} + unzip -q ${{ env.VISIONOS_PACKAGE_NAME }}.zip -d ${{ env.VISIONOS_PACKAGE_NAME }} + unzip -q ${{ env.VISIONOS_SIMULATOR_PACKAGE_NAME }}.zip -d ${{ env.VISIONOS_SIMULATOR_PACKAGE_NAME }} + xcodebuild -create-xcframework \ + -framework ${{ env.MACOS_PACKAGE_NAME }}/opencv2.framework \ + -framework ${{ env.IOS_PACKAGE_NAME }}/opencv2.framework \ + -framework ${{ env.IOS_SIMULATOR_PACKAGE_NAME }}/opencv2.framework \ + -framework ${{ env.MAC_CATALYST_PACKAGE_NAME }}/opencv2.framework \ + -framework ${{ env.WATCHOS_PACKAGE_NAME }}/opencv2.framework \ + -framework ${{ env.WATCHOS_SIMULATOR_PACKAGE_NAME }}/opencv2.framework \ + -framework ${{ env.TVOS_PACKAGE_NAME }}/opencv2.framework \ + -framework ${{ env.TVOS_SIMULATOR_PACKAGE_NAME }}/opencv2.framework \ + -framework ${{ env.VISIONOS_PACKAGE_NAME }}/opencv2.framework \ + -framework ${{ env.VISIONOS_SIMULATOR_PACKAGE_NAME }}/opencv2.framework \ + -output opencv2.xcframework + rm -f ${{ env.PACKAGE_NAME }}.zip + zip -9 -y -r ${{ env.PACKAGE_NAME }}.zip opencv2.xcframework + - name: upload-zip + uses: actions/upload-artifact@v4 + with: + name: ${{ env.PACKAGE_NAME }} + path: ${{ env.PACKAGE_NAME }}.zip + + devboard: + needs: [setup] + runs-on: ubuntu-latest + strategy: + matrix: + include: + - name: milkv-duo + single-core: true + cmake-toolchain: riscv64-unknown-linux-musl.toolchain.cmake + setup-toolchain-cmd: | + wget -q https://sophon-file.sophon.cn/sophon-prod-s3/drive/23/03/07/16/host-tools.tar.gz + tar -xf host-tools.tar.gz + setup-env-cmd: | + export RISCV_ROOT_PATH=$GITHUB_WORKSPACE/host-tools/gcc/riscv64-linux-musl-x86_64 + cmake-options: -DWITH_CVI=ON + + - name: licheerv-nano + single-core: true + cmake-toolchain: riscv64-unknown-linux-musl.toolchain.cmake + setup-toolchain-cmd: | + wget -q https://sophon-file.sophon.cn/sophon-prod-s3/drive/23/03/07/16/host-tools.tar.gz + tar -xf host-tools.tar.gz + setup-env-cmd: | + export RISCV_ROOT_PATH=$GITHUB_WORKSPACE/host-tools/gcc/riscv64-linux-musl-x86_64 + cmake-options: -DWITH_CVI=ON + + - name: luckfox-pico + single-core: true + cmake-toolchain: arm-rockchip830-linux-uclibcgnueabihf.toolchain.cmake + setup-toolchain-cmd: | + git clone --depth 1 https://github.com/LuckfoxTECH/luckfox-pico.git luckfox-pico + setup-env-cmd: | + export TOOLCHAIN_ROOT_PATH=$GITHUB_WORKSPACE/luckfox-pico/tools/linux/toolchain/arm-rockchip830-linux-uclibcgnueabihf + cmake-options: -DWITH_RK=ON + + - name: yuzuki-lizard + single-core: true + cmake-toolchain: arm-openwrt-linux-muslgnueabi.toolchain.cmake + setup-toolchain-cmd: | + wget -q https://github.com/YuzukiHD/Yuzukilizard/releases/download/Toolchains/toolchain-sunxi-musl-gcc-830.tar.gz + tar -xf toolchain-sunxi-musl-gcc-830.tar.gz + setup-env-cmd: | + export TOOLCHAIN_ROOT_PATH=$GITHUB_WORKSPACE/toolchain-sunxi-musl-gcc-830/toolchain + export STAGING_DIR=$GITHUB_WORKSPACE/toolchain-sunxi-musl-gcc-830/toolchain + cmake-options: -DWITH_AW=ON + + - name: tinyvision + single-core: true + cmake-toolchain: arm-openwrt-linux-muslgnueabi.toolchain.cmake + setup-toolchain-cmd: | + wget -q https://github.com/YuzukiHD/Yuzukilizard/releases/download/Toolchains/toolchain-sunxi-musl-gcc-830.tar.gz + tar -xf toolchain-sunxi-musl-gcc-830.tar.gz + setup-env-cmd: | + export TOOLCHAIN_ROOT_PATH=$GITHUB_WORKSPACE/toolchain-sunxi-musl-gcc-830/toolchain + export STAGING_DIR=$GITHUB_WORKSPACE/toolchain-sunxi-musl-gcc-830/toolchain + cmake-options: -DWITH_AW=ON + + - name: yuzuki-chameleon + single-core: false + cmake-toolchain: arm-openwrt-linux-gnueabi.toolchain.cmake + setup-toolchain-cmd: | + wget -q https://github.com/YuzukiHD/YuzukiChameleon/releases/download/0.0.1/toolchain-sunxi-glibc-arm.tar.gz + tar -xf toolchain-sunxi-glibc-arm.tar.gz + setup-env-cmd: | + export TOOLCHAIN_ROOT_PATH=$GITHUB_WORKSPACE/toolchain + export STAGING_DIR=$GITHUB_WORKSPACE/toolchain + cmake-options: -DWITH_AW=ON + + - name: purple-pi + single-core: false + cmake-toolchain: arm-linux-gnueabihf.toolchain.cmake + setup-toolchain-cmd: | + git clone --depth 1 https://github.com/industio/PurPle-Pi-R1.git + cd PurPle-Pi-R1/toolchain + sh install_toolchain.sh + setup-env-cmd: | + export PATH=$PATH:$GITHUB_WORKSPACE/PurPle-Pi-R1/toolchain/gcc-arm-8.2-2018.08-x86_64-arm-linux-gnueabihf/bin + cmake-options: + + - name: myir-t113i + single-core: false + cmake-toolchain: arm-linux-gnueabi.toolchain.cmake + setup-toolchain-cmd: | + git clone --depth 1 https://github.com/MYIR-ALLWINNER/toolchain.git + setup-env-cmd: | + export PATH=$PATH:$GITHUB_WORKSPACE/toolchain/gcc-linaro-7.2.1-2017.11-x86_64_arm-linux-gnueabi/bin + cmake-options: -DWITH_AW=ON + + env: + COMMON_CMAKE_OPTIONS: | + -DCMAKE_TOOLCHAIN_FILE=../../toolchains/${{ matrix.cmake-toolchain }} \ + -DCMAKE_C_FLAGS="-fno-rtti -fno-exceptions" \ + -DCMAKE_CXX_FLAGS="-fno-rtti -fno-exceptions" \ + -DCMAKE_INSTALL_PREFIX=install \ + -DCMAKE_BUILD_TYPE=Release \ + + steps: + - uses: actions/checkout@v4 + - uses: actions/download-artifact@v4 + with: + name: opencv-mobile-4.9.0-source + - name: setup-opencv-source + run: | + unzip -q opencv-mobile-4.9.0.zip + echo "SOURCE_DIR=opencv-mobile-4.9.0" >> $GITHUB_ENV + echo "PACKAGE_NAME=opencv-mobile-4.9.0-${{ matrix.name }}" >> $GITHUB_ENV + - name: setup-toolchain + run: ${{ matrix.setup-toolchain-cmd }} + + - name: build-disable-thread + if: ${{ matrix.single-core }} + run: | + cd ${{ env.SOURCE_DIR }} + patch -p1 -i ../patches/opencv-4.9.0-no-atomic.patch + mkdir build && cd build + ${{ matrix.setup-env-cmd }} + cmake ${{ env.COMMON_CMAKE_OPTIONS }} ${{ matrix.cmake-options }} \ + `cat ../options.txt` -DBUILD_opencv_world=OFF -DOPENCV_DISABLE_FILESYSTEM_SUPPORT=ON \ + -DWITH_OPENMP=OFF -DOPENCV_DISABLE_THREAD_SUPPORT=ON .. + cmake --build . -j $(nproc) + cmake --build . --target install + + - name: build-enable-thread + if: ${{ ! matrix.single-core }} + run: | + cd ${{ env.SOURCE_DIR }} + mkdir build && cd build + ${{ matrix.setup-env-cmd }} + cmake ${{ env.COMMON_CMAKE_OPTIONS }} ${{ matrix.cmake-options }} \ + `cat ../options.txt` -DBUILD_opencv_world=OFF -DOPENCV_DISABLE_FILESYSTEM_SUPPORT=ON .. + cmake --build . -j $(nproc) + cmake --build . --target install + + - name: package + run: | + mkdir ${{ env.PACKAGE_NAME }} + cp -rf ${{ env.SOURCE_DIR }}/build/install/* ${{ env.PACKAGE_NAME }}/ + zip -9 -r ${{ env.PACKAGE_NAME }}.zip ${{ env.PACKAGE_NAME }} + + - name: test + run: | + cd test + mkdir build && cd build + ${{ matrix.setup-env-cmd }} + cmake ${{ env.COMMON_CMAKE_OPTIONS }} -DOpenCV_DIR=$GITHUB_WORKSPACE/${{ env.PACKAGE_NAME }}/lib/cmake/opencv4 .. + cmake --build . -j $(nproc) + + - name: upload-zip + uses: actions/upload-artifact@v4 + with: + name: ${{ env.PACKAGE_NAME }} + path: ${{ env.PACKAGE_NAME }}.zip