-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_minimal_opencvsharp.ps1
107 lines (94 loc) · 2.83 KB
/
build_minimal_opencvsharp.ps1
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
$OriginalLocation = Get-Location
try {
if (!(Test-Path -Path "build_minimal")) {
mkdir "build_minimal" > $null
}
Set-Location "build_minimal"
# Clone OpenCV
if (!(Test-Path -Path "opencv")) {
git clone --branch 4.10.0 "https://github.com/opencv/opencv.git" "opencv"
}
Set-Location "opencv"
# Build OpenCV
if (Test-Path -Path "build") {
Remove-Item -Recurse -Force "build"
}
mkdir "build" > $null
Set-Location "build"
cmake `
-D CMAKE_BUILD_TYPE=RELEASE `
-D BUILD_SHARED_LIBS=OFF `
-D ENABLE_CXX11=ON `
-D BUILD_EXAMPLES=OFF `
-D BUILD_DOCS=OFF `
-D BUILD_PERF_TESTS=OFF `
-D BUILD_TESTS=OFF `
-D BUILD_JAVA=OFF `
-D BUILD_LIST=core,imgproc `
-D BUILD_TIFF=OFF `
-D BUILD_OPENJPEG=OFF `
-D BUILD_JASPER=OFF `
-D BUILD_JPEG=OFF `
-D BUILD_PNG=OFF `
-D BUILD_OPENEXR=OFF `
-D BUILD_WEBP=OFF `
-D BUILD_ITT=OFF `
-D WITH_GSTREAMER=OFF `
-D WITH_ADE=OFF `
-D WITH_FFMPEG=OFF `
-D WITH_V4L=OFF `
-D WITH_1394=OFF `
-D WITH_GTK=OFF `
-D WITH_OPENEXR=OFF `
-D WITH_PROTOBUF=OFF `
-D WITH_QUIRC=OFF `
-D WITH_VTK=OFF `
-D WITH_WIN32UI=OFF `
-D WITH_NVCUVID=OFF `
-D WITH_NVCUVENC=OFF `
-D WITH_JASPER=OFF `
-D WITH_OPENJPEG=OFF `
-D WITH_JPEG=OFF `
-D WITH_TIFF=OFF `
-D WITH_PNG=OFF `
-D WITH_WEBP=OFF `
-D WITH_V4L=OFF `
-D WITH_DSHOW=OFF `
-D WITH_OPENCLAMDFFT=OFF `
-D WITH_OPENCLAMDBLAS=OFF `
-D WITH_DIRECTX=OFF `
-D WITH_MSMF=OFF `
-D WITH_DIRECTML=OFF `
-D WITH_IMGCODEC_HDR=OFF `
-D WITH_IMGCODEC_SUNRASTER=OFF `
-D WITH_IMGCODEC_PXM=OFF `
-D WITH_IMGCODEC_PFM=OFF `
-D WITH_OBSENSOR=OFF `
-D WITH_ITT=OFF `
-D OPENCV_ENABLE_NONFREE=OFF `
-D CV_TRACE=OFF `
..
cmake --build . --target INSTALL --config Release
# # Clone and patch OpenCVSharp
Set-Location "..\.."
if (!(Test-Path -Path "opencvsharp")) {
git clone "https://github.com/shimat/opencvsharp.git" "opencvsharp"
Set-Location "opencvsharp"
git reset --hard ca1f60877aff090de5e3e456c06c7827f33f364d
git apply --reject --whitespace=fix "..\..\build_minimal_opencvsharp.patch"
} else {
Set-Location "opencvsharp"
}
# Build OpenCVSharp
if (Test-Path -Path "build") {
Remove-Item -Recurse -Force "build"
}
mkdir "build" > $null
Set-Location "build"
$OpenCVPath = (Resolve-Path "..\..\opencv\build\install").Path
cmake -D CMAKE_INSTALL_PREFIX=x64\Release -D OpenCV_STATIC=ON -D OpenCV_DIR=$OpenCVPath ..\src\
cmake --build . --target INSTALL --config Release
Copy-Item "x64\Release\bin\OpenCvSharpExtern.dll" -Destination "..\..\..\libs\Native\Aardvark.OpenCV\windows\AMD64"
} finally {
Set-Location $OriginalLocation.Path
}