2019-03-15 05:15:28 +08:00
if ( VCPKG_TARGET_ARCHITECTURE STREQUAL "arm" )
message ( FATAL_ERROR "darknet does not support ARM" )
endif ( )
if ( VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" )
message ( FATAL_ERROR "darknet does not support UWP" )
endif ( )
include ( vcpkg_common_functions )
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
2019-06-25 06:22:57 +08:00
R E F a 1 a b d 0 7 e 2 3 f c 5 b 1 4 3 a 6 1 9 7 d e 9 9 0 8 f e 4 f 3 3 7 9 1 c 6 a
S H A 5 1 2 d f 9 1 b f 5 9 5 6 6 6 a 4 d b 5 b e b 5 c c 5 5 f 6 c 6 0 b e 1 9 6 6 7 a b 9 8 7 a 7 8 4 f a e f 0 4 c f 2 2 1 5 3 1 7 c 9 a 3 4 0 c f c 0 a 2 0 0 6 4 0 7 4 1 f c c 8 8 c 2 9 c f f 0 7 7 d 5 1 5 3 b 8 6 f f 4 9 7 c 3 1 a d 5 a d 1 3 2 f 0 5 9 8 7 5 1 6
2019-03-15 05:15:28 +08:00
H E A D _ R E F m a s t e r
)
2019-06-29 04:48:42 +08:00
vcpkg_check_features (
" c u d a " E N A B L E _ C U D A
" o p e n c v " E N A B L E _ O P E N C V
)
2019-03-15 05:15:28 +08:00
2019-04-10 00:52:44 +08:00
if ( "opencv-cuda" IN_LIST FEATURES )
set ( ENABLE_OPENCV ON )
set ( ENABLE_CUDA ON )
endif ( )
2019-06-29 04:48:42 +08:00
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 ( )
2019-03-15 05:15:28 +08:00
if ( "weights" IN_LIST FEATURES )
vcpkg_download_distfile ( YOLOV3_WEIGHTS
U R L S " h t t p s : / / p j r e d d i e . c o m / m e d i a / f i l e s / y o l o v 3 . w e i g h t s "
F I L E N A M E " d a r k n e t - c a c h e / y o l o v 3 . w e i g h t s "
S H A 5 1 2 2 9 3 c 7 0 e 4 0 4 f f 0 2 5 0 d 7 c 0 4 c a 1 e 5 e 0 5 3 f c 2 1 a 7 8 5 4 7 e 6 9 b 5 b 3 2 9 d 3 4 f 2 5 9 8 1 6 1 3 e 5 9 b 9 8 2 d 9 3 f f f 2 c 3 5 2 9 1 5 e f 7 5 3 1 d 6 c 3 b 0 2 a 9 b 0 b 3 8 3 4 6 d 0 5 c 5 1 d 6 6 3 6 8 7 8 d 8 8 8 3 f 2 c 1
)
vcpkg_download_distfile ( YOLOV2_WEIGHTS
U R L S " h t t p s : / / p j r e d d i e . c o m / m e d i a / f i l e s / y o l o v 2 . w e i g h t s "
F I L E N A M E " d a r k n e t - c a c h e / y o l o v 2 . w e i g h t s "
S H A 5 1 2 5 2 7 1 d a 2 d d 2 d a 9 1 5 1 7 2 d d d 0 3 4 c 8 e 8 9 4 8 7 7 e 7 0 6 6 0 5 1 f 1 0 5 a e 8 2 e 2 5 e 1 8 5 a 2 b 4 e 4 1 5 7 d 2 b 9 5 1 4 6 5 3 c 2 3 7 8 0 e 8 7 3 4 6 f 2 b 2 0 d f 6 3 6 3 0 1 8 b 7 e 6 8 8 a b a 4 2 2 e 2 d a c f 1 d 2 f b f 6 a b
)
vcpkg_download_distfile ( YOLOV3-TINY_WEIGHTS
U R L S " h t t p s : / / p j r e d d i e . c o m / m e d i a / f i l e s / y o l o v 3 - t i n y . w e i g h t s "
F I L E N A M E " d a r k n e t - c a c h e / y o l o v 3 - t i n y . w e i g h t s "
S H A 5 1 2 9 8 1 a 5 6 4 5 9 5 1 5 f 7 2 7 b b 7 b 3 d 3 3 4 1 b 9 5 f 4 1 1 7 4 9 9 b 6 7 2 6 e a b 2 7 9 8 e 1 c 3 e 5 2 4 d e 1 e e 8 e d 0 d 9 5 4 c 1 1 b 2 7 b b b b 9 2 6 d a 2 c c 9 5 5 5 2 6 a 1 9 4 e d d f 6 9 c 5 5 d 6 5 9 2 3 9 9 4 a b 2 e 8 a f 0 7 0 4 2
)
vcpkg_download_distfile ( YOLOV2-TINY_WEIGHTS
U R L S " h t t p s : / / p j r e d d i e . c o m / m e d i a / f i l e s / y o l o v 2 - t i n y . w e i g h t s "
F I L E N A M E " d a r k n e t - c a c h e / y o l o v 2 - t i n y . w e i g h t s "
S H A 5 1 2 f 0 8 5 7 a 7 a 0 2 c f 4 3 2 2 3 5 4 d 2 8 8 c 9 a f a 0 b 8 7 3 2 1 b 2 3 0 8 2 b 7 1 9 b c 8 4 e a 6 4 e 2 f 3 5 5 6 c c 1 f a f e b 8 3 6 e e 5 b f 9 f b 6 d c f 4 4 8 8 3 9 0 6 1 b 9 3 6 2 3 a 0 6 7 d f d e 7 a f a 1 3 3 8 6 3 6 8 6 5 e a 8 8 9 8 9 a
)
endif ( )
2019-03-23 01:25:15 +08:00
#make sure we don't use any integrated pre-built library
file ( REMOVE_RECURSE ${ SOURCE_PATH } /3rdparty )
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-06-25 06:22:57 +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 #since darknet configures a file inside source tree, it is better to disable parallel configure
2019-06-29 04:48:42 +08:00
P R E F E R _ N I N J A
2019-03-15 05:15:28 +08:00
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
2019-03-15 05:15:28 +08:00
- D E N A B L E _ C U D A = $ { E N A B L E _ C U D A }
- D E N A B L E _ O P E N C V = $ { E N A B L E _ O P E N C V }
)
vcpkg_install_cmake ( )
#somehow the native CMAKE_EXECUTABLE_SUFFIX does not work, so here we emulate it
if ( CMAKE_HOST_WIN32 )
set ( EXECUTABLE_SUFFIX ".exe" )
else ( )
set ( EXECUTABLE_SUFFIX "" )
endif ( )
file ( REMOVE ${ CURRENT_PACKAGES_DIR } /debug/bin/darknet ${ EXECUTABLE_SUFFIX } )
file ( REMOVE ${ CURRENT_PACKAGES_DIR } /debug/bin/uselib ${ EXECUTABLE_SUFFIX } )
if ( EXISTS ${ CURRENT_PACKAGES_DIR } /debug/bin/uselib_track ${ EXECUTABLE_SUFFIX } )
file ( REMOVE ${ CURRENT_PACKAGES_DIR } /debug/bin/uselib_track ${ EXECUTABLE_SUFFIX } )
endif ( )
file ( MAKE_DIRECTORY ${ CURRENT_PACKAGES_DIR } /tools/darknet/ )
file ( RENAME ${ CURRENT_PACKAGES_DIR } /bin/darknet ${ EXECUTABLE_SUFFIX } ${ CURRENT_PACKAGES_DIR } /tools/darknet/darknet ${ EXECUTABLE_SUFFIX } )
file ( RENAME ${ CURRENT_PACKAGES_DIR } /bin/uselib ${ EXECUTABLE_SUFFIX } ${ CURRENT_PACKAGES_DIR } /tools/darknet/uselib ${ EXECUTABLE_SUFFIX } )
if ( EXISTS ${ CURRENT_PACKAGES_DIR } /bin/uselib_track ${ EXECUTABLE_SUFFIX } )
file ( RENAME ${ CURRENT_PACKAGES_DIR } /bin/uselib_track ${ EXECUTABLE_SUFFIX } ${ CURRENT_PACKAGES_DIR } /tools/darknet/uselib_track ${ EXECUTABLE_SUFFIX } )
endif ( )
file ( COPY ${ SOURCE_PATH } /cfg DESTINATION ${ CURRENT_PACKAGES_DIR } /tools/darknet )
file ( COPY ${ SOURCE_PATH } /data DESTINATION ${ CURRENT_PACKAGES_DIR } /tools/darknet )
vcpkg_copy_tool_dependencies ( ${ CURRENT_PACKAGES_DIR } /tools/darknet )
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
2019-04-11 23:27:06 +08:00
file ( COPY ${ SOURCE_PATH } /cmake/Modules/FindCUDNN.cmake DESTINATION ${ CURRENT_PACKAGES_DIR } /share/darknet )
file ( COPY ${ SOURCE_PATH } /cmake/Modules/FindPThreads_windows.cmake DESTINATION ${ CURRENT_PACKAGES_DIR } /share/darknet )
file ( COPY ${ SOURCE_PATH } /cmake/Modules/FindStb.cmake DESTINATION ${ CURRENT_PACKAGES_DIR } /share/darknet )
2019-03-15 05:15:28 +08:00
file ( REMOVE_RECURSE ${ CURRENT_PACKAGES_DIR } /debug/share )
file ( REMOVE_RECURSE ${ CURRENT_PACKAGES_DIR } /debug/include )
file ( INSTALL ${ SOURCE_PATH } /LICENSE DESTINATION ${ CURRENT_PACKAGES_DIR } /share/darknet RENAME copyright )
if ( "weights" IN_LIST FEATURES )
file ( COPY ${ VCPKG_ROOT_DIR } /downloads/darknet-cache/yolov3.weights DESTINATION ${ CURRENT_PACKAGES_DIR } /tools/darknet )
file ( COPY ${ VCPKG_ROOT_DIR } /downloads/darknet-cache/yolov2.weights DESTINATION ${ CURRENT_PACKAGES_DIR } /tools/darknet )
file ( COPY ${ VCPKG_ROOT_DIR } /downloads/darknet-cache/yolov3-tiny.weights DESTINATION ${ CURRENT_PACKAGES_DIR } /tools/darknet )
file ( COPY ${ VCPKG_ROOT_DIR } /downloads/darknet-cache/yolov2-tiny.weights DESTINATION ${ CURRENT_PACKAGES_DIR } /tools/darknet )
endif ( )