[travis] improve CI configurations, add no-opencv-ones, add opencv4 on

macOS
[build.sh] improve handling of vcpkg
[readme] update instructions for newer visual studio versions
[build.ps1] add VS2015 and VS2019 using vswhere
pull/2828/head
Stefano Sinigardi 6 years ago
parent 1cad888641
commit f6d45f1408
  1. 298
      .travis.yml
  2. 6
      CMakeLists.txt
  3. 24
      README.md
  4. 102
      build.ps1
  5. 27
      build.sh

@ -3,44 +3,254 @@ language: cpp
matrix:
include:
- os: osx
compiler: gcc
name: macOS - native gcc (llvm backend)
env:
- additional_defines=""
- MATRIX_EVAL=""
- os: osx
compiler: gcc
name: macOS - native gcc (llvm backend) - opencv@2
env:
- MATRIX_EVAL="brew install opencv@2 && OpenCV_DIR=/usr/local/opt/opencv@2"
- OpenCV_DIR="/usr/local/Cellar/opencv@2/2.4.13.7_2/"
- additional_defines="-DOpenCV_DIR=${OpenCV_DIR}"
- MATRIX_EVAL="brew install opencv@2"
- os: osx
compiler: gcc
name: macOS - native gcc (llvm backend) - opencv@3
env:
- MATRIX_EVAL="brew install opencv@3 && OpenCV_DIR=/usr/local/opt/opencv@3"
- OpenCV_DIR="/usr/local/Cellar/opencv@3/3.4.5/"
- additional_defines="-DOpenCV_DIR=${OpenCV_DIR}"
- MATRIX_EVAL="brew install opencv@3"
- os: osx
compiler: gcc
name: macOS - native gcc (llvm backend) - opencv(latest)
env:
- additional_defines=""
- MATRIX_EVAL="brew install opencv"
- os: osx
compiler: clang
name: macOS - native clang
env:
- additional_defines=""
- MATRIX_EVAL=""
- os: osx
compiler: clang
name: macOS - native clang - opencv@2
env:
- MATRIX_EVAL="brew install opencv@2 && OpenCV_DIR=/usr/local/opt/opencv@2"
- OpenCV_DIR="/usr/local/Cellar/opencv@2/2.4.13.7_2/"
- additional_defines="-DOpenCV_DIR=${OpenCV_DIR}"
- MATRIX_EVAL="brew install opencv@2"
- os: osx
compiler: clang
name: macOS - native clang - opencv@3
env:
- MATRIX_EVAL="brew install opencv@3 && OpenCV_DIR=/usr/local/opt/opencv@3"
- OpenCV_DIR="/usr/local/Cellar/opencv@3/3.4.5/"
- additional_defines="-DOpenCV_DIR=${OpenCV_DIR}"
- MATRIX_EVAL="brew install opencv@3"
- os: osx
compiler: clang
name: macOS - native clang - opencv(latest)
env:
- additional_defines=""
- MATRIX_EVAL="brew install opencv"
- os: linux
compiler: clang
name: ubuntu 14.04 - native clang
addons:
apt:
update: true
env:
- additional_defines=""
- MATRIX_EVAL=""
- os: linux
compiler: clang
name: ubuntu 14.04 - clang@3.6
addons:
apt:
update: true
packages:
- clang-3.6
env:
- additional_defines=""
- MATRIX_EVAL="CC=clang-3.6 && CXX=clang++-3.6"
- os: linux
compiler: clang
name: ubuntu 14.04 - clang@3.8
addons:
apt:
update: true
sources:
- llvm-toolchain-precise-3.8
packages:
- clang-3.8
env:
- additional_defines=""
- MATRIX_EVAL="CC=clang-3.8 && CXX=clang++-3.8"
- os: linux
compiler: clang
name: ubuntu 14.04 - clang@3.9
addons:
apt:
update: true
sources:
- llvm-toolchain-trusty-3.9
packages:
- clang-3.9
env:
- additional_defines=""
- MATRIX_EVAL="CC=clang-3.9 && CXX=clang++-3.9"
- os: linux
compiler: clang
name: ubuntu 14.04 - clang@4.0
addons:
apt:
update: true
sources:
- llvm-toolchain-trusty-4.0
packages:
- clang-4.0
env:
- additional_defines=""
- MATRIX_EVAL="CC=clang-4.0 && CXX=clang++-4.0"
- os: linux
compiler: clang
name: ubuntu 14.04 - clang@5.0
addons:
apt:
update: true
sources:
- llvm-toolchain-trusty-5.0
packages:
- clang-5.0
env:
- additional_defines=""
- MATRIX_EVAL="CC=clang-5.0 && CXX=clang++-5.0"
- os: linux
compiler: clang
name: ubuntu 14.04 - clang@6.0
addons:
apt:
update: true
sources:
- llvm-toolchain-trusty-6.0
- ubuntu-toolchain-r-test
packages:
- clang-6.0
env:
- additional_defines=""
- MATRIX_EVAL="CC=clang-6.0 && CXX=clang++-6.0"
- os: linux
compiler: gcc
name: ubuntu 14.04 - native gcc
addons:
apt:
update: true
env:
- additional_defines=""
- MATRIX_EVAL=""
- os: linux
compiler: gcc
name: ubuntu 14.04 - gcc@4.9
addons:
apt:
update: true
sources:
- ubuntu-toolchain-r-test
packages:
- g++-4.9
env:
- additional_defines=""
- MATRIX_EVAL="CC=gcc-4.9 && CXX=g++-4.9"
- os: linux
compiler: gcc
name: ubuntu 14.04 - gcc@5.0
addons:
apt:
update: true
sources:
- ubuntu-toolchain-r-test
packages:
- g++-5
env:
- additional_defines=""
- MATRIX_EVAL="CC=gcc-5 && CXX=g++-5"
- os: linux
compiler: gcc
name: ubuntu 14.04 - gcc@6.0
addons:
apt:
update: true
sources:
- ubuntu-toolchain-r-test
packages:
- g++-6
env:
- additional_defines=""
- MATRIX_EVAL="CC=gcc-6 && CXX=g++-6"
- os: linux
compiler: gcc
name: ubuntu 14.04 - gcc@7.0
addons:
apt:
update: true
sources:
- ubuntu-toolchain-r-test
packages:
- g++-7
env:
- additional_defines=""
- MATRIX_EVAL="CC=gcc-7 && CXX=g++-7"
- os: linux
compiler: gcc
name: ubuntu 14.04 - gcc@8.0
addons:
apt:
update: true
sources:
- ubuntu-toolchain-r-test
packages:
- g++-8
env:
- additional_defines=""
- MATRIX_EVAL="CC=gcc-8 && CXX=g++-8"
- os: linux
compiler: clang
name: ubuntu 14.04 - native clang - opencv@2
addons:
apt:
update: true
packages:
- libopencv-dev
env:
- additional_defines=""
- MATRIX_EVAL=""
- os: linux
compiler: clang
name: ubuntu 14.04 - clang@3.6
name: ubuntu 14.04 - clang@3.6 - opencv@2
addons:
apt:
update: true
@ -48,11 +258,12 @@ matrix:
- libopencv-dev
- clang-3.6
env:
- additional_defines=""
- MATRIX_EVAL="CC=clang-3.6 && CXX=clang++-3.6"
- os: linux
compiler: clang
name: ubuntu 14.04 - clang@3.8
name: ubuntu 14.04 - clang@3.8 - opencv@2
addons:
apt:
update: true
@ -62,11 +273,12 @@ matrix:
- libopencv-dev
- clang-3.8
env:
- additional_defines=""
- MATRIX_EVAL="CC=clang-3.8 && CXX=clang++-3.8"
- os: linux
compiler: clang
name: ubuntu 14.04 - clang@3.9
name: ubuntu 14.04 - clang@3.9 - opencv@2
addons:
apt:
update: true
@ -76,11 +288,12 @@ matrix:
- libopencv-dev
- clang-3.9
env:
- additional_defines=""
- MATRIX_EVAL="CC=clang-3.9 && CXX=clang++-3.9"
- os: linux
compiler: clang
name: ubuntu 14.04 - clang@4.0
name: ubuntu 14.04 - clang@4.0 - opencv@2
addons:
apt:
update: true
@ -90,11 +303,12 @@ matrix:
- libopencv-dev
- clang-4.0
env:
- additional_defines=""
- MATRIX_EVAL="CC=clang-4.0 && CXX=clang++-4.0"
- os: linux
compiler: clang
name: ubuntu 14.04 - clang@5.0
name: ubuntu 14.04 - clang@5.0 - opencv@2
addons:
apt:
update: true
@ -104,11 +318,12 @@ matrix:
- libopencv-dev
- clang-5.0
env:
- additional_defines=""
- MATRIX_EVAL="CC=clang-5.0 && CXX=clang++-5.0"
- os: linux
compiler: clang
name: ubuntu 14.04 - clang@6.0
name: ubuntu 14.04 - clang@6.0 - opencv@2
addons:
apt:
update: true
@ -119,22 +334,24 @@ matrix:
- libopencv-dev
- clang-6.0
env:
- additional_defines=""
- MATRIX_EVAL="CC=clang-6.0 && CXX=clang++-6.0"
- os: linux
compiler: gcc
name: ubuntu 14.04 - native gcc
name: ubuntu 14.04 - native gcc - opencv@2
addons:
apt:
update: true
packages:
- libopencv-dev
env:
- additional_defines=""
- MATRIX_EVAL=""
- os: linux
compiler: gcc
name: ubuntu 14.04 - gcc@4.9
name: ubuntu 14.04 - gcc@4.9 - opencv@2
addons:
apt:
update: true
@ -144,11 +361,12 @@ matrix:
- libopencv-dev
- g++-4.9
env:
- additional_defines=""
- MATRIX_EVAL="CC=gcc-4.9 && CXX=g++-4.9"
- os: linux
compiler: gcc
name: ubuntu 14.04 - gcc@5.0
name: ubuntu 14.04 - gcc@5.0 - opencv@2
addons:
apt:
update: true
@ -158,11 +376,12 @@ matrix:
- libopencv-dev
- g++-5
env:
- additional_defines=""
- MATRIX_EVAL="CC=gcc-5 && CXX=g++-5"
- os: linux
compiler: gcc
name: ubuntu 14.04 - gcc@6.0
name: ubuntu 14.04 - gcc@6.0 - opencv@2
addons:
apt:
update: true
@ -172,11 +391,12 @@ matrix:
- g++-6
- libopencv-dev
env:
- additional_defines=""
- MATRIX_EVAL="CC=gcc-6 && CXX=g++-6"
- os: linux
compiler: gcc
name: ubuntu 14.04 - gcc@7.0
name: ubuntu 14.04 - gcc@7.0 - opencv@2
addons:
apt:
update: true
@ -186,11 +406,12 @@ matrix:
- libopencv-dev
- g++-7
env:
- additional_defines=""
- MATRIX_EVAL="CC=gcc-7 && CXX=g++-7"
- os: linux
compiler: gcc
name: ubuntu 14.04 - gcc@8.0
name: ubuntu 14.04 - gcc@8.0 - opencv@2
addons:
apt:
update: true
@ -200,24 +421,26 @@ matrix:
- libopencv-dev
- g++-8
env:
- additional_defines=""
- MATRIX_EVAL="CC=gcc-8 && CXX=g++-8"
- os: linux
compiler: clang
name: ubuntu 14.04 - native clang - CUDA 10
name: ubuntu 14.04 - native clang - CUDA 10 - opencv@2
addons:
apt:
update: true
packages:
- libopencv-dev
env:
- additional_defines=""
- CUDACXX=/usr/local/cuda-10.0/bin/nvcc
- LD_LIBRARY_PATH="/usr/local/cuda-10.0/lib64:/usr/local/cuda-10.0/lib64/stubs:${LD_LIBRARY_PATH}"
- MATRIX_EVAL="wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1404/x86_64/cuda-repo-ubuntu1404_10.0.130-1_amd64.deb && sudo apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1404/x86_64/7fa2af80.pub && sudo dpkg -i cuda-repo-ubuntu1404_10.0.130-1_amd64.deb && wget http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1404/x86_64/nvidia-machine-learning-repo-ubuntu1404_4.0-2_amd64.deb && sudo dpkg -i nvidia-machine-learning-repo-ubuntu1404_4.0-2_amd64.deb && sudo apt-get -y update && sudo apt-get install -y --no-install-recommends cuda-compiler-10-0 cuda-libraries-dev-10-0 cuda-driver-dev-10-0 cuda-cudart-dev-10-0 cuda-cublas-dev-10-0 cuda-curand-dev-10-0 && sudo apt-get install -y --no-install-recommends libcudnn7-dev && sudo ln -s /usr/local/cuda-10.0/lib64/stubs/libcuda.so /usr/local/cuda-10.0/lib64/stubs/libcuda.so.1"
- os: linux
compiler: clang
name: ubuntu 14.04 - clang@3.6 - CUDA 10
name: ubuntu 14.04 - clang@3.6 - CUDA 10 - opencv@2
addons:
apt:
update: true
@ -225,13 +448,14 @@ matrix:
- libopencv-dev
- clang-3.6
env:
- additional_defines=""
- CUDACXX=/usr/local/cuda-10.0/bin/nvcc
- LD_LIBRARY_PATH="/usr/local/cuda-10.0/lib64:/usr/local/cuda-10.0/lib64/stubs:${LD_LIBRARY_PATH}"
- MATRIX_EVAL="CC=clang-3.6 && CXX=clang++-3.6 && wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1404/x86_64/cuda-repo-ubuntu1404_10.0.130-1_amd64.deb && sudo apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1404/x86_64/7fa2af80.pub && sudo dpkg -i cuda-repo-ubuntu1404_10.0.130-1_amd64.deb && wget http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1404/x86_64/nvidia-machine-learning-repo-ubuntu1404_4.0-2_amd64.deb && sudo dpkg -i nvidia-machine-learning-repo-ubuntu1404_4.0-2_amd64.deb && sudo apt-get -y update && sudo apt-get install -y --no-install-recommends cuda-compiler-10-0 cuda-libraries-dev-10-0 cuda-driver-dev-10-0 cuda-cudart-dev-10-0 cuda-cublas-dev-10-0 cuda-curand-dev-10-0 && sudo apt-get install -y --no-install-recommends libcudnn7-dev && sudo ln -s /usr/local/cuda-10.0/lib64/stubs/libcuda.so /usr/local/cuda-10.0/lib64/stubs/libcuda.so.1"
- os: linux
compiler: clang
name: ubuntu 14.04 - clang@3.8 - CUDA 10
name: ubuntu 14.04 - clang@3.8 - CUDA 10 - opencv@2
addons:
apt:
update: true
@ -241,13 +465,14 @@ matrix:
- libopencv-dev
- clang-3.8
env:
- additional_defines=""
- CUDACXX=/usr/local/cuda-10.0/bin/nvcc
- LD_LIBRARY_PATH="/usr/local/cuda-10.0/lib64:/usr/local/cuda-10.0/lib64/stubs:${LD_LIBRARY_PATH}"
- MATRIX_EVAL="CC=clang-3.8 && CXX=clang++-3.8 && wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1404/x86_64/cuda-repo-ubuntu1404_10.0.130-1_amd64.deb && sudo apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1404/x86_64/7fa2af80.pub && sudo dpkg -i cuda-repo-ubuntu1404_10.0.130-1_amd64.deb && wget http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1404/x86_64/nvidia-machine-learning-repo-ubuntu1404_4.0-2_amd64.deb && sudo dpkg -i nvidia-machine-learning-repo-ubuntu1404_4.0-2_amd64.deb && sudo apt-get -y update && sudo apt-get install -y --no-install-recommends cuda-compiler-10-0 cuda-libraries-dev-10-0 cuda-driver-dev-10-0 cuda-cudart-dev-10-0 cuda-cublas-dev-10-0 cuda-curand-dev-10-0 && sudo apt-get install -y --no-install-recommends libcudnn7-dev && sudo ln -s /usr/local/cuda-10.0/lib64/stubs/libcuda.so /usr/local/cuda-10.0/lib64/stubs/libcuda.so.1"
- os: linux
compiler: clang
name: ubuntu 14.04 - clang@3.9 - CUDA 10
name: ubuntu 14.04 - clang@3.9 - CUDA 10 - opencv@2
addons:
apt:
update: true
@ -257,13 +482,14 @@ matrix:
- libopencv-dev
- clang-3.9
env:
- additional_defines=""
- CUDACXX=/usr/local/cuda-10.0/bin/nvcc
- LD_LIBRARY_PATH="/usr/local/cuda-10.0/lib64:/usr/local/cuda-10.0/lib64/stubs:${LD_LIBRARY_PATH}"
- MATRIX_EVAL="CC=clang-3.9 && CXX=clang++-3.9 && wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1404/x86_64/cuda-repo-ubuntu1404_10.0.130-1_amd64.deb && sudo apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1404/x86_64/7fa2af80.pub && sudo dpkg -i cuda-repo-ubuntu1404_10.0.130-1_amd64.deb && wget http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1404/x86_64/nvidia-machine-learning-repo-ubuntu1404_4.0-2_amd64.deb && sudo dpkg -i nvidia-machine-learning-repo-ubuntu1404_4.0-2_amd64.deb && sudo apt-get -y update && sudo apt-get install -y --no-install-recommends cuda-compiler-10-0 cuda-libraries-dev-10-0 cuda-driver-dev-10-0 cuda-cudart-dev-10-0 cuda-cublas-dev-10-0 cuda-curand-dev-10-0 && sudo apt-get install -y --no-install-recommends libcudnn7-dev && sudo ln -s /usr/local/cuda-10.0/lib64/stubs/libcuda.so /usr/local/cuda-10.0/lib64/stubs/libcuda.so.1"
- os: linux
compiler: clang
name: ubuntu 14.04 - clang@4.0 - CUDA 10
name: ubuntu 14.04 - clang@4.0 - CUDA 10 - opencv@2
addons:
apt:
update: true
@ -273,13 +499,14 @@ matrix:
- libopencv-dev
- clang-4.0
env:
- additional_defines=""
- CUDACXX=/usr/local/cuda-10.0/bin/nvcc
- LD_LIBRARY_PATH="/usr/local/cuda-10.0/lib64:/usr/local/cuda-10.0/lib64/stubs:${LD_LIBRARY_PATH}"
- MATRIX_EVAL="CC=clang-4.0 && CXX=clang++-4.0 && wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1404/x86_64/cuda-repo-ubuntu1404_10.0.130-1_amd64.deb && sudo apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1404/x86_64/7fa2af80.pub && sudo dpkg -i cuda-repo-ubuntu1404_10.0.130-1_amd64.deb && wget http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1404/x86_64/nvidia-machine-learning-repo-ubuntu1404_4.0-2_amd64.deb && sudo dpkg -i nvidia-machine-learning-repo-ubuntu1404_4.0-2_amd64.deb && sudo apt-get -y update && sudo apt-get install -y --no-install-recommends cuda-compiler-10-0 cuda-libraries-dev-10-0 cuda-driver-dev-10-0 cuda-cudart-dev-10-0 cuda-cublas-dev-10-0 cuda-curand-dev-10-0 && sudo apt-get install -y --no-install-recommends libcudnn7-dev && sudo ln -s /usr/local/cuda-10.0/lib64/stubs/libcuda.so /usr/local/cuda-10.0/lib64/stubs/libcuda.so.1"
- os: linux
compiler: clang
name: ubuntu 14.04 - clang@5.0 - CUDA 10
name: ubuntu 14.04 - clang@5.0 - CUDA 10 - opencv@2
addons:
apt:
update: true
@ -289,13 +516,14 @@ matrix:
- libopencv-dev
- clang-5.0
env:
- additional_defines=""
- CUDACXX=/usr/local/cuda-10.0/bin/nvcc
- LD_LIBRARY_PATH="/usr/local/cuda-10.0/lib64:/usr/local/cuda-10.0/lib64/stubs:${LD_LIBRARY_PATH}"
- MATRIX_EVAL="CC=clang-5.0 && CXX=clang++-5.0 && wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1404/x86_64/cuda-repo-ubuntu1404_10.0.130-1_amd64.deb && sudo apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1404/x86_64/7fa2af80.pub && sudo dpkg -i cuda-repo-ubuntu1404_10.0.130-1_amd64.deb && wget http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1404/x86_64/nvidia-machine-learning-repo-ubuntu1404_4.0-2_amd64.deb && sudo dpkg -i nvidia-machine-learning-repo-ubuntu1404_4.0-2_amd64.deb && sudo apt-get -y update && sudo apt-get install -y --no-install-recommends cuda-compiler-10-0 cuda-libraries-dev-10-0 cuda-driver-dev-10-0 cuda-cudart-dev-10-0 cuda-cublas-dev-10-0 cuda-curand-dev-10-0 && sudo apt-get install -y --no-install-recommends libcudnn7-dev && sudo ln -s /usr/local/cuda-10.0/lib64/stubs/libcuda.so /usr/local/cuda-10.0/lib64/stubs/libcuda.so.1"
- os: linux
compiler: clang
name: ubuntu 14.04 - clang@6.0 - CUDA 10
name: ubuntu 14.04 - clang@6.0 - CUDA 10 - opencv@2
addons:
apt:
update: true
@ -306,26 +534,28 @@ matrix:
- libopencv-dev
- clang-6.0
env:
- additional_defines=""
- CUDACXX=/usr/local/cuda-10.0/bin/nvcc
- LD_LIBRARY_PATH="/usr/local/cuda-10.0/lib64:/usr/local/cuda-10.0/lib64/stubs:${LD_LIBRARY_PATH}"
- MATRIX_EVAL="CC=clang-6.0 && CXX=clang++-6.0 && wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1404/x86_64/cuda-repo-ubuntu1404_10.0.130-1_amd64.deb && sudo apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1404/x86_64/7fa2af80.pub && sudo dpkg -i cuda-repo-ubuntu1404_10.0.130-1_amd64.deb && wget http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1404/x86_64/nvidia-machine-learning-repo-ubuntu1404_4.0-2_amd64.deb && sudo dpkg -i nvidia-machine-learning-repo-ubuntu1404_4.0-2_amd64.deb && sudo apt-get -y update && sudo apt-get install -y --no-install-recommends cuda-compiler-10-0 cuda-libraries-dev-10-0 cuda-driver-dev-10-0 cuda-cudart-dev-10-0 cuda-cublas-dev-10-0 cuda-curand-dev-10-0 && sudo apt-get install -y --no-install-recommends libcudnn7-dev && sudo ln -s /usr/local/cuda-10.0/lib64/stubs/libcuda.so /usr/local/cuda-10.0/lib64/stubs/libcuda.so.1"
- os: linux
compiler: gcc
name: ubuntu 14.04 - native gcc - CUDA 10
name: ubuntu 14.04 - native gcc - CUDA 10 - opencv@2
addons:
apt:
update: true
packages:
- libopencv-dev
env:
- additional_defines=""
- CUDACXX=/usr/local/cuda-10.0/bin/nvcc
- LD_LIBRARY_PATH="/usr/local/cuda-10.0/lib64:/usr/local/cuda-10.0/lib64/stubs:${LD_LIBRARY_PATH}"
- MATRIX_EVAL="wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1404/x86_64/cuda-repo-ubuntu1404_10.0.130-1_amd64.deb && sudo apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1404/x86_64/7fa2af80.pub && sudo dpkg -i cuda-repo-ubuntu1404_10.0.130-1_amd64.deb && wget http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1404/x86_64/nvidia-machine-learning-repo-ubuntu1404_4.0-2_amd64.deb && sudo dpkg -i nvidia-machine-learning-repo-ubuntu1404_4.0-2_amd64.deb && sudo apt-get -y update && sudo apt-get install -y --no-install-recommends cuda-compiler-10-0 cuda-libraries-dev-10-0 cuda-driver-dev-10-0 cuda-cudart-dev-10-0 cuda-cublas-dev-10-0 cuda-curand-dev-10-0 && sudo apt-get install -y --no-install-recommends libcudnn7-dev && sudo ln -s /usr/local/cuda-10.0/lib64/stubs/libcuda.so /usr/local/cuda-10.0/lib64/stubs/libcuda.so.1"
- os: linux
compiler: gcc
name: ubuntu 14.04 - gcc@4.9 - CUDA 10
name: ubuntu 14.04 - gcc@4.9 - CUDA 10 - opencv@2
addons:
apt:
update: true
@ -335,13 +565,14 @@ matrix:
- libopencv-dev
- g++-4.9
env:
- additional_defines=""
- CUDACXX=/usr/local/cuda-10.0/bin/nvcc
- LD_LIBRARY_PATH="/usr/local/cuda-10.0/lib64:/usr/local/cuda-10.0/lib64/stubs:${LD_LIBRARY_PATH}"
- MATRIX_EVAL="CC=gcc-4.9 && CXX=g++-4.9 && wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1404/x86_64/cuda-repo-ubuntu1404_10.0.130-1_amd64.deb && sudo apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1404/x86_64/7fa2af80.pub && sudo dpkg -i cuda-repo-ubuntu1404_10.0.130-1_amd64.deb && wget http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1404/x86_64/nvidia-machine-learning-repo-ubuntu1404_4.0-2_amd64.deb && sudo dpkg -i nvidia-machine-learning-repo-ubuntu1404_4.0-2_amd64.deb && sudo apt-get -y update && sudo apt-get install -y --no-install-recommends cuda-compiler-10-0 cuda-libraries-dev-10-0 cuda-driver-dev-10-0 cuda-cudart-dev-10-0 cuda-cublas-dev-10-0 cuda-curand-dev-10-0 && sudo apt-get install -y --no-install-recommends libcudnn7-dev && sudo ln -s /usr/local/cuda-10.0/lib64/stubs/libcuda.so /usr/local/cuda-10.0/lib64/stubs/libcuda.so.1"
- os: linux
compiler: gcc
name: ubuntu 14.04 - gcc@5.0 - CUDA 10
name: ubuntu 14.04 - gcc@5.0 - CUDA 10 - opencv@2
addons:
apt:
update: true
@ -351,13 +582,14 @@ matrix:
- libopencv-dev
- g++-5
env:
- additional_defines=""
- CUDACXX=/usr/local/cuda-10.0/bin/nvcc
- LD_LIBRARY_PATH="/usr/local/cuda-10.0/lib64:/usr/local/cuda-10.0/lib64/stubs:${LD_LIBRARY_PATH}"
- MATRIX_EVAL="CC=gcc-5 && CXX=g++-5 && wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1404/x86_64/cuda-repo-ubuntu1404_10.0.130-1_amd64.deb && sudo apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1404/x86_64/7fa2af80.pub && sudo dpkg -i cuda-repo-ubuntu1404_10.0.130-1_amd64.deb && wget http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1404/x86_64/nvidia-machine-learning-repo-ubuntu1404_4.0-2_amd64.deb && sudo dpkg -i nvidia-machine-learning-repo-ubuntu1404_4.0-2_amd64.deb && sudo apt-get -y update && sudo apt-get install -y --no-install-recommends cuda-compiler-10-0 cuda-libraries-dev-10-0 cuda-driver-dev-10-0 cuda-cudart-dev-10-0 cuda-cublas-dev-10-0 cuda-curand-dev-10-0 && sudo apt-get install -y --no-install-recommends libcudnn7-dev && sudo ln -s /usr/local/cuda-10.0/lib64/stubs/libcuda.so /usr/local/cuda-10.0/lib64/stubs/libcuda.so.1"
- os: linux
compiler: gcc
name: ubuntu 14.04 - gcc@6.0 - CUDA 10
name: ubuntu 14.04 - gcc@6.0 - CUDA 10 - opencv@2
addons:
apt:
update: true
@ -367,13 +599,14 @@ matrix:
- g++-6
- libopencv-dev
env:
- additional_defines=""
- CUDACXX=/usr/local/cuda-10.0/bin/nvcc
- LD_LIBRARY_PATH="/usr/local/cuda-10.0/lib64:/usr/local/cuda-10.0/lib64/stubs:${LD_LIBRARY_PATH}"
- MATRIX_EVAL="CC=gcc-6 && CXX=g++-6 && wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1404/x86_64/cuda-repo-ubuntu1404_10.0.130-1_amd64.deb && sudo apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1404/x86_64/7fa2af80.pub && sudo dpkg -i cuda-repo-ubuntu1404_10.0.130-1_amd64.deb && wget http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1404/x86_64/nvidia-machine-learning-repo-ubuntu1404_4.0-2_amd64.deb && sudo dpkg -i nvidia-machine-learning-repo-ubuntu1404_4.0-2_amd64.deb && sudo apt-get -y update && sudo apt-get install -y --no-install-recommends cuda-compiler-10-0 cuda-libraries-dev-10-0 cuda-driver-dev-10-0 cuda-cudart-dev-10-0 cuda-cublas-dev-10-0 cuda-curand-dev-10-0 && sudo apt-get install -y --no-install-recommends libcudnn7-dev && sudo ln -s /usr/local/cuda-10.0/lib64/stubs/libcuda.so /usr/local/cuda-10.0/lib64/stubs/libcuda.so.1"
- os: linux
compiler: gcc
name: ubuntu 14.04 - gcc@7.0 - CUDA 10
name: ubuntu 14.04 - gcc@7.0 - CUDA 10 - opencv@2
addons:
apt:
update: true
@ -383,13 +616,14 @@ matrix:
- libopencv-dev
- g++-7
env:
- additional_defines=""
- CUDACXX=/usr/local/cuda-10.0/bin/nvcc
- LD_LIBRARY_PATH="/usr/local/cuda-10.0/lib64:/usr/local/cuda-10.0/lib64/stubs:${LD_LIBRARY_PATH}"
- MATRIX_EVAL="CC=gcc-7 && CXX=g++-7 && wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1404/x86_64/cuda-repo-ubuntu1404_10.0.130-1_amd64.deb && sudo apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1404/x86_64/7fa2af80.pub && sudo dpkg -i cuda-repo-ubuntu1404_10.0.130-1_amd64.deb && wget http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1404/x86_64/nvidia-machine-learning-repo-ubuntu1404_4.0-2_amd64.deb && sudo dpkg -i nvidia-machine-learning-repo-ubuntu1404_4.0-2_amd64.deb && sudo apt-get -y update && sudo apt-get install -y --no-install-recommends cuda-compiler-10-0 cuda-libraries-dev-10-0 cuda-driver-dev-10-0 cuda-cudart-dev-10-0 cuda-cublas-dev-10-0 cuda-curand-dev-10-0 && sudo apt-get install -y --no-install-recommends libcudnn7-dev && sudo ln -s /usr/local/cuda-10.0/lib64/stubs/libcuda.so /usr/local/cuda-10.0/lib64/stubs/libcuda.so.1"
- os: linux
compiler: gcc
name: ubuntu 14.04 - gcc@8.0 - CUDA 10
name: ubuntu 14.04 - gcc@8.0 - CUDA 10 - opencv@2
addons:
apt:
update: true
@ -399,6 +633,7 @@ matrix:
- libopencv-dev
- g++-8
env:
- additional_defines=""
- CUDACXX=/usr/local/cuda-10.0/bin/nvcc
- LD_LIBRARY_PATH="/usr/local/cuda-10.0/lib64:/usr/local/cuda-10.0/lib64/stubs:${LD_LIBRARY_PATH}"
- MATRIX_EVAL="CC=gcc-8 && CXX=g++-8 && wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1404/x86_64/cuda-repo-ubuntu1404_10.0.130-1_amd64.deb && sudo apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1404/x86_64/7fa2af80.pub && sudo dpkg -i cuda-repo-ubuntu1404_10.0.130-1_amd64.deb && wget http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1404/x86_64/nvidia-machine-learning-repo-ubuntu1404_4.0-2_amd64.deb && sudo dpkg -i nvidia-machine-learning-repo-ubuntu1404_4.0-2_amd64.deb && sudo apt-get -y update && sudo apt-get install -y --no-install-recommends cuda-compiler-10-0 cuda-libraries-dev-10-0 cuda-driver-dev-10-0 cuda-cudart-dev-10-0 cuda-cublas-dev-10-0 cuda-curand-dev-10-0 && sudo apt-get install -y --no-install-recommends libcudnn7-dev && sudo ln -s /usr/local/cuda-10.0/lib64/stubs/libcuda.so /usr/local/cuda-10.0/lib64/stubs/libcuda.so.1"
@ -413,13 +648,14 @@ install:
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then export PATH=$PWD/cmake-3.13.4-Linux-x86_64/bin:$PATH ;fi
before_script:
- echo ${additional_defines}
- mkdir build_debug
- cd build_debug
- cmake .. -DCMAKE_BUILD_TYPE="Debug"
- cmake .. -DCMAKE_BUILD_TYPE="Debug" ${additional_defines}
- cd ..
- mkdir build_release
- cd build_release
- cmake .. -DCMAKE_BUILD_TYPE="Release"
- cmake .. -DCMAKE_BUILD_TYPE="Release" ${additional_defines}
- cd ..
script:

@ -262,7 +262,7 @@ endif()
target_compile_definitions(darklib PRIVATE LIB_EXPORTS=1)
set_target_properties(darklib PROPERTIES LINKER_LANGUAGE CXX)
if(OpenCV_VERSION VERSION_GREATER "3.0" AND NOT SKIP_USELIB_TRACK)
if(OpenCV_FOUND AND OpenCV_VERSION VERSION_GREATER "3.0" AND NOT SKIP_USELIB_TRACK)
add_executable(uselib_track ${CMAKE_CURRENT_LIST_DIR}/src/yolo_console_dll.cpp)
target_compile_definitions(uselib_track PRIVATE TRACK_OPTFLOW=1)
set_target_properties(uselib_track PROPERTIES LINKER_LANGUAGE CXX)
@ -324,7 +324,7 @@ if(ENABLE_CUDA)
endif()
target_link_libraries(uselib PRIVATE darklib)
if(OpenCV_VERSION VERSION_GREATER "3.0" AND NOT SKIP_USELIB_TRACK)
if(OpenCV_FOUND AND OpenCV_VERSION VERSION_GREATER "3.0" AND NOT SKIP_USELIB_TRACK)
target_link_libraries(uselib_track PRIVATE darklib)
endif()
@ -340,7 +340,7 @@ install(TARGETS darklib EXPORT DarknetTargets
install(TARGETS uselib darknet
DESTINATION "${INSTALL_BIN_DIR}"
)
if(OpenCV_VERSION VERSION_GREATER "3.0" AND NOT SKIP_USELIB_TRACK)
if(OpenCV_FOUND AND OpenCV_VERSION VERSION_GREATER "3.0" AND NOT SKIP_USELIB_TRACK)
install(TARGETS uselib_track
DESTINATION "${INSTALL_BIN_DIR}"
)

@ -44,10 +44,10 @@ More details: http://pjreddie.com/darknet/yolo/
* Windows or Linux
* **CMake >= 3.8** for modern CUDA support: https://cmake.org/download/
* **CUDA 10.0**: https://developer.nvidia.com/cuda-toolkit-archive (on Linux do [Post-installation Actions](https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#post-installation-actions))
* **OpenCV < 4.0**: use your preferred package manager (brew, apt), build from source using [vcpkg](https://github.com/Microsoft/vcpkg) or download from [OpenCV official site](https://opencv.org/releases.html) (on Windows set system variable `OPENCV_DIR` = `C:\opencv\build` - where are the `include` and `x64` folders [image](https://user-images.githubusercontent.com/4096485/53249516-5130f480-36c9-11e9-8238-a6e82e48c6f2.png))
* **OpenCV < 4.0**: use your preferred package manager (brew, apt), build from source using [vcpkg](https://github.com/Microsoft/vcpkg) or download from [OpenCV official site](https://opencv.org/releases.html) (on Windows set system variable `OpenCV_DIR` = `C:\opencv\build` - where are the `include` and `x64` folders [image](https://user-images.githubusercontent.com/4096485/53249516-5130f480-36c9-11e9-8238-a6e82e48c6f2.png))
* **cuDNN >= 7.0 for CUDA 10.0** https://developer.nvidia.com/rdp/cudnn-archive (on **Linux** copy `cudnn.h`,`libcudnn.so`... as desribed here https://docs.nvidia.com/deeplearning/sdk/cudnn-install/index.html#installlinux-tar , on **Windows** copy `cudnn.h`,`cudnn64_7.dll`, `cudnn64_7.lib` as desribed here https://docs.nvidia.com/deeplearning/sdk/cudnn-install/index.html#installwindows )
* **GPU with CC >= 3.0**: https://en.wikipedia.org/wiki/CUDA#GPUs_supported
* on Linux **GCC or Clang**, on Windows **MSVS 2017 (v15)** https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=Community&rel=15#
* on Linux **GCC or Clang**, on Windows **MSVC 2015/2017/2019** https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=Community
Compiling on **Windows** by using `Cmake-GUI` as on this [**IMAGE**](https://user-images.githubusercontent.com/4096485/55107892-6becf380-50e3-11e9-9a0a-556a943c429a.png): Configure -> Optional platform for generator (Set: x64) -> Finish -> Generate -> Open Project -> x64 & Release -> Build -> Build solution
@ -169,11 +169,11 @@ To run Darknet on Linux use examples from this article, just use `./darknet` ins
### How to compile on Windows (using `vcpkg`)
If you have installed: MSVS 2015/2017, CUDA 10, cuDNN 7.x, OpenCV 3.x. Then compile Darknet by using `C:\Program Files\CMake\bin\cmake-gui.exe` as on this [**IMAGE**](https://user-images.githubusercontent.com/4096485/55107892-6becf380-50e3-11e9-9a0a-556a943c429a.png): Configure -> Optional platform for generator (Set: x64) -> Finish -> Generate -> Open Project -> x64 & Release -> Build -> Build solution
If you have already installed Visual Studio 2015/2017/2019, CUDA 10, cuDNN 7.x, OpenCV 3.x, then compile Darknet by using `C:\Program Files\CMake\bin\cmake-gui.exe` as on this [**IMAGE**](https://user-images.githubusercontent.com/4096485/55107892-6becf380-50e3-11e9-9a0a-556a943c429a.png): Configure -> Optional platform for generator (Set: x64) -> Finish -> Generate -> Open Project -> x64 & Release -> Build -> Build solution
Otherwise:
Otherwise, follow these steps:
1. Install or update Visual Studio to at least version 2017, making sure to have it fully patched (run again the installer if not sure to automatically update to latest version). If you need to install from scratch, download VS from here: [Visual Studio 2017 Community](http://visualstudio.com)
1. Install or update Visual Studio to at least version 2017, making sure to have it fully patched (run again the installer if not sure to automatically update to latest version). If you need to install from scratch, download VS from here: [Visual Studio Community](http://visualstudio.com)
2. Install CUDA and cuDNN
@ -185,7 +185,7 @@ Otherwise:
6. Define another environment variable, with name `VCPKG_DEFAULT_TRIPLET` and value `x64-windows`
7. Open a Powershell (as a standard user) and type (the last command requires a confirmation and is used to clean up unnecessary files)
7. Open Powershell and type these commands:
```PowerShell
PS \> cd $env:VCPKG_ROOT
@ -194,11 +194,11 @@ PS Code\vcpkg> .\vcpkg install pthreads opencv[ffmpeg] #replace with ope
8. [necessary only with CUDA] Customize the `build.ps1` script enabling the appropriate `my_cuda_compute_model` line. If not manually defined, CMake toolchain will automatically use the very low 3.0 CUDA compute model
9. Build with the Powershell script `build.ps1`. If you want to use Visual Studio, you will find a custom solution created for you by CMake after the build containing all the appropriate config flags for your system.
9. Open Powershell, go to the `darknet` folder and build with the command `.\build.ps1`. If you want to use Visual Studio, you will find two custom solutions created for you by CMake after the build, one in `build_win_debug` and the other in `build_win_release`, containing all the appropriate config flags for your system.
### How to compile on Windows (legacy way)
1. If you have **MSVS 2015, CUDA 10.0, cuDNN 7.4 and OpenCV 3.x** (with paths: `C:\opencv_3.0\opencv\build\include` & `C:\opencv_3.0\opencv\build\x64\vc14\lib`), then start MSVS, open `build\darknet\darknet.sln`, set **x64** and **Release** https://hsto.org/webt/uh/fk/-e/uhfk-eb0q-hwd9hsxhrikbokd6u.jpeg and do the: Build -> Build darknet. Also add Windows system variable `CUDNN` with path to CUDNN: https://user-images.githubusercontent.com/4096485/53249764-019ef880-36ca-11e9-8ffe-d9cf47e7e462.jpg **NOTE:** If installing OpenCV, use OpenCV 3.4.0 or earlier. This is a bug in OpenCV 3.4.1 in the C API (see [#500](https://github.com/AlexeyAB/darknet/issues/500)).
1. If you have **CUDA 10.0, cuDNN 7.4 and OpenCV 3.x** (with paths: `C:\opencv_3.0\opencv\build\include` & `C:\opencv_3.0\opencv\build\x64\vc14\lib`), then open `build\darknet\darknet.sln`, set **x64** and **Release** https://hsto.org/webt/uh/fk/-e/uhfk-eb0q-hwd9hsxhrikbokd6u.jpeg and do the: Build -> Build darknet. Also add Windows system variable `CUDNN` with path to CUDNN: https://user-images.githubusercontent.com/4096485/53249764-019ef880-36ca-11e9-8ffe-d9cf47e7e462.jpg **NOTE:** If installing OpenCV, use OpenCV 3.4.0 or earlier. This is a bug in OpenCV 3.4.1 in the C API (see [#500](https://github.com/AlexeyAB/darknet/issues/500)).
1.1. Find files `opencv_world320.dll` and `opencv_ffmpeg320_64.dll` (or `opencv_world340.dll` and `opencv_ffmpeg340_64.dll`) in `C:\opencv_3.0\opencv\build\x64\vc14\bin` and put it near with `darknet.exe`
@ -216,7 +216,7 @@ PS Code\vcpkg> .\vcpkg install pthreads opencv[ffmpeg] #replace with ope
2. If you have other version of **CUDA (not 10.0)** then open `build\darknet\darknet.vcxproj` by using Notepad, find 2 places with "CUDA 10.0" and change it to your CUDA-version. Then open `\darknet.sln` -> (right click on project) -> properties -> CUDA C/C++ -> Device and remove there `;compute_75,sm_75`. Then do step 1
3. If you **don't have GPU**, but have **MSVS 2015 and OpenCV 3.0** (with paths: `C:\opencv_3.0\opencv\build\include` & `C:\opencv_3.0\opencv\build\x64\vc14\lib`), then start MSVS, open `build\darknet\darknet_no_gpu.sln`, set **x64** and **Release**, and do the: Build -> Build darknet_no_gpu
3. If you **don't have GPU**, but have **OpenCV 3.0** (with paths: `C:\opencv_3.0\opencv\build\include` & `C:\opencv_3.0\opencv\build\x64\vc14\lib`), then open `build\darknet\darknet_no_gpu.sln`, set **x64** and **Release**, and do the: Build -> Build darknet_no_gpu
4. If you have **OpenCV 2.4.13** instead of 3.0 then you should change paths after `\darknet.sln` is opened
@ -227,7 +227,7 @@ PS Code\vcpkg> .\vcpkg install pthreads opencv[ffmpeg] #replace with ope
5. If you have GPU with Tensor Cores (nVidia Titan V / Tesla V100 / DGX-2 and later) speedup Detection 3x, Training 2x:
`\darknet.sln` -> (right click on project) -> properties -> C/C++ -> Preprocessor -> Preprocessor Definitions, and add here: `CUDNN_HALF;`
**Note:** CUDA must be installed only after that MSVS2015 had been installed.
**Note:** CUDA must be installed only after Visual Studio has been installed.
### How to compile (custom):
@ -605,11 +605,11 @@ There are 2 APIs:
----
1. To compile Yolo as C++ DLL-file `yolo_cpp_dll.dll` - open in MSVS2015 file `build\darknet\yolo_cpp_dll.sln`, set **x64** and **Release**, and do the: Build -> Build yolo_cpp_dll
1. To compile Yolo as C++ DLL-file `yolo_cpp_dll.dll` - open the solution `build\darknet\yolo_cpp_dll.sln`, set **x64** and **Release**, and do the: Build -> Build yolo_cpp_dll
* You should have installed **CUDA 10.0**
* To use cuDNN do: (right click on project) -> properties -> C/C++ -> Preprocessor -> Preprocessor Definitions, and add at the beginning of line: `CUDNN;`
2. To use Yolo as DLL-file in your C++ console application - open in MSVS2015 file `build\darknet\yolo_console_dll.sln`, set **x64** and **Release**, and do the: Build -> Build yolo_console_dll
2. To use Yolo as DLL-file in your C++ console application - open the solution `build\darknet\yolo_console_dll.sln`, set **x64** and **Release**, and do the: Build -> Build yolo_console_dll
* you can run your console application from Windows Explorer `build\darknet\x64\yolo_console_dll.exe`
**use this command**: `yolo_console_dll.exe data/coco.names yolov3.cfg yolov3.weights test.mp4`

@ -15,6 +15,55 @@ $force_using_include_libs=$false
#$my_cuda_compute_model=35 #Compute capability for Tesla K20/K40
#$my_cuda_compute_model=30 #Compute capability for Tesla K10, Quadro K4000
function getProgramFiles32bit() {
$out = ${env:PROGRAMFILES(X86)}
if ($null -eq $out) {
$out = ${env:PROGRAMFILES}
}
if ($null -eq $out) {
throw "Could not find [Program Files 32-bit]"
}
return $out
}
function getLatestVisualStudioWithDesktopWorkloadPath() {
$programFiles = getProgramFiles32bit
$vswhereExe = "$programFiles\Microsoft Visual Studio\Installer\vswhere.exe"
if (Test-Path $vswhereExe) {
$output = & $vswhereExe -latest -requires Microsoft.VisualStudio.Workload.NativeDesktop -format xml
[xml]$asXml = $output
foreach ($instance in $asXml.instances.instance)
{
$installationPath = $instance.InstallationPath -replace "\\$" # Remove potential trailing backslash
}
}
else {
Write-Verbose "Could not locate vswhere at $vswhereExe"
}
return $installationPath
}
function getLatestVisualStudioWithDesktopWorkloadVersion() {
$programFiles = getProgramFiles32bit
$vswhereExe = "$programFiles\Microsoft Visual Studio\Installer\vswhere.exe"
if (Test-Path $vswhereExe) {
$output = & $vswhereExe -latest -requires Microsoft.VisualStudio.Workload.NativeDesktop -format xml
[xml]$asXml = $output
foreach ($instance in $asXml.instances.instance)
{
$installationVersion = $instance.InstallationVersion
}
}
else {
Write-Verbose "Could not locate vswhere at $vswhereExe"
}
return $installationVersion
}
if ((Test-Path env:VCPKG_ROOT) -and -not $force_using_include_libs) {
$vcpkg_path = "$env:VCPKG_ROOT"
Write-Host "Found vcpkg in VCPKG_ROOT: $vcpkg_path"
@ -40,19 +89,9 @@ if ($vcpkg_triplet -Match "x86") {
}
if ($null -eq (Get-Command "cl.exe" -ErrorAction SilentlyContinue)) {
$vstype = "Professional"
if (Test-Path "C:\Program Files (x86)\Microsoft Visual Studio\2017\${vstype}\Common7\Tools") {
}
else {
$vstype = "Enterprise"
if (Test-Path "C:\Program Files (x86)\Microsoft Visual Studio\2017\${vstype}\Common7\Tools") {
}
else {
$vstype = "Community"
}
}
Write-Host "Found VS 2017 ${vstype}"
Push-Location "C:\Program Files (x86)\Microsoft Visual Studio\2017\${vstype}\Common7\Tools"
$vsfound=getLatestVisualStudioWithDesktopWorkloadPath
Write-Host "Found VS in ${vsfound}"
Push-Location "${vsfound}\Common7\Tools"
cmd /c "VsDevCmd.bat -arch=x64 & set" |
ForEach-Object {
if ($_ -match "=") {
@ -60,12 +99,29 @@ if ($null -eq (Get-Command "cl.exe" -ErrorAction SilentlyContinue)) {
}
}
Pop-Location
Write-Host "Visual Studio 2017 ${vstype} Command Prompt variables set.`n" -ForegroundColor Yellow
Write-Host "Visual Studio Command Prompt variables set`n" -ForegroundColor Yellow
}
$tokens = getLatestVisualStudioWithDesktopWorkloadVersion
$tokens = $tokens.split('.')
if ($tokens[0] -eq "14") {
$generator = "Visual Studio 14 2015"
}
elseif ($tokens[0] -eq "15") {
$generator = "Visual Studio 15 2017"
}
elseif ($tokens[0] -eq "16") {
$generator = "Visual Studio 16 2019"
}
else {
throw "Unknown Visual Studio version, unsupported configuration"
}
Write-Host "Setting up environment to use CMake generator: $generator`n" -ForegroundColor Yellow
if ($null -eq (Get-Command "nvcc.exe" -ErrorAction SilentlyContinue)) {
if (Test-Path env:CUDA_PATH) {
$env:PATH += ";${env:CUDA_PATH}\bin"
Write-Host "Found cuda in ${env:CUDA_PATH}`n" -ForegroundColor Yellow
}
else {
Write-Host "Unable to find CUDA, if necessary please install it or define a CUDA_PATH env variable pointing to the install folder`n" -ForegroundColor Yellow
@ -77,17 +133,21 @@ if (Test-Path env:CUDA_PATH) {
$env:CUDA_TOOLKIT_ROOT_DIR = "${env:CUDA_PATH}"
Write-Host "Added missing env variable CUDA_TOOLKIT_ROOT_DIR`n" -ForegroundColor Yellow
}
}
if($my_cuda_compute_model) {
if ($my_cuda_compute_model) {
$additional_build_setup = "-DCUDA_COMPUTE_MODEL=${my_cuda_compute_model}"
Write-Host "Using compute capability ${my_cuda_compute_model}`n" -ForegroundColor Yellow
}
else {
Write-Host "Using default compute capability`n" -ForegroundColor Yellow
}
}
if ($vcpkg_path) {
# DEBUG
New-Item -Path .\build_win_debug -ItemType directory -Force
Set-Location build_win_debug
cmake -G "Visual Studio 15 2017" -T "host=x64" -A "x64" "-DCMAKE_TOOLCHAIN_FILE=$vcpkg_path\scripts\buildsystems\vcpkg.cmake" "-DVCPKG_TARGET_TRIPLET=$vcpkg_triplet" "-DCMAKE_BUILD_TYPE=Debug" $additional_build_setup ..
cmake -G "$generator" -T "host=x64" -A "x64" "-DCMAKE_TOOLCHAIN_FILE=$vcpkg_path\scripts\buildsystems\vcpkg.cmake" "-DVCPKG_TARGET_TRIPLET=$vcpkg_triplet" "-DCMAKE_BUILD_TYPE=Debug" $additional_build_setup ..
cmake --build . --config Debug --target install
#cmake --build . --config Debug --parallel ${number_of_build_workers} --target install #valid only for CMake 3.12+
Remove-Item DarknetConfig.cmake
@ -98,7 +158,7 @@ if ($vcpkg_path) {
# RELEASE
New-Item -Path .\build_win_release -ItemType directory -Force
Set-Location build_win_release
cmake -G "Visual Studio 15 2017" -T "host=x64" -A "x64" "-DCMAKE_TOOLCHAIN_FILE=$vcpkg_path\scripts\buildsystems\vcpkg.cmake" "-DVCPKG_TARGET_TRIPLET=$vcpkg_triplet" "-DCMAKE_BUILD_TYPE=Release" $additional_build_setup ..
cmake -G "$generator" -T "host=x64" -A "x64" "-DCMAKE_TOOLCHAIN_FILE=$vcpkg_path\scripts\buildsystems\vcpkg.cmake" "-DVCPKG_TARGET_TRIPLET=$vcpkg_triplet" "-DCMAKE_BUILD_TYPE=Release" $additional_build_setup ..
cmake --build . --config Release --target install
#cmake --build . --config Release --parallel ${number_of_build_workers} --target install #valid only for CMake 3.12+
Remove-Item DarknetConfig.cmake
@ -112,12 +172,12 @@ else {
# if you want to manually force this case, remove VCPKG_ROOT env variable and remember to use "vcpkg integrate remove" in case you had enabled user-wide vcpkg integration
New-Item -Path .\build_win_release_novcpkg -ItemType directory -Force
Set-Location build_win_release_novcpkg
cmake -G "Visual Studio 15 2017" -T "host=x64" -A "x64" $additional_build_setup ..
cmake -G "$generator" -T "host=x64" -A "x64" $additional_build_setup ..
cmake --build . --config Release --target install
#cmake --build . --config Release --parallel ${number_of_build_workers} --target install #valid only for CMake 3.12+
Remove-Item DarknetConfig.cmake
Remove-Item DarknetConfigVersion.cmake
Copy-Item ..\3rdparty\pthreads\bin\pthreadVC2.dll ..
Copy-Item ..\3rdparty\pthreads\bin\*.dll ..
Set-Location ..
Copy-Item cmake\Modules\*.cmake share\darknet\
}

@ -14,24 +14,43 @@
#my_cuda_compute_model=30 #Compute capability for Tesla K10, Quadro K4000
number_of_build_workers=8
bypass_vcpkg=true
if [[ "$OSTYPE" == "darwin"* ]]; then
OpenCV_DIR="/usr/local/Cellar/opencv@3/3.4.5"
additional_defines="-DOpenCV_DIR=${OpenCV_DIR}"
if [[ "$1" == "gcc" ]]; then
export CC="/usr/local/bin/gcc-8"
export CXX="/usr/local/bin/g++-8"
fi
vcpkg_triplet="x64-darwin"
else
vcpkg_triplet="x64-linux"
fi
if [[ ! -z "$my_cuda_compute_model" ]]; then
additional_build_setup="-DCUDA_COMPUTE_MODEL=${my_cuda_compute_model}"
fi
if [[ -d ${VCPKG_ROOT} ]] && [ ! "$bypass_vcpkg" = true ]
then
vcpkg_path="${VCPKG_ROOT}"
vcpkg_define="-DCMAKE_TOOLCHAIN_FILE=${vcpkg_path}/scripts/buildsystems/vcpkg.cmake"
vcpkg_triplet_define="-DVCPKG_TARGET_TRIPLET=$vcpkg_triplet"
echo "Found vcpkg in VCPKG_ROOT: ${vcpkg_path}"
elif [ -d ${WORKSPACE}/vcpkg${vcpkg_fork} ] && [ ! "$bypass_vcpkg" = true ]
then
vcpkg_path="${WORKSPACE}/vcpkg"
vcpkg_define="-DCMAKE_TOOLCHAIN_FILE=${vcpkg_path}/scripts/buildsystems/vcpkg.cmake"
vcpkg_triplet_define="-DVCPKG_TARGET_TRIPLET=$vcpkg_triplet"
echo "Found vcpkg in WORKSPACE/vcpkg: ${vcpkg_path}"
elif [ ! "$bypass_vcpkg" = true ]
then
(>&2 echo "darknet is unsupported without vcpkg, use at your own risk!")
fi
# RELEASE
mkdir -p build_release
cd build_release
cmake .. -DCMAKE_BUILD_TYPE=Release ${additional_defines} ${additional_build_setup}
cmake .. -DCMAKE_BUILD_TYPE=Release ${vcpkg_define} ${vcpkg_triplet_define} ${additional_defines} ${additional_build_setup}
cmake --build . --target install -- -j${number_of_build_workers}
#cmake --build . --target install --parallel ${number_of_build_workers} #valid only for CMake 3.12+
rm -f DarknetConfig.cmake
@ -42,7 +61,7 @@ cp cmake/Modules/*.cmake share/darknet
# DEBUG
mkdir -p build_debug
cd build_debug
cmake .. -DCMAKE_BUILD_TYPE=Debug ${additional_defines} ${additional_build_setup}
cmake .. -DCMAKE_BUILD_TYPE=Debug ${vcpkg_define} ${vcpkg_triplet_define} ${additional_defines} ${additional_build_setup}
cmake --build . --target install -- -j${number_of_build_workers}
#cmake --build . --target install --parallel ${number_of_build_workers} #valid only for CMake 3.12+
rm -f DarknetConfig.cmake

Loading…
Cancel
Save