Last active
November 14, 2017 12:19
-
-
Save tvdstaaij/2e0b226cafaa376a52de7c33108efb05 to your computer and use it in GitHub Desktop.
Arch Linux OpenCV 3.1.0 with Qt and CUDA
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 24dbb43c096691d0333cacf231e22f1369f8c826 Mon Sep 17 00:00:00 2001 | |
From: Alexander Alekhin <[email protected]> | |
Date: Tue, 22 Dec 2015 17:10:33 +0300 | |
Subject: [PATCH] pkg-config: modules list contains only OpenCV modules (fixes | |
#5852) | |
--- | |
cmake/OpenCVUtils.cmake | 11 +++++++---- | |
1 file changed, 7 insertions(+), 4 deletions(-) | |
diff --git a/cmake/OpenCVUtils.cmake b/cmake/OpenCVUtils.cmake | |
index 3a23cd7..75412eb 100644 | |
--- a/cmake/OpenCVUtils.cmake | |
+++ b/cmake/OpenCVUtils.cmake | |
@@ -806,7 +806,13 @@ macro(ocv_get_all_libs _modules _extra _3rdparty) | |
else() | |
set(deps "") | |
endif() | |
- list(INSERT ${_modules} 0 ${deps} ${m}) | |
+ set(_rev_deps "${deps};${m}") | |
+ ocv_list_reverse(_rev_deps) | |
+ foreach (dep ${_rev_deps}) | |
+ if(DEFINED OPENCV_MODULE_${dep}_LOCATION) | |
+ list(INSERT ${_modules} 0 ${dep}) | |
+ endif() | |
+ endforeach() | |
foreach (dep ${deps} ${OPENCV_LINKER_LIBS}) | |
if (NOT DEFINED OPENCV_MODULE_${dep}_LOCATION) | |
if (TARGET ${dep}) | |
@@ -832,9 +838,6 @@ macro(ocv_get_all_libs _modules _extra _3rdparty) | |
endif() | |
endif() | |
- # split 3rdparty libs and modules | |
- list(REMOVE_ITEM ${_modules} ${${_3rdparty}} ${${_extra}} non_empty_list) | |
- | |
ocv_list_filterout(${_modules} "^[\$]<") | |
ocv_list_filterout(${_3rdparty} "^[\$]<") | |
ocv_list_filterout(${_extra} "^[\$]<") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- a/modules/cudalegacy/src/graphcuts.cpp | |
+++ b/modules/cudalegacy/src/graphcuts.cpp | |
@@ -42,7 +42,7 @@ | |
#include "precomp.hpp" | |
-#if !defined (HAVE_CUDA) || defined (CUDA_DISABLER) | |
+#if !defined (HAVE_CUDA) || defined (CUDA_DISABLER) || (CUDART_VERSION >= 8000) | |
void cv::cuda::graphcut(GpuMat&, GpuMat&, GpuMat&, GpuMat&, GpuMat&, GpuMat&, GpuMat&, Stream&) { throw_no_cuda(); } | |
void cv::cuda::graphcut(GpuMat&, GpuMat&, GpuMat&, GpuMat&, GpuMat&, GpuMat&, GpuMat&, GpuMat&, GpuMat&, GpuMat&, GpuMat&, Stream&) { throw_no_cuda(); } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# $Id: PKGBUILD 282919 2016-12-07 15:09:11Z anthraxx $ | |
# Maintainer: Ray Rashif <[email protected]> | |
# Contributor: Tobias Powalowski <[email protected]> | |
# Modified by Tim van der Staaij: | |
# - Enabled CUDA and Qt support | |
# - Enabled SSE/AVX flags suitable for reasonably modern CPUs | |
# - Disabled Python and Java support | |
# - Build with 5 parallel jobs | |
pkgbase=opencv | |
pkgname=('opencv' 'opencv-samples') | |
pkgver=3.1.0 | |
pkgrel=6 | |
pkgdesc="Open Source Computer Vision Library" | |
arch=('i686' 'x86_64') | |
license=('BSD') | |
url="http://opencv.org/" | |
depends=('intel-tbb' 'openexr' 'xine-lib' 'libdc1394' 'gtkglext' 'cuda') | |
makedepends=('cmake' 'mesa' 'eigen') | |
optdepends=('opencv-samples' | |
'eigen' | |
'opencl-icd-loader: For coding with OpenCL') | |
source=("$pkgbase-$pkgver.tar.gz::https://github.com/Itseez/opencv/archive/$pkgver.zip" | |
"opencv_contrib-$pkgver.tar.gz::https://github.com/Itseez/opencv_contrib/archive/$pkgver.tar.gz" | |
opencv-gcc6.patch::"https://github.com/mshabunin/opencv/commit/a0fdc91a.patch" '5852.patch' 'graphcuts.patch') | |
md5sums=('6082ee2124d4066581a7386972bfd52a' | |
'a822839ad3ab79ff837c16785ea9dd10' | |
'4dacea7866d28014939a652f268cc7c1' | |
'5bd9cd736b171c15cedee3a32a0c47ff' | |
'17a4864ec283f3c2addbd370db4fa09c') | |
_cmakeopts=('-D WITH_OPENCL=ON' | |
'-D WITH_OPENGL=ON' | |
'-D WITH_TBB=ON' | |
'-D WITH_XINE=ON' | |
'-D WITH_GSTREAMER=OFF' | |
'-D BUILD_WITH_DEBUG_INFO=OFF' | |
'-D BUILD_TESTS=OFF' | |
'-D BUILD_PERF_TESTS=OFF' | |
'-D BUILD_EXAMPLES=ON' | |
'-D INSTALL_C_EXAMPLES=ON' | |
'-D INSTALL_PYTHON_EXAMPLES=OFF' | |
'-D CMAKE_BUILD_TYPE=Release' | |
'-D CMAKE_INSTALL_PREFIX=/usr' | |
'-D CMAKE_SKIP_RPATH=ON' | |
'-D ENABLE_SSE3=ON' | |
'-D ENABLE_SSSE3=ON' | |
'-D ENABLE_SSE4=ON' | |
'-D ENABLE_SSE41=ON' | |
'-D ENABLE_SSE42=ON' | |
'-D ENABLE_AVX=ON' | |
'-D WITH_QT=ON' | |
'-D WITH_CUDA=ON' | |
'-D WITH_IPP=OFF' | |
'-D BUILD_opencv_python=OFF' | |
'-D BUILD_opencv_python2=OFF' | |
'-D BUILD_opencv_python3=OFF' | |
'-D BUILD_opencv_java=OFF' | |
#'-D INSTALL_CREATE_DISTRIB=ON' | |
) | |
# SSE only available from Pentium 3 onwards (i686 is way older) | |
[[ "$CARCH" = 'i686' ]] && \ | |
_cmakeopts+=('-D ENABLE_SSE=OFF' | |
'-D ENABLE_SSE2=OFF' | |
'-D ENABLE_SSE3=OFF') | |
prepare() { | |
cd "$srcdir/$pkgname-$pkgver" | |
patch -p1 -i "$srcdir/5852.patch" | |
patch -p1 -i "$srcdir/graphcuts.patch" | |
# Fix build with GCC 6 | |
patch -p1 -i "$srcdir"/opencv-gcc6.patch | |
} | |
build() { | |
cd "$srcdir/$pkgname-$pkgver" | |
export CC=/usr/bin/gcc-5 | |
export CXX=/usr/bin/g++-5 | |
cmake ${_cmakeopts[@]} \ | |
-DOPENCV_EXTRA_MODULES_PATH="$srcdir/opencv_contrib-$pkgver/modules" \ | |
. | |
make -j5 | |
} | |
package_opencv() { | |
options=('staticlibs') | |
cd "$srcdir/$pkgname-$pkgver" | |
make DESTDIR="$pkgdir" install | |
# install license file | |
install -Dm644 "$srcdir/$pkgname-$pkgver/LICENSE" \ | |
"$pkgdir/usr/share/licenses/$pkgname/LICENSE" | |
cd "$pkgdir/usr/share" | |
# separate samples package; also be -R friendly | |
if [[ -d OpenCV/samples ]]; then | |
mv OpenCV/samples "$srcdir/$pkgname-samples" | |
mv OpenCV $pkgname # otherwise folder naming is inconsistent | |
elif [[ ! -d OpenCV ]]; then | |
warning "Directory naming issue; samples package may not be built!" | |
fi | |
} | |
package_opencv-samples() { | |
pkgdesc+=" (samples)" | |
depends=("opencv=$pkgver") # sample codes change with lib/API | |
unset optdepends | |
mkdir -p "$pkgdir/usr/share/opencv" | |
cp -r "$srcdir/opencv-samples" "$pkgdir/usr/share/opencv/samples" | |
# install license file | |
install -Dm644 "$srcdir/opencv-$pkgver/LICENSE" \ | |
"$pkgdir/usr/share/licenses/$pkgname/LICENSE" | |
} | |
# vim:set ts=2 sw=2 et: |
I got this when I tried the steps above to build:
==> Validating source files with md5sums...
opencv-3.1.0.tar.gz ... Passed
opencv_contrib-3.1.0.tar.gz ... Passed
opencv-gcc6.patch ... FAILED
5852.patch ... Passed
graphcuts.patch ... Passed
==> ERROR: One or more files did not pass the validity check!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Download ZIP
of this gist and extractmakepkg -si
in the extracted directory