Skip to content

Commit 6672a9a

Browse files
Martin SchlöglMartin Schlögl
authored andcommitted
Added runtime.ubuntu.20.04-x64 build
1 parent f6b0fbc commit 6672a9a

File tree

3 files changed

+211
-0
lines changed

3 files changed

+211
-0
lines changed

.github/workflows/ubuntu20.yml

Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
name: Ubuntu 20.04
2+
3+
on:
4+
pull_request:
5+
types: [synchronize, opened]
6+
push:
7+
branches:
8+
- master
9+
10+
env:
11+
DEBIAN_FRONTEND: noninteractive
12+
OPENCV_VERSION: 4.6.0
13+
14+
jobs:
15+
build:
16+
17+
runs-on: ubuntu-20.04
18+
19+
steps:
20+
- uses: actions/checkout@v2
21+
with:
22+
fetch-depth: 1
23+
24+
- name: Install dependencies
25+
run: |
26+
pwd
27+
echo ${GITHUB_WORKSPACE}
28+
current_path=$(pwd)
29+
sudo apt-get update -y
30+
sudo apt-get install -y --no-install-recommends \
31+
apt-transport-https \
32+
software-properties-common \
33+
wget \
34+
unzip \
35+
ca-certificates \
36+
build-essential \
37+
cmake \
38+
git \
39+
libtbb-dev \
40+
libatlas-base-dev \
41+
libgtk2.0-dev \
42+
libavcodec-dev \
43+
libavformat-dev \
44+
libswscale-dev \
45+
libdc1394-22-dev \
46+
libxine2-dev \
47+
libv4l-dev \
48+
libtheora-dev \
49+
libvorbis-dev \
50+
libxvidcore-dev \
51+
libopencore-amrnb-dev \
52+
libopencore-amrwb-dev \
53+
libavresample-dev \
54+
x264 \
55+
libtesseract-dev
56+
57+
- name: Cache OpenCV
58+
id: opencv-cache
59+
uses: actions/cache@v2
60+
with:
61+
path: ${{ github.workspace }}/opencv_ubuntu/
62+
key: opencv-${{ env.OPENCV_VERSION }}-rev1
63+
64+
- name: Build OpenCV
65+
if: steps.opencv-cache.outputs.cache-hit != 'true'
66+
run: |
67+
wget https://github.com/opencv/opencv/archive/${OPENCV_VERSION}.zip -Oopencv-${OPENCV_VERSION}.zip && unzip opencv-${OPENCV_VERSION}.zip
68+
wget https://github.com/opencv/opencv_contrib/archive/${OPENCV_VERSION}.zip -Oopencv_contrib-${OPENCV_VERSION}.zip && unzip opencv_contrib-${OPENCV_VERSION}.zip
69+
cd opencv-${OPENCV_VERSION} && mkdir build && cd build
70+
cmake \
71+
-D CMAKE_BUILD_TYPE=Release \
72+
-D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib-${OPENCV_VERSION}/modules \
73+
-D BUILD_SHARED_LIBS=OFF \
74+
-D ENABLE_CXX11=ON \
75+
-D BUILD_EXAMPLES=OFF \
76+
-D BUILD_DOCS=OFF \
77+
-D BUILD_PERF_TESTS=OFF \
78+
-D BUILD_TESTS=OFF \
79+
-D BUILD_JAVA=OFF \
80+
-D BUILD_opencv_apps=OFF \
81+
-D BUILD_opencv_barcode=OFF \
82+
-D BUILD_opencv_java_bindings_generator=OFF \
83+
-D BUILD_opencv_python_bindings_generator=OFF \
84+
-D BUILD_opencv_python_tests=OFF \
85+
-D BUILD_opencv_ts=OFF \
86+
-D BUILD_opencv_js=OFF \
87+
-D BUILD_opencv_js_bindings_generator=OFF \
88+
-D BUILD_opencv_bioinspired=OFF \
89+
-D BUILD_opencv_ccalib=OFF \
90+
-D BUILD_opencv_datasets=OFF \
91+
-D BUILD_opencv_dnn_objdetect=OFF \
92+
-D BUILD_opencv_dpm=OFF \
93+
-D BUILD_opencv_fuzzy=OFF \
94+
-D BUILD_opencv_gapi=ON \
95+
-D BUILD_opencv_intensity_transform=OFF \
96+
-D BUILD_opencv_mcc=OFF \
97+
-D BUILD_opencv_objc_bindings_generator=OFF \
98+
-D BUILD_opencv_rapid=OFF \
99+
-D BUILD_opencv_reg=OFF \
100+
-D BUILD_opencv_stereo=OFF \
101+
-D BUILD_opencv_structured_light=OFF \
102+
-D BUILD_opencv_surface_matching=OFF \
103+
-D BUILD_opencv_wechat_qrcode=ON \
104+
-D BUILD_opencv_videostab=OFF \
105+
-D WITH_GSTREAMER=OFF \
106+
-D WITH_ADE=OFF \
107+
-D OPENCV_ENABLE_NONFREE=ON \
108+
-D CMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/opencv_ubuntu ..
109+
make -j2
110+
make install
111+
sudo ldconfig
112+
cd ${GITHUB_WORKSPACE}
113+
ls
114+
115+
- name: Build OpenCvSharpExtern
116+
run: |
117+
ls ${GITHUB_WORKSPACE}/opencv_ubuntu
118+
echo "-----"
119+
ls ${GITHUB_WORKSPACE}/opencv_ubuntu/lib
120+
echo "-----"
121+
mkdir src/build && cd $_
122+
cmake -D CMAKE_PREFIX_PATH=${GITHUB_WORKSPACE}/opencv_ubuntu ..
123+
make -j2
124+
ls OpenCvSharpExtern
125+
cp OpenCvSharpExtern/libOpenCvSharpExtern.so ${GITHUB_WORKSPACE}/nuget/
126+
ldd OpenCvSharpExtern/libOpenCvSharpExtern.so
127+
128+
- name: Check OpenCvSharpExtern
129+
run: |
130+
cd ${GITHUB_WORKSPACE}/nuget/
131+
ldd libOpenCvSharpExtern.so
132+
nm libOpenCvSharpExtern.so
133+
echo -ne "#include <stdio.h> \n int core_Mat_sizeof(); int main(){ int i = core_Mat_sizeof(); printf(\"sizeof(Mat) = %d\", i); return 0; }" > test.c
134+
gcc -I./ -L./ test.c -o test -lOpenCvSharpExtern
135+
LD_LIBRARY_PATH=. ./test
136+
137+
- name: Install .NET
138+
uses: actions/setup-dotnet@v1
139+
with:
140+
dotnet-version: '6.0.x'
141+
142+
- name: Create NuGet package
143+
env:
144+
BETA: ""
145+
run: |
146+
yyyymmdd=`date '+%Y%m%d'`
147+
echo $yyyymmdd
148+
sed -E --in-place=.bak "s/<version>[0-9]\.[0-9]{1,2}\.[0-9]{1,2}.[0-9]{8}(-beta[0-9]*)?<\/version>/<version>${OPENCV_VERSION}.${yyyymmdd}${BETA}<\/version>/" ${GITHUB_WORKSPACE}/nuget/OpenCvSharp4.runtime.ubuntu.20.04-x64.nuspec
149+
cat ${GITHUB_WORKSPACE}/nuget/OpenCvSharp4.runtime.ubuntu.20.04-x64.nuspec
150+
dotnet pack ${GITHUB_WORKSPACE}/nuget/OpenCvSharp4.runtime.ubuntu.20.04-x64.csproj -o ${GITHUB_WORKSPACE}/artifacts_ubuntu
151+
ls ${GITHUB_WORKSPACE}/artifacts_ubuntu
152+
153+
- uses: actions/upload-artifact@v1
154+
with:
155+
name: artifacts_ubuntu_20
156+
path: artifacts_ubuntu
157+
158+
- name: Test
159+
run: |
160+
cd ${GITHUB_WORKSPACE}/test/OpenCvSharp.Tests
161+
dotnet build -c Release -f net6.0
162+
cp ${GITHUB_WORKSPACE}/nuget/libOpenCvSharpExtern.so ${GITHUB_WORKSPACE}/test/OpenCvSharp.Tests/bin/Release/net6.0/
163+
cp ${GITHUB_WORKSPACE}/nuget/libOpenCvSharpExtern.so ${GITHUB_WORKSPACE}/test/OpenCvSharp.Tests/
164+
sudo cp ${GITHUB_WORKSPACE}/nuget/libOpenCvSharpExtern.so /usr/lib/
165+
# ls ${GITHUB_WORKSPACE}/test/OpenCvSharp.Tests/bin/Release/net6.0/
166+
# ls
167+
LD_LIBRARY_PATH=. dotnet test OpenCvSharp.Tests.csproj -c Release -f net6.0 --runtime ubuntu.20.04-x64 --logger "trx;LogFileName=test-results.trx" < /dev/null
168+
# ls
169+
# ls TestResults
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
<PropertyGroup>
3+
<TargetFrameworks>netstandard2.0;netstandard2.1;netcoreapp2.1;</TargetFrameworks>
4+
<NoBuild>true</NoBuild>
5+
<IncludeBuildOutput>false</IncludeBuildOutput>
6+
<NuspecFile>OpenCvSharp4.runtime.ubuntu.20.04-x64.nuspec</NuspecFile>
7+
<NuspecProperties></NuspecProperties>
8+
<NuspecBasePath></NuspecBasePath>
9+
<!--<IncludeSymbols>true</IncludeSymbols>
10+
<SymbolPackageFormat>snupkg</SymbolPackageFormat>-->
11+
</PropertyGroup>
12+
</Project>
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
3+
<metadata>
4+
<id>OpenCvSharp4.runtime.ubuntu.20.04-x64</id>
5+
<version>4.6.0.20220608</version>
6+
<title>OpenCvSharp native bindings for ubuntu.20.04-x64</title>
7+
<authors>shimat</authors>
8+
<license type="expression">Apache-2.0</license>
9+
<!--<licenseUrl>https://opensource.org/licenses/BSD-3-Clause</licenseUrl>-->
10+
<projectUrl>https://github.com/shimat/opencvsharp</projectUrl>
11+
<iconUrl>https://raw.githubusercontent.com/shimat/opencvsharp/master/nuget/icon/opencvsharp.png</iconUrl>
12+
<requireLicenseAcceptance>false</requireLicenseAcceptance>
13+
<description>Internal implementation package for OpenCvSharp to work on Ubuntu 20.04</description>
14+
<summary>Internal implementation package for OpenCvSharp to work on Ubuntu 20.04</summary>
15+
<releaseNotes></releaseNotes>
16+
<copyright>Copyright 2008-2019</copyright>
17+
<tags>Image Processing OpenCV Wrapper FFI opencvsharp</tags>
18+
<repository type="git" url="https://github.com/shimat/opencvsharp.git" />
19+
<dependencies>
20+
<group targetFramework="netstandard2.0"></group>
21+
<group targetFramework="netstandard2.1"></group>
22+
<group targetFramework="netcoreapp3.1"></group>
23+
</dependencies>
24+
<frameworkAssemblies>
25+
</frameworkAssemblies>
26+
</metadata>
27+
<files>
28+
<file src="libOpenCvSharpExtern.so" target="runtimes/ubuntu.20.04-x64/native" />
29+
</files>
30+
</package>

0 commit comments

Comments
 (0)