aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefano Sinigardi <stesinigardi@hotmail.com>2019-06-28 22:48:42 +0200
committerVictor Romero <romerosanchezv@gmail.com>2019-06-28 13:48:42 -0700
commit79175994c22effa9b3d945077837cdca5d370681 (patch)
tree9f7b5cff84aa7bf1a30d344c7fe427df4ab0caf4
parentb4675fd65a5baebe93d0e60e082ae43013ed246f (diff)
downloadvcpkg-79175994c22effa9b3d945077837cdca5d370681.tar.gz
vcpkg-79175994c22effa9b3d945077837cdca5d370681.zip
[darknet] enable ninja (#7064)
* [darknet] enable ninja * Bump CONTROL version
-rw-r--r--ports/darknet/CONTROL2
-rw-r--r--ports/darknet/portfile.cmake22
2 files changed, 13 insertions, 11 deletions
diff --git a/ports/darknet/CONTROL b/ports/darknet/CONTROL
index 393503485..d31d4ef1d 100644
--- a/ports/darknet/CONTROL
+++ b/ports/darknet/CONTROL
@@ -1,5 +1,5 @@
Source: darknet
-Version: 0.2.5-3
+Version: 0.2.5-4
Description: Darknet is an open source neural network framework written in C and CUDA. You only look once (YOLO) is a state-of-the-art, real-time object detection system, best example of darknet functionalities.
Build-Depends: pthreads (windows), stb
Default-Features: weights
diff --git a/ports/darknet/portfile.cmake b/ports/darknet/portfile.cmake
index 3733420ad..3fb49e687 100644
--- a/ports/darknet/portfile.cmake
+++ b/ports/darknet/portfile.cmake
@@ -16,21 +16,23 @@ vcpkg_from_github(
HEAD_REF master
)
-set(ENABLE_CUDA OFF)
-if("cuda" IN_LIST FEATURES)
- set(ENABLE_CUDA ON)
-endif()
-
-set(ENABLE_OPENCV OFF)
-if("opencv" IN_LIST FEATURES)
- set(ENABLE_OPENCV ON)
-endif()
+vcpkg_check_features(
+ "cuda" ENABLE_CUDA
+ "opencv" ENABLE_OPENCV
+)
if("opencv-cuda" IN_LIST FEATURES)
set(ENABLE_OPENCV ON)
set(ENABLE_CUDA ON)
endif()
+if (ENABLE_CUDA)
+ if (NOT VCPKG_CMAKE_SYSTEM_NAME AND NOT ENV{CUDACXX})
+ #CMake looks for nvcc only in PATH and CUDACXX env vars for the Ninja generator. Since we filter path on vcpkg and CUDACXX env var is not set by CUDA installer on Windows, CMake cannot find CUDA when using Ninja generator, so we need to manually enlight it if necessary (https://gitlab.kitware.com/cmake/cmake/issues/19173). Otherwise we could just disable Ninja and use MSBuild, but unfortunately CUDA installer does not integrate with some distributions of MSBuild (like the ones inside Build Tools), making CUDA unavailable otherwise in those cases, which we want to avoid
+ set(ENV{CUDACXX} "$ENV{CUDA_PATH}/bin/nvcc.exe")
+ endif()
+endif()
+
if("weights" IN_LIST FEATURES)
vcpkg_download_distfile(YOLOV3_WEIGHTS
URLS "https://pjreddie.com/media/files/yolov3.weights"
@@ -60,7 +62,7 @@ file(REMOVE_RECURSE ${SOURCE_PATH}/3rdparty)
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
DISABLE_PARALLEL_CONFIGURE #since darknet configures a file inside source tree, it is better to disable parallel configure
- #PREFER_NINJA #it does not work with cuda on windows https://gitlab.kitware.com/cmake/cmake/issues/19173
+ PREFER_NINJA
OPTIONS
-DINSTALL_BIN_DIR:STRING=bin
-DINSTALL_LIB_DIR:STRING=lib