@ -7,6 +7,7 @@
#
# O P E N C V _ M O D U L E _ $ { t h e _ m o d u l e } _ L O C A T I O N
# O P E N C V _ M O D U L E _ $ { t h e _ m o d u l e } _ D E S C R I P T I O N
# O P E N C V _ M O D U L E _ $ { t h e _ m o d u l e } _ C L A S S - P U B L I C | I N T E R N A L | B I N D I N G S
# O P E N C V _ M O D U L E _ $ { t h e _ m o d u l e } _ H E A D E R S
# O P E N C V _ M O D U L E _ $ { t h e _ m o d u l e } _ S O U R C E S
# O P E N C V _ M O D U L E _ $ { t h e _ m o d u l e } _ D E P S - f i n a l f l a t t e n e d s e t o f m o d u l e d e p e n d e n c i e s
@ -18,6 +19,8 @@
# T o c o n t r o l t h e s e t u p o f t h e m o d u l e y o u c o u l d a l s o s e t :
# t h e _ d e s c r i p t i o n - t e x t t o b e u s e d a s c u r r e n t m o d u l e d e s c r i p t i o n
# O P E N C V _ M O D U L E _ T Y P E - S T A T I C | S H A R E D - s e t t o f o r c e o v e r r i d e g l o b a l s e t t i n g s f o r c u r r e n t m o d u l e
# O P E N C V _ M O D U L E _ I S _ P A R T _ O F _ W O R L D - O N | OFF ( default ON ) - s h o u l d t h e m o d u l e b e a d d e d t o t h e o p e n c v _ w o r l d ?
# B U I L D _ $ { t h e _ m o d u l e } _ I N I T - O N | OFF ( default ON ) - i n i t i a l v a l u e f o r B U I L D _ $ { t h e _ m o d u l e }
# T h e v e r b o s e t e m p l a t e f o r O p e n C V m o d u l e :
#
@ -38,10 +41,12 @@
# c l e a n f l a g s f o r m o d u l e s e n a b l e d o n p r e v i o u s c m a k e r u n
# t h i s i s n e c e s s a r y t o c o r r e c t l y h a n d l e m o d u l e s r e m o v a l
foreach ( mod ${ OPENCV_MODULES_BUILD } )
foreach ( mod ${ OPENCV_MODULES_BUILD } ${ OPENCV_MODULES_DISABLED_USER } ${ OPENCV_MODULES_DISABLED_AUTO } ${ OPENCV_MODULES_DISABLED_FORCE } )
if ( HAVE_ ${ mod } )
unset ( HAVE_ ${ mod } CACHE )
endif ( )
unset ( OPENCV_MODULE_ ${ mod } _REQ_DEPS CACHE )
unset ( OPENCV_MODULE_ ${ mod } _OPT_DEPS CACHE )
endforeach ( )
# c l e a n m o d u l e s i n f o w h i c h n e e d s t o b e r e c a l c u l a t e d
@ -58,8 +63,8 @@ set(OPENCV_MODULES_DISABLED_FORCE "" CACHE INTERNAL "List of OpenCV modules whic
# * < l i s t o f d e p e n d e n c i e s > - c a n i n c l u d e f u l l n a m e s o f m o d u l e s o r f u l l p a t h e s t o s h a r e d / s t a t i c l i b r a r i e s o r c m a k e t a r g e t s
macro ( ocv_add_dependencies full_modname )
# w e d o n ' t c l e a n t h e d e p e n d e n c i e s h e r e t o a l l o w t h i s m a c r o s e v e r a l t i m e s f o r e v e r y m o d u l e
foreach ( d "REQIRED" ${ ARGN } )
if ( d STREQUAL "REQIRED" )
foreach ( d "REQU IRED" ${ ARGN } )
if ( d STREQUAL "REQU IRED" )
set ( __depsvar OPENCV_MODULE_ ${ full_modname } _REQ_DEPS )
elseif ( d STREQUAL "OPTIONAL" )
set ( __depsvar OPENCV_MODULE_ ${ full_modname } _OPT_DEPS )
@ -84,7 +89,7 @@ endmacro()
# U s a g e :
# ocv_add_module ( <name> [INTERNAL|BINDINGS] [REQUIRED] [<list of dependencies>] [OPTIONAL <list of optional dependencies>] )
# E x a m p l e :
# ocv_add_module ( yaom INTERNAL opencv_core opencv_highgui NOLINK opencv_flann OPTIONAL opencv_gpu )
# ocv_add_module ( yaom INTERNAL opencv_core opencv_highgui opencv_flann OPTIONAL opencv_gpu )
macro ( ocv_add_module _name )
string ( TOLOWER "${_name}" name )
string ( REGEX REPLACE "^opencv_" "" ${ name } "${name}" )
@ -106,23 +111,31 @@ macro(ocv_add_module _name)
endif ( )
set ( OPENCV_MODULE_ ${ the_module } _DESCRIPTION "${the_description}" CACHE INTERNAL "Brief description of ${the_module} module" )
set ( OPENCV_MODULE_ ${ the_module } _LOCATION "${CMAKE_CURRENT_SOURCE_DIR}" CACHE INTERNAL "Location of ${the_module} module sources" )
unset ( OPENCV_MODULE_ ${ the_module } _REQ_DEPS CACHE )
unset ( OPENCV_MODULE_ ${ the_module } _OPT_DEPS CACHE )
# c r e a t e o p t i o n t o e n a b l e / d i s a b l e t h i s m o d u l e
option ( BUILD_ ${ the_module } "Include ${the_module} module into the OpenCV build" ON )
if ( NOT DEFINED BUILD_ ${ the_module } _INIT )
set ( BUILD_ ${ the_module } _INIT ON )
endif ( )
option ( BUILD_ ${ the_module } "Include ${the_module} module into the OpenCV build" ${ BUILD_${the_module } _INIT} )
if ( "${ARGV1}" STREQUAL "INTERNAL" OR "${ARGV1}" STREQUAL "BINDINGS" )
set ( OPENCV_MODULE_ ${ the_module } _CLASS "${ARGV1}" CACHE INTERNAL "The cathegory of the module" )
set ( __ocv_argn__ ${ ARGN } )
list ( REMOVE_AT __ocv_argn__ 0 )
ocv_add_dependencies ( ${ the_module } ${ __ocv_argn__ } )
unset ( __ocv_argn__ )
else ( )
set ( OPENCV_MODULE_ ${ the_module } _CLASS "PUBLIC" CACHE INTERNAL "The cathegory of the module" )
ocv_add_dependencies ( ${ the_module } ${ ARGN } )
if ( BUILD_ ${ the_module } )
set ( OPENCV_MODULES_PUBLIC ${ OPENCV_MODULES_PUBLIC } "${the_module}" CACHE INTERNAL "List of OpenCV modules marked for export" )
endif ( )
endif ( )
# a d d s e l f t o t h e w o r l d d e p e n d e n c i e s
if ( NOT DEFINED OPENCV_MODULE_IS_PART_OF_WORLD AND NOT OPENCV_MODULE_ ${ the_module } _CLASS STREQUAL "BINDINGS" OR OPENCV_MODULE_IS_PART_OF_WORLD )
ocv_add_dependencies ( opencv_world OPTIONAL ${ the_module } )
endif ( )
if ( BUILD_ ${ the_module } )
set ( OPENCV_MODULES_BUILD ${ OPENCV_MODULES_BUILD } "${the_module}" CACHE INTERNAL "List of OpenCV modules included into the build" )
@ -429,10 +442,13 @@ endmacro()
# c r e a t e s O p e n C V m o d u l e i n c u r r e n t f o l d e r
# c r e a t e s n e w t a r g e t , c o n f i g u r e s s t a n d a r d d e p e n d e n c i e s , c o m p i l e r s f l a g s , i n s t a l l r u l e s
# U s a g e :
# ocv_create_module ( <extra link dependencies> )
# ocv_create_module ( <extra link dependencies> )
# ocv_create_module ( SKIP_LINK )
macro ( ocv_create_module )
add_library ( ${ the_module } ${ OPENCV_MODULE_TYPE } ${ OPENCV_MODULE_${the_module } _HEADERS} ${ OPENCV_MODULE_${the_module } _SOURCES} )
target_link_libraries ( ${ the_module } ${ OPENCV_MODULE_${the_module } _DEPS} ${ OPENCV_MODULE_${the_module } _DEPS_EXT} ${ OPENCV_LINKER_LIBS } ${ IPP_LIBS } ${ ARGN } )
if ( NOT "${ARGN}" STREQUAL "SKIP_LINK" )
target_link_libraries ( ${ the_module } ${ OPENCV_MODULE_${the_module } _DEPS} ${ OPENCV_MODULE_${the_module } _DEPS_EXT} ${ OPENCV_LINKER_LIBS } ${ IPP_LIBS } ${ ARGN } )
endif ( )
add_dependencies ( opencv_modules ${ the_module } )
if ( ENABLE_SOLUTION_FOLDERS )