mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-10 08:59:01 +08:00
8eb76645c0
* [pthreads4w] update for single config builds, improve downstream compatibility * [darknet] remove integrated pthreads cmake module * [pthreads4w] use config instead of module naming * fix library search path * improve downstream compatibility even more * fix references * do not store deprecated symbols in PThreads4W cmake config * fix references * [pthreads4w] add license * fix references * Update ports/pthreads/vcpkg.json Co-authored-by: Billy O'Neal <bion@microsoft.com> * add usage * update refs Co-authored-by: Billy O'Neal <bion@microsoft.com>
62 lines
2.9 KiB
CMake
62 lines
2.9 KiB
CMake
vcpkg_from_github(
|
|
OUT_SOURCE_PATH SOURCE_PATH
|
|
REPO AlexeyAB/darknet
|
|
REF 8a0bf84c19e38214219dbd3345f04ce778426c57
|
|
SHA512 6253d5b498f4f6eba7fc539d5a4b4e163139f4841623f11d84760bcf1ffabe6519f85e98e3d4aeac6846313fea3b98451407134b6b6f5b91137c62d1647109d9
|
|
HEAD_REF master
|
|
)
|
|
|
|
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
|
|
FEATURES
|
|
cuda ENABLE_CUDA
|
|
cudnn ENABLE_CUDNN
|
|
)
|
|
|
|
#do not move following features to vcpkg_check_features because they break themselves: one off will turn off the others even if true
|
|
set(ENABLE_OPENCV FALSE)
|
|
if ("opencv-base" IN_LIST FEATURES OR "opencv2-base" IN_LIST FEATURES OR "opencv3-base" IN_LIST FEATURES OR "opencv-cuda" IN_LIST FEATURES OR "opencv2-cuda" IN_LIST FEATURES OR "opencv3-cuda" IN_LIST FEATURES)
|
|
set(ENABLE_OPENCV TRUE)
|
|
endif()
|
|
|
|
if ("cuda" IN_LIST FEATURES)
|
|
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()
|
|
|
|
#make sure we don't use any integrated pre-built library nor any unnecessary CMake module
|
|
file(REMOVE_RECURSE "${SOURCE_PATH}/3rdparty")
|
|
file(REMOVE_RECURSE "${SOURCE_PATH}/cmake/Modules")
|
|
|
|
vcpkg_cmake_configure(
|
|
SOURCE_PATH "${SOURCE_PATH}"
|
|
DISABLE_PARALLEL_CONFIGURE
|
|
OPTIONS ${FEATURE_OPTIONS}
|
|
-DINSTALL_BIN_DIR:STRING=bin
|
|
-DINSTALL_LIB_DIR:STRING=lib
|
|
-DENABLE_OPENCV:BOOL=${ENABLE_OPENCV}
|
|
)
|
|
|
|
vcpkg_cmake_install()
|
|
vcpkg_copy_tools(AUTO_CLEAN TOOL_NAMES darknet uselib)
|
|
if ("opencv-cuda" IN_LIST FEATURES OR "opencv3-cuda" IN_LIST FEATURES)
|
|
vcpkg_copy_tools(AUTO_CLEAN TOOL_NAMES uselib_track)
|
|
endif()
|
|
|
|
file(COPY "${SOURCE_PATH}/cfg" DESTINATION "${CURRENT_PACKAGES_DIR}/tools/${PORT}")
|
|
file(COPY "${SOURCE_PATH}/data" DESTINATION "${CURRENT_PACKAGES_DIR}/tools/${PORT}")
|
|
|
|
if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
|
|
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin")
|
|
endif()
|
|
|
|
vcpkg_cmake_config_fixup()
|
|
|
|
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
|
|
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
|
|
|
|
file(INSTALL "${SOURCE_PATH}/scripts/download_weights.ps1" DESTINATION "${CURRENT_PACKAGES_DIR}/tools/${PORT}/scripts")
|
|
message(STATUS "To download weight files, please go to ${CURRENT_INSTALLED_DIR}/tools/${PORT}/scripts and run ./download_weights.ps1")
|
|
file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
|