2019-03-15 05:15:28 +08:00
vcpkg_from_github (
O U T _ S O U R C E _ P A T H S O U R C E _ P A T H
R E P O A l e x e y A B / d a r k n e t
2022-04-07 03:39:56 +08:00
R E F 8 a 0 b f 8 4 c 1 9 e 3 8 2 1 4 2 1 9 d b d 3 3 4 5 f 0 4 c e 7 7 8 4 2 6 c 5 7
S H A 5 1 2 6 2 5 3 d 5 b 4 9 8 f 4 f 6 e b a 7 f c 5 3 9 d 5 a 4 b 4 e 1 6 3 1 3 9 f 4 8 4 1 6 2 3 f 1 1 d 8 4 7 6 0 b c f 1 f f a b e 6 5 1 9 f 8 5 e 9 8 e 3 d 4 a e a c 6 8 4 6 3 1 3 f e a 3 b 9 8 4 5 1 4 0 7 1 3 4 b 6 b 6 f 5 b 9 1 1 3 7 c 6 2 d 1 6 4 7 1 0 9 d 9
2019-03-15 05:15:28 +08:00
H E A D _ R E F m a s t e r
)
2021-01-06 04:10:06 +08:00
vcpkg_check_features ( OUT_FEATURE_OPTIONS FEATURE_OPTIONS
2021-04-30 01:45:10 +08:00
F E A T U R E S
2021-01-06 04:10:06 +08:00
c u d a E N A B L E _ C U D A
c u d n n E N A B L E _ C U D N N
)
2019-03-15 05:15:28 +08:00
2021-04-30 01:45:10 +08:00
#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 )
2021-06-10 06:51:27 +08:00
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 )
2021-04-30 01:45:10 +08:00
set ( ENABLE_OPENCV TRUE )
endif ( )
2019-08-14 11:13:55 +08:00
if ( "cuda" IN_LIST FEATURES )
2019-06-29 04:48:42 +08:00
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 ( )
2019-07-30 02:14:39 +08:00
#make sure we don't use any integrated pre-built library nor any unnecessary CMake module
2022-04-07 03:39:56 +08:00
file ( REMOVE_RECURSE "${SOURCE_PATH}/3rdparty" )
file ( REMOVE "${SOURCE_PATH}/cmake/Modules/FindPThreads_windows.cmake" )
file ( REMOVE "${SOURCE_PATH}/cmake/Modules/FindCUDNN.cmake" )
file ( REMOVE "${SOURCE_PATH}/cmake/Modules/FindStb.cmake" )
2019-03-15 05:15:28 +08:00
2022-04-07 03:39:56 +08:00
vcpkg_cmake_configure (
S O U R C E _ P A T H " $ { S O U R C E _ P A T H } "
2019-09-25 03:58:38 +08:00
D I S A B L E _ P A R A L L E L _ C O N F I G U R E
2021-01-06 04:10:06 +08:00
O P T I O N S $ { F E A T U R E _ O P T I O N S }
2019-06-25 06:22:57 +08:00
- D I N S T A L L _ B I N _ D I R : S T R I N G = b i n
- D I N S T A L L _ L I B _ D I R : S T R I N G = l i b
2021-04-30 01:45:10 +08:00
- D E N A B L E _ O P E N C V : B O O L = $ { E N A B L E _ O P E N C V }
2019-03-15 05:15:28 +08:00
)
2022-04-07 03:39:56 +08:00
vcpkg_cmake_install ( )
2021-04-30 01:45:10 +08:00
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 )
2019-03-15 05:15:28 +08:00
endif ( )
2021-04-30 01:45:10 +08:00
2022-04-07 03:39:56 +08:00
file ( COPY "${SOURCE_PATH}/cfg" DESTINATION "${CURRENT_PACKAGES_DIR}/tools/${PORT}" )
file ( COPY "${SOURCE_PATH}/data" DESTINATION "${CURRENT_PACKAGES_DIR}/tools/${PORT}" )
2019-03-15 05:15:28 +08:00
if ( VCPKG_LIBRARY_LINKAGE STREQUAL static )
2022-04-07 03:39:56 +08:00
file ( REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin" )
2019-03-15 05:15:28 +08:00
endif ( )
2022-04-07 03:39:56 +08:00
vcpkg_cmake_config_fixup ( )
2019-03-15 05:15:28 +08:00
2022-04-07 03:39:56 +08:00
file ( REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share" )
file ( REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include" )
2019-03-15 05:15:28 +08:00
2022-04-07 03:39:56 +08:00
file ( INSTALL "${SOURCE_PATH}/scripts/download_weights.ps1" DESTINATION "${CURRENT_PACKAGES_DIR}/tools/${PORT}/scripts" )
2021-04-30 01:45:10 +08:00
message ( STATUS "To download weight files, please go to ${CURRENT_INSTALLED_DIR}/tools/${PORT}/scripts and run ./download_weights.ps1" )
2022-04-07 03:39:56 +08:00
file ( INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright )