From c6225c9d216f277408378c04b36ff347d12295e3 Mon Sep 17 00:00:00 2001 From: nihui Date: Sun, 3 Dec 2023 22:19:56 +0800 Subject: [PATCH] build it --- .github/workflows/test.yml | 61 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..29790514 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,61 @@ +name: test +on: [push, pull_request] + +permissions: + contents: read + +jobs: + luckfox-pico-opencv4: + runs-on: ubuntu-latest + env: + OPENCV_VERSION: 4.8.1 + PACKAGENAME: opencv-mobile-4.8.1-luckfox-pico + steps: + - uses: actions/checkout@v3 + - name: toolchain + run: | + git clone --depth 1 https://github.com/LuckfoxTECH/luckfox-pico.git luckfox-pico + - name: opencv-source + 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 + cd opencv-${{ env.OPENCV_VERSION }} + truncate -s 0 cmake/OpenCVFindLibsGrfmt.cmake + rm -rf modules/gapi + patch -p1 -i ../opencv-4.8.1-no-rtti.patch + patch -p1 -i ../opencv-4.8.1-no-zlib.patch + patch -p1 -i ../opencv-4.8.1-no-atomic.patch + patch -p1 -i ../opencv-4.8.1-link-openmp.patch + rm -rf modules/highgui + cp -r ../highgui modules/ + - name: build + run: | + cd opencv-${{ env.OPENCV_VERSION }} + mkdir build && cd build + export TOOLCHAIN_ROOT_PATH=$GITHUB_WORKSPACE/luckfox-pico/tools/linux/toolchain/arm-rockchip830-linux-uclibcgnueabihf + cmake -DCMAKE_TOOLCHAIN_FILE=../../toolchains/arm-rockchip830-linux-uclibcgnueabihf.toolchain.cmake \ + -DCMAKE_C_FLAGS="-fno-rtti -fno-exceptions" -DCMAKE_CXX_FLAGS="-fno-rtti -fno-exceptions" \ + -DCMAKE_INSTALL_PREFIX=install -DCMAKE_BUILD_TYPE=Release `cat ../../opencv4_cmake_options.txt` -DBUILD_opencv_world=OFF \ + -DOPENCV_DISABLE_FILESYSTEM_SUPPORT=ON -DWITH_OPENMP=OFF -DOPENCV_DISABLE_THREAD_SUPPORT=ON .. + cmake --build . -j 2 + cmake --build . --target install + - name: package + run: | + mkdir ${{ env.PACKAGENAME }} + cp -rf opencv-${{ env.OPENCV_VERSION }}/build/install/* ${{ env.PACKAGENAME }}/ + rm -rf ${{ env.PACKAGENAME }}/share/opencv4 + zip -9 -r ${{ env.PACKAGENAME }}.zip ${{ env.PACKAGENAME }} + - name: test + run: | + cd test + mkdir build && cd build + export TOOLCHAIN_ROOT_PATH=$GITHUB_WORKSPACE/luckfox-pico/tools/linux/toolchain/arm-rockchip830-linux-uclibcgnueabihf + cmake -DCMAKE_TOOLCHAIN_FILE=../../toolchains/arm-rockchip830-linux-uclibcgnueabihf.toolchain.cmake \ + -DCMAKE_C_FLAGS="-fno-rtti -fno-exceptions" -DCMAKE_CXX_FLAGS="-fno-rtti -fno-exceptions" \ + -DCMAKE_BUILD_TYPE=Release -DOpenCV_DIR=$GITHUB_WORKSPACE/${{ env.PACKAGENAME }}/lib/cmake/opencv4 .. + cmake --build . -j 2 + - name: upload + uses: actions/upload-artifact@v3 + with: + name: ${{ env.PACKAGENAME }} + path: ${{ env.PACKAGENAME }}.zip