-
Notifications
You must be signed in to change notification settings - Fork 867
91 lines (88 loc) · 4.35 KB
/
windows.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
name: Windows
on:
pull_request:
push:
branches:
- dev
- release
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build-windows:
runs-on: windows-2022
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: '1.22'
cache: true
- name: Restore cached OpenCV source
uses: actions/cache/restore@v4
id: cache-opencv-source
with:
key: opencv-source-490-windows-v1a
path: |
./opencv/opencv-4.9.0
./opencv/opencv_contrib-4.9.0
- name: Download OpenCV source
if: steps.cache-opencv-source.outputs.cache-hit != 'true'
shell: bash
run: |
mkdir -p ./opencv
curl -Lo ./opencv/opencv-4.9.0.zip https://github.com/opencv/opencv/archive/4.9.0.zip
curl -Lo ./opencv/opencv_contrib-4.9.0.zip https://github.com/opencv/opencv_contrib/archive/4.9.0.zip
- name: Extract OpenCV source
if: steps.cache-opencv-source.outputs.cache-hit != 'true'
shell: bash
run: |
cd ./opencv
mkdir -p opencv-4.9.0
mkdir -p opencv_contrib-4.9.0
7z x opencv-4.9.0.zip
7z x opencv_contrib-4.9.0.zip
- name: Save cached OpenCV source
uses: actions/cache/save@v4
if: steps.cache-opencv-source.outputs.cache-hit != 'true'
with:
key: ${{ steps.cache-opencv-source.outputs.cache-primary-key }}
path: |
./opencv/opencv-4.9.0
./opencv/opencv_contrib-4.9.0
- name: Restore cached OpenCV build
uses: actions/cache/restore@v4
id: cache-opencv-build
with:
key: opencv-build-490-windows-v1c
path: |
./opencv/build
- name: Build OpenCV
if: steps.cache-opencv-build.outputs.cache-hit != 'true'
run: |
mkdir -p ./opencv/build
cd ./opencv/build
cmake -G "MinGW Makefiles" -DENABLE_CXX11=ON -DOPENCV_EXTRA_MODULES_PATH="../opencv_contrib-4.9.0/modules" -DBUILD_SHARED_LIBS=ON -DWITH_IPP=OFF -DWITH_MSMF=OFF -DBUILD_EXAMPLES=OFF -DBUILD_TESTS=OFF -DBUILD_PERF_TESTS=ON -DBUILD_opencv_java=OFF -DBUILD_opencv_python=OFF -DBUILD_opencv_python2=OFF -DBUILD_opencv_python3=OFF -DBUILD_DOCS=OFF -DENABLE_PRECOMPILED_HEADERS=OFF -DBUILD_opencv_saliency=OFF -DBUILD_opencv_wechat_qrcode=ON -DCPU_DISPATCH= -DOPENCV_GENERATE_PKGCONFIG=ON -DWITH_OPENCL_D3D11_NV=OFF -DOPENCV_ALLOCATOR_STATS_COUNTER_TYPE=int64_t -Wno-dev ../opencv-4.9.0
cmake --build . --target install
- name: Save cached OpenCV build
uses: actions/cache/save@v4
if: steps.cache-opencv-build.outputs.cache-hit != 'true'
with:
key: ${{ steps.cache-opencv-build.outputs.cache-primary-key }}
path: |
./opencv/build
- name: Test GoCV
shell: bash
run: |
export CGO_CXXFLAGS="--std=c++11"
export CGO_CPPFLAGS="-ID:/a/gocv/gocv/opencv/build/install/include"
export CGO_LDFLAGS="-LD:/a/gocv/gocv/opencv/build/install/x64/mingw/lib -lopencv_core490 -lopencv_face490 -lopencv_videoio490 -lopencv_imgproc490 -lopencv_highgui490 -lopencv_imgcodecs490 -lopencv_objdetect490 -lopencv_features2d490 -lopencv_video490 -lopencv_dnn490 -lopencv_xfeatures2d490 -lopencv_plot490 -lopencv_tracking490 -lopencv_img_hash490 -lopencv_calib3d490 -lopencv_bgsegm490 -lopencv_photo490 -lopencv_aruco490 -lopencv_wechat_qrcode490 -lopencv_ximgproc490"
go test -v -tags matprofile .
- name: Test GoCV Contrib
shell: bash
run: |
export CGO_CXXFLAGS="--std=c++11"
export CGO_CPPFLAGS="-ID:/a/gocv/gocv/opencv/build/install/include"
export CGO_LDFLAGS="-LD:/a/gocv/gocv/opencv/build/install/x64/mingw/lib -lopencv_core490 -lopencv_face490 -lopencv_videoio490 -lopencv_imgproc490 -lopencv_highgui490 -lopencv_imgcodecs490 -lopencv_objdetect490 -lopencv_features2d490 -lopencv_video490 -lopencv_dnn490 -lopencv_xfeatures2d490 -lopencv_plot490 -lopencv_tracking490 -lopencv_img_hash490 -lopencv_calib3d490 -lopencv_bgsegm490 -lopencv_photo490 -lopencv_aruco490 -lopencv_wechat_qrcode490 -lopencv_ximgproc490"
go test -v -tags matprofile ./contrib