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
2021-04-30 01:45:10 +08:00
R E F 9 1 e f b 7 c 7 f 6 c 0 0 a 4 6 1 6 e d 5 8 7 3 5 f 7 c 6 7 0 9 0 8 d 0 a 8 4 9
S H A 5 1 2 7 f 6 1 8 7 f 8 c c c 8 9 2 9 5 d a f 7 b 1 5 2 8 8 b a e 0 b f 5 3 6 3 8 9 7 0 4 2 2 c e d 8 0 a 4 a 7 5 5 e 2 b 4 7 6 5 c d a 3 6 f 5 3 2 e b c 5 c 3 2 a 2 8 8 0 4 a 2 e d 0 a c 6 3 7 5 e 9 a 8 f 7 4 4 9 a 9 0 0 2 e 1 b 3 7 3 3 7 8 6 3 5 a 5 4 f 2 c 9 6
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 )
set ( ENABLE_OPENCV_WITH_CUDA FALSE )
if ( "opencv-base" IN_LIST FEATURES OR "opencv2-base" IN_LIST FEATURES OR "opencv3-base" IN_LIST FEATURES )
set ( ENABLE_OPENCV TRUE )
endif ( )
if ( "opencv-cuda" IN_LIST FEATURES OR "opencv2-cuda" IN_LIST FEATURES OR "opencv3-cuda" IN_LIST FEATURES )
set ( ENABLE_OPENCV TRUE )
set ( ENABLE_OPENCV_WITH_CUDA 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
2019-03-23 01:25:15 +08:00
file ( REMOVE_RECURSE ${ SOURCE_PATH } /3rdparty )
2019-07-30 02:14:39 +08:00
file ( REMOVE ${ SOURCE_PATH } /cmake/Modules/FindPThreads_windows.cmake )
2019-09-25 03:58:38 +08:00
file ( REMOVE ${ SOURCE_PATH } /cmake/Modules/FindCUDNN.cmake )
2019-10-09 20:35:24 +08:00
file ( REMOVE ${ SOURCE_PATH } /cmake/Modules/FindStb.cmake )
2019-03-15 05:15:28 +08:00
vcpkg_configure_cmake (
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
2019-06-29 04:48:42 +08:00
P R E F E R _ N I N J A
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 }
- D E N A B L E _ O P E N C V _ W I T H _ C U D A : B O O L = $ { E N A B L E _ O P E N C V _ W I T H _ C U D A }
2019-03-15 05:15:28 +08:00
)
vcpkg_install_cmake ( )
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
2019-09-25 03:58:38 +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 )
file ( REMOVE_RECURSE ${ CURRENT_PACKAGES_DIR } /bin ${ CURRENT_PACKAGES_DIR } /debug/bin )
endif ( )
2019-03-23 01:25:15 +08:00
vcpkg_fixup_cmake_targets ( )
2019-03-15 05:15:28 +08:00
file ( REMOVE_RECURSE ${ CURRENT_PACKAGES_DIR } /debug/share )
file ( REMOVE_RECURSE ${ CURRENT_PACKAGES_DIR } /debug/include )
2021-04-30 01:45:10 +08:00
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" )
2019-09-25 03:58:38 +08:00
file ( INSTALL ${ SOURCE_PATH } /LICENSE DESTINATION ${ CURRENT_PACKAGES_DIR } /share/ ${ PORT } RENAME copyright )