Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[darknet] enable ninja #7064

Merged
merged 3 commits into from
Jun 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ports/darknet/CONTROL
Original file line number Diff line number Diff line change
@@ -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
Expand Down
22 changes: 12 additions & 10 deletions ports/darknet/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down