summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: a40486490e5b53ee3c4f82f4aa6023ddc1e64060 (plain)
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
# Maintainer: bartus szczepaniak <aur@bartus.33mail.com>

####to disable cuda kernel comment out this line
_BUILD_CUDA="on"

name=colmap
#fragment="#commit=5bea89263bf5f3ed623b8e6e6a5f022a0ed9c1de"
fragment="#branch=dev"
pkgname=${name}-git
pkgver=3.4.r68.g3803109
pkgrel=1
pkgdesc="COLMAP is a general-purpose Structure-from-Motion (SfM) and Multi-View Stereo (MVS) pipeline with a graphical and command-line interface."
arch=('i686' 'x86_64')
url="https://colmap.github.io/"
license=('GPL')
groups=()
depends=('gflags' 'suitesparse' 'freeglut' 'glew' 'google-glog' 'freeimage' 'boost-libs' 'qt5-base')
makedepends=('ceres-solver' 'boost' 'git' 'cmake' 'eigen' )
if [ "$_BUILD_CUDA" == "on" ] ; then 
  makedepends+=('cuda')
  optdepends=('cuda: for cuda sfm/mvs acceleration')
fi
install=${pkgname}.install
source=("${pkgname}::git+https://github.com/colmap/colmap.git${fragment}"
        "nvm-export.patch"
        "${pkgname}.install"
        "vocabulary-tree-64K.bin::https://demuc.de/colmap/vocab_tree-65536.bin"
        "vocabulary-tree-256K.bin::https://demuc.de/colmap/vocab_tree-262144.bin"
        "vocabulary-tree-1M.bin::https://demuc.de/colmap/vocab_tree-1048576.bin"
        )
md5sums=('SKIP'
         '3c0027625739e972f8af8bea6f557b35'
         'ebb1dc43e014a1e720a06422c6248a40'
         '3521ff3c601596473c6ce5256772f606'
         'e423daecc45d56b749d25eeace9de1c8'
         '7ec70d4137d9b7ca9f076df34808ccc7')

pkgver() {
  cd "$pkgname"
  git describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
}

prepare() {
  cd ${srcdir}/${pkgname}
  git apply ${srcdir}/nvm-export.patch
}


build() {
  cd ${srcdir}

  export CFLAGS=${CFLAGS/-fno-plt/}
  export CXXFLAGS=${CFLAGS/-fno-plt/}

  # determine whether we can precompile CUDA kernels
    _CUDA_PKG=`pacman -Qq cuda 2>/dev/null` || true
    if [ -n "$_CUDA_PKG" -a "$_BUILD_CUDA"=="on" ]; then
      _EXTRAOPTS="-DCUDA_ENABLED=ON -DCUDA_HOST_COMPILER=/opt/cuda/bin/gcc -DCUDA_TOOLKIT_ROOT_DIR=/opt/cuda"
    else
      _EXTRAOPTS="-DCUDA_ENABLED=OFF"
    fi

  mkdir -p build
  cd build
  cmake -DTESTS_ENABLED=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr ${_EXTRAOPTS} ../${pkgname}
  make
}


package() {
  cd ${srcdir}/build
  make DESTDIR=${pkgdir} install

  # install vocabulary trees for sequential,vocabulary matching
  install -d -m755 ${pkgdir}/usr/share/${name}
  for vocab_tree in ${srcdir}/vocabulary-tree-*.bin ; do
    install -m644 ${vocab_tree} ${pkgdir}/usr/share/${name}/${vocab_tree##*/}
  done
}
# vim:set ts=2 sw=2 et: