2020-05-07 06:26:16 +08:00
if ( EXISTS "${CURRENT_INSTALLED_DIR}/share/opencv3" )
message ( FATAL_ERROR "OpenCV 3 is installed, please uninstall and try again:\n vcpkg remove opencv3" )
endif ( )
if ( EXISTS "${CURRENT_INSTALLED_DIR}/share/opencv4" )
message ( FATAL_ERROR "OpenCV 4 is installed, please uninstall and try again:\n vcpkg remove opencv4" )
endif ( )
if ( VCPKG_TARGET_IS_UWP )
# - opengl feature is broken on UWP
# - jasper and openexr are not available on UWP due to missing dependencies
# - opencv2 code itself fails even if previous conditions are avoided
message ( FATAL_ERROR "${PORT} doesn't support UWP" )
endif ( )
set ( OPENCV_VERSION "2.4.13.7" )
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 o p e n c v / o p e n c v
R E F $ { O P E N C V _ V E R S I O N }
S H A 5 1 2 d e 7 d 2 4 a c 7 e d 7 8 a c 1 4 6 7 3 0 1 1 c b e c c 4 7 7 c a e 6 8 8 b 7 4 2 2 2 a 9 7 2 e 5 5 3 c 9 5 a 5 5 7 b 5 c b 8 e 5 9 1 3 f 9 7 d b 5 2 5 4 2 1 d 6 a 7 2 a f 3 0 9 9 8 c a 3 0 0 1 1 2 f a 0 b 2 8 5 d a e d 6 5 f 6 5 8 3 2 e b 2 c f 7 2 4 1 a
H E A D _ R E F m a s t e r
P A T C H E S
0 0 0 2 - i n s t a l l - o p t i o n s . p a t c h
0 0 0 3 - f o r c e - p a c k a g e - r e q u i r e m e n t s . p a t c h
0 0 0 4 - a d d - f f m p e g - m i s s i n g - d e f i n e s . p a t c h
0 0 0 5 - f i x - c u d a . p a t c h
)
file ( REMOVE "${SOURCE_PATH}/cmake/FindCUDA.cmake" )
file ( REMOVE_RECURSE "${SOURCE_PATH}/cmake/FindCUDA" )
2020-07-28 08:43:23 +08:00
file ( COPY ${ CMAKE_CURRENT_LIST_DIR } /FindCUDA.cmake DESTINATION ${ SOURCE_PATH } /cmake/ ) #contains fixes for CUDA 11 compat, remove when CMake has support for it
2020-05-07 06:26:16 +08:00
vcpkg_check_features ( OUT_FEATURE_OPTIONS FEATURE_OPTIONS
" c u d a " W I T H _ C U D A
" e i g e n " W I T H _ E I G E N
" f f m p e g " W I T H _ F F M P E G
" j a s p e r " W I T H _ J A S P E R
" j p e g " W I T H _ J P E G
" o p e n e x r " W I T H _ O P E N E X R
" o p e n g l " W I T H _ O P E N G L
" p n g " W I T H _ P N G
" q t " W I T H _ Q T
" t i f f " W I T H _ T I F F
" w o r l d " B U I L D _ o p e n c v _ w o r l d
)
set ( WITH_VTK OFF )
if ( "vtk" IN_LIST FEATURES )
set ( WITH_VTK ON )
endif ( )
set ( WITH_MSMF ON )
if ( NOT VCPKG_TARGET_IS_WINDOWS OR VCPKG_TARGET_IS_UWP )
set ( WITH_MSMF OFF )
endif ( )
if ( VCPKG_LIBRARY_LINKAGE STREQUAL static )
if ( WITH_VTK )
message ( WARNING "VTK is currently unsupported in this build configuration, turning it off" )
set ( WITH_VTK OFF )
endif ( )
endif ( )
if ( "ffmpeg" IN_LIST FEATURES )
if ( VCPKG_TARGET_IS_UWP )
set ( VCPKG_C_FLAGS "/sdl- ${VCPKG_C_FLAGS}" )
set ( VCPKG_CXX_FLAGS "/sdl- ${VCPKG_CXX_FLAGS}" )
endif ( )
endif ( )
vcpkg_configure_cmake (
P R E F E R _ N I N J A
S O U R C E _ P A T H $ { S O U R C E _ P A T H }
O P T I O N S
###### ocv_options
- D C M A K E _ D E B U G _ P O S T F I X = d
# Do not build docs/examples
- D B U I L D _ D O C S = O F F
- D B U I L D _ E X A M P L E S = O F F
###### Disable build 3rd party libs
- D B U I L D _ J A S P E R = O F F
- D B U I L D _ J P E G = O F F
- D B U I L D _ O P E N E X R = O F F
- D B U I L D _ P N G = O F F
- D B U I L D _ T I F F = O F F
- D B U I L D _ T B B = O F F
- D B U I L D _ Z L I B = O F F
###### OpenCV Build components
- D B U I L D _ o p e n c v _ a p p s = O F F
- D B U I L D _ P A C K A G E = O F F
- D B U I L D _ P E R F _ T E S T S = O F F
- D B U I L D _ T E S T S = O F F
- D B U I L D _ W I T H _ D E B U G _ I N F O = O N
# CMAKE
- D C M A K E _ D I S A B L E _ F I N D _ P A C K A G E _ J N I = O N
###### customized properties
## Options from vcpkg_check_features()
$ { F E A T U R E _ O P T I O N S }
- D W I T H _ 1 3 9 4 = O F F
- D W I T H _ I P P = O F F
- D W I T H _ L A P A C K = O F F
- D W I T H _ M S M F = $ { W I T H _ M S M F }
- D W I T H _ O P E N C L A M D B L A S = O F F
- D W I T H _ O P E N M P = O F F
- D W I T H _ Z L I B = O N
2020-07-28 08:43:23 +08:00
- D W I T H _ C U B L A S = O F F # newer libcublas cannot be found by the old cuda cmake script in opencv2, requires a fix
2020-05-07 06:26:16 +08:00
)
vcpkg_install_cmake ( )
vcpkg_fixup_cmake_targets ( CONFIG_PATH "share/opencv" TARGET_PATH "share/opencv" )
vcpkg_copy_pdbs ( )
if ( VCPKG_LIBRARY_LINKAGE STREQUAL "static" )
file ( READ ${ CURRENT_PACKAGES_DIR } /share/opencv/OpenCVModules.cmake OPENCV_MODULES )
string ( REPLACE "set(CMAKE_IMPORT_FILE_VERSION 1)"
" set ( CMAKE_IMPORT_FILE_VERSION 1 )
2020-07-28 08:43:23 +08:00
find_package ( CUDA QUIET )
find_package ( Threads QUIET )
2020-05-07 06:26:16 +08:00
find_package ( PNG QUIET )
2020-07-28 08:43:23 +08:00
find_package ( OpenEXR QUIET )
set ( CMAKE_AUTOMOC ON )
set ( CMAKE_AUTORCC ON )
set ( CMAKE_AUTOUIC ON )
find_package ( Qt5 COMPONENTS OpenGL Concurrent Test QUIET )
2020-05-07 06:26:16 +08:00
find_package ( TIFF QUIET ) " O P E N C V _ M O D U L E S " $ { O P E N C V _ M O D U L E S } " )
file ( WRITE ${ CURRENT_PACKAGES_DIR } /share/opencv/OpenCVModules.cmake "${OPENCV_MODULES}" )
file ( REMOVE_RECURSE ${ CURRENT_PACKAGES_DIR } /bin ${ CURRENT_PACKAGES_DIR } /debug/bin )
endif ( )
file ( REMOVE_RECURSE ${ CURRENT_PACKAGES_DIR } /debug/share )
file ( REMOVE_RECURSE ${ CURRENT_PACKAGES_DIR } /debug/include )
file ( REMOVE ${ CURRENT_PACKAGES_DIR } /LICENSE )
file ( REMOVE ${ CURRENT_PACKAGES_DIR } /debug/LICENSE )
file ( INSTALL ${ SOURCE_PATH } /LICENSE DESTINATION ${ CURRENT_PACKAGES_DIR } /share/ ${ PORT } RENAME copyright )