!14 opencv 构建python 模块
From: @yanhailiangyhl Reviewed-by: Signed-off-by:
This commit is contained in:
commit
875926e3df
16
opencv.spec
16
opencv.spec
@ -16,6 +16,7 @@ Patch2: Fix_compilation_of_copy_assignment_operators_with_GCC.patch
|
|||||||
Patch3: Repair_clang_abi.patch
|
Patch3: Repair_clang_abi.patch
|
||||||
BuildRequires: gcc-c++ gcc autoconf pkgconfig protobuf-compiler protobuf
|
BuildRequires: gcc-c++ gcc autoconf pkgconfig protobuf-compiler protobuf
|
||||||
BuildRequires: cmake
|
BuildRequires: cmake
|
||||||
|
BuildRequires: python3-numpy python3-devel
|
||||||
|
|
||||||
%description
|
%description
|
||||||
OpenCV means Intel® Open Source Computer Vision Library. It is a collection of
|
OpenCV means Intel® Open Source Computer Vision Library. It is a collection of
|
||||||
@ -46,6 +47,8 @@ cmake ../../ -DCMAKE_BUILD_TYPE=Release\
|
|||||||
-DBUILD_PERF_TESTS=OFF\
|
-DBUILD_PERF_TESTS=OFF\
|
||||||
-DBUILD_opencv_apps=OFF\
|
-DBUILD_opencv_apps=OFF\
|
||||||
-DBUILD_opencv_python3=ON\
|
-DBUILD_opencv_python3=ON\
|
||||||
|
-DBUILD_opencv_python2=OFF\
|
||||||
|
-DBUILD_opencv_java=OFF\
|
||||||
-DWITH_FFMPEG=OFF\
|
-DWITH_FFMPEG=OFF\
|
||||||
-DWITH_TIFF=ON\
|
-DWITH_TIFF=ON\
|
||||||
-DBUILD_TIFF=OFF\
|
-DBUILD_TIFF=OFF\
|
||||||
@ -55,9 +58,19 @@ cmake ../../ -DCMAKE_BUILD_TYPE=Release\
|
|||||||
-DBUILD_EXAMPLES=ON\
|
-DBUILD_EXAMPLES=ON\
|
||||||
-DOPENCV_TEST_DATA_PATH=%_builddir/%{name}-%{version}/opencv_extra-%{version}/testdata\
|
-DOPENCV_TEST_DATA_PATH=%_builddir/%{name}-%{version}/opencv_extra-%{version}/testdata\
|
||||||
-DINSTALL_TESTS=ON\
|
-DINSTALL_TESTS=ON\
|
||||||
|
-DPYTHON3_EXECUTABLE=$(which python3)\
|
||||||
|
-DPYTHON_EXECUTABLE=$(which python3)\
|
||||||
|
-DPYTHON_DEFAULT_EXECUTABLE=$(python3 -c "import sys; print(sys.executable)")\
|
||||||
|
-DPYTHON3_NUMPY_INCLUDE_DIRS=$(python3 -c "import numpy; print (numpy.get_include())")\
|
||||||
|
-DPYTHON3_INCLUDE_DIR=$(python3 -c "from distutils.sysconfig import get_python_inc; print(get_python_inc())")\
|
||||||
|
-DPYTHON_INCLUDE_DIR=$(python3 -c "from distutils.sysconfig import get_python_inc; print(get_python_inc())")\
|
||||||
|
-DPYTHON3_LIBRARIES=$(python3 -c "import distutils.sysconfig as sysconfig; print(sysconfig.get_config_var('LIBDIR')+ '/libpython3.so')")\
|
||||||
|
-DPYTHON3_LIBRARY=$(python3 -c "import distutils.sysconfig as sysconfig; print(sysconfig.get_config_var('LIBDIR')+ '/libpython3.so')")\
|
||||||
|
-DPYTHON_LIBRARIES=$(python3 -c "import distutils.sysconfig as sysconfig; print(sysconfig.get_config_var('LIBDIR')+ '/libpython3.so')")\
|
||||||
|
-DPYTHON_LIBRARY=$(python3 -c "import distutils.sysconfig as sysconfig; print(sysconfig.get_config_var('LIBDIR')+ '/libpython3.so')")\
|
||||||
-DCMAKE_INSTALL_PREFIX=/usr
|
-DCMAKE_INSTALL_PREFIX=/usr
|
||||||
make -j24 V=1
|
make -j24 V=1
|
||||||
ctest -E "opencv_test_objdetect"
|
ctest -E "opencv_test_objdetect|opencv_test_photo"
|
||||||
|
|
||||||
|
|
||||||
%install
|
%install
|
||||||
@ -71,6 +84,7 @@ make install DESTDIR=%{buildroot}
|
|||||||
%{_libdir}/*
|
%{_libdir}/*
|
||||||
%{_includedir}/*
|
%{_includedir}/*
|
||||||
%exclude /usr/share/*
|
%exclude /usr/share/*
|
||||||
|
/usr/lib/python3.8/site-packages/cv2/*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
* Wed Nov 17 2021 shenwei <shenwei41@huawei.com> - 4.5.2-4
|
* Wed Nov 17 2021 shenwei <shenwei41@huawei.com> - 4.5.2-4
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user