@ -5,12 +5,13 @@ set(OPENCV_JAVA_DIR "${CMAKE_CURRENT_BINARY_DIR}/opencv" CACHE INTERNAL "")
file ( REMOVE_RECURSE "${OPENCV_JAVA_DIR}" )
file ( REMOVE "${OPENCV_DEPHELPER}/${the_module}_jar_source_copy" )
file ( MAKE_DIRECTORY "${OPENCV_JAVA_DIR}/build/classes" )
set ( java_src_dir "${OPENCV_JAVA_DIR}/java" )
file ( MAKE_DIRECTORY "${java_src_dir}" )
set ( JAR_NAME opencv- ${ OPENCV_JAVA_LIB_NAME_SUFFIX } .jar )
set ( OPENCV_JAR_FILE "${OpenCV_BINARY_DIR}/bin/${JAR_NAME}" CACHE INTERNAL "" )
set ( JAR_NAME_WE opencv- ${ OPENCV_JAVA_LIB_NAME_SUFFIX } )
set ( JAR_NAME ${ JAR_NAME_WE } .jar )
set ( OPENCV_JAR_DIR "${OpenCV_BINARY_DIR}/bin/" CACHE INTERNAL "" )
set ( OPENCV_JAR_FILE "${OPENCV_JAR_DIR}${JAR_NAME}" CACHE INTERNAL "" )
ocv_copyfiles_append_dir ( JAVA_SRC_COPY "${OPENCV_JAVA_BINDINGS_DIR}/gen/java" "${java_src_dir}" )
@ -34,38 +35,98 @@ if(OPENCV_JAVADOC_LINK_URL)
set ( CMAKE_CONFIG_OPENCV_JAVADOC_LINK "link=\" ${ OPENCV_JAVADOC_LINK_URL } \"")
endif ( )
configure_file ( "${CMAKE_CURRENT_SOURCE_DIR}/build.xml.in" "${OPENCV_JAVA_DIR}/build.xml" @ONLY )
list ( APPEND depends "${OPENCV_JAVA_DIR}/build.xml ")
if ( OPENCV_JAVA_SDK_BUILD_TYPE STREQUAL "ANT" )
file ( MAKE_DIRECTORY "${OPENCV_JAVA_DIR}/build/classes " )
ocv_cmake_byproducts ( __byproducts BYPRODUCTS "${OPENCV_JAR_FILE}" )
add_custom_command ( OUTPUT "${OPENCV_DEPHELPER}/${the_module}_jar"
$ { _ _ b y p r o d u c t s } # r e q u i r e d f o r add_custom_target ( ) b y n i n j a
C O M M A N D $ { A N T _ E X E C U T A B L E } - n o i n p u t - k j a r
C O M M A N D $ { C M A K E _ C O M M A N D } - E t o u c h " $ { O P E N C V _ D E P H E L P E R } / $ { t h e _ m o d u l e } _ j a r "
W O R K I N G _ D I R E C T O R Y " $ { O P E N C V _ J A V A _ D I R } "
D E P E N D S $ { d e p e n d s }
C O M M E N T " G e n e r a t i n g $ { J A R _ N A M E } "
)
add_custom_target ( ${ the_module } _jar DEPENDS "${OPENCV_DEPHELPER}/${the_module}_jar" )
configure_file ( "${CMAKE_CURRENT_SOURCE_DIR}/build.xml.in" "${OPENCV_JAVA_DIR}/build.xml" @ONLY )
list ( APPEND depends "${OPENCV_JAVA_DIR}/build.xml" )
ocv_cmake_byproducts ( __byproducts BYPRODUCTS "${OPENCV_JAR_FILE}" )
add_custom_command ( OUTPUT "${OPENCV_DEPHELPER}/${the_module}_jar"
$ { _ _ b y p r o d u c t s } # r e q u i r e d f o r add_custom_target ( ) b y n i n j a
C O M M A N D $ { A N T _ E X E C U T A B L E } - n o i n p u t - k j a r
C O M M A N D $ { C M A K E _ C O M M A N D } - E t o u c h " $ { O P E N C V _ D E P H E L P E R } / $ { t h e _ m o d u l e } _ j a r "
W O R K I N G _ D I R E C T O R Y " $ { O P E N C V _ J A V A _ D I R } "
D E P E N D S $ { d e p e n d s }
C O M M E N T " G e n e r a t i n g $ { J A R _ N A M E } "
)
add_custom_target ( ${ the_module } _jar DEPENDS "${OPENCV_DEPHELPER}/${the_module}_jar" )
elseif ( OPENCV_JAVA_SDK_BUILD_TYPE STREQUAL "JAVA" )
configure_file ( "${CMAKE_CURRENT_SOURCE_DIR}/MANIFEST.MF.in" "${OPENCV_JAVA_DIR}/MANIFEST.MF" @ONLY )
list ( APPEND depends "${OPENCV_JAVA_DIR}/MANIFEST.MF" )
ocv_cmake_byproducts ( __byproducts BYPRODUCTS "${OPENCV_JAVA_DIR}/java_sources" )
add_custom_command ( OUTPUT "${OPENCV_DEPHELPER}/${the_module}_jar"
B Y P R O D U C T S $ { _ _ b y p r o d u c t s } # r e q u i r e d f o r add_custom_target ( ) b y n i n j a
D E P E N D S $ { d e p e n d s }
C O M M A N D $ { C M A K E _ C O M M A N D } - E t o u c h " $ { O P E N C V _ D E P H E L P E R } / $ { t h e _ m o d u l e } _ j a r "
C O M M A N D $ { C M A K E _ C O M M A N D }
- D O P E N C V _ J A V A _ D I R = " $ { O P E N C V _ J A V A _ D I R } / j a v a "
- D O U T P U T = " $ { O P E N C V _ J A V A _ D I R } / j a v a _ s o u r c e s "
- P " $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / l i s t _ j a v a _ s o u r c e s . c m a k e "
)
add_custom_target ( ${ the_module } _jar_sources
D E P E N D S " $ { O P E N C V _ D E P H E L P E R } / $ { t h e _ m o d u l e } _ j a r "
)
list ( APPEND CMAKE_JAVA_COMPILE_FLAGS -encoding utf-8 ${ OPENCV_EXTRA_JAVA_COMPILE_FLAGS } )
add_jar ( ${ the_module } _jar
S O U R C E S " @ $ { O P E N C V _ J A V A _ D I R } / j a v a _ s o u r c e s "
M A N I F E S T " $ { O P E N C V _ J A V A _ D I R } / M A N I F E S T . M F "
O U T P U T _ N A M E " $ { J A R _ N A M E _ W E } "
O U T P U T _ D I R " $ { O P E N C V _ J A R _ D I R } " )
add_dependencies ( ${ the_module } _jar ${ the_module } _jar_sources )
else ( )
ocv_assert ( 0 )
endif ( )
install ( FILES ${ OPENCV_JAR_FILE } OPTIONAL DESTINATION ${ OPENCV_JAR_INSTALL_PATH } COMPONENT java )
add_dependencies ( ${ the_module } ${ the_module } _jar )
if ( BUILD_DOCS )
add_custom_command ( OUTPUT "${OPENCV_DEPHELPER}/${the_module}doc"
C O M M A N D $ { A N T _ E X E C U T A B L E } - n o i n p u t - k j a v a d o c
C O M M A N D $ { C M A K E _ C O M M A N D } - E t o u c h " $ { O P E N C V _ D E P H E L P E R } / $ { t h e _ m o d u l e } d o c "
W O R K I N G _ D I R E C T O R Y " $ { O P E N C V _ J A V A _ D I R } "
D E P E N D S $ { d e p e n d s }
C O M M E N T " G e n e r a t i n g J a v a d o c "
)
add_custom_target ( ${ the_module } doc DEPENDS "${OPENCV_DEPHELPER}/${the_module}doc" )
install ( DIRECTORY ${ OpenCV_BINARY_DIR } /doc/doxygen/html/javadoc
D E S T I N A T I O N " $ { O P E N C V _ D O C _ I N S T A L L _ P A T H } / h t m l "
C O M P O N E N T " d o c s " O P T I O N A L
$ { c o m p a t i b l e _ M E S S A G E _ N E V E R }
)
if ( OPENCV_JAVA_SDK_BUILD_TYPE STREQUAL "ANT" )
add_custom_command ( OUTPUT "${OPENCV_DEPHELPER}/${the_module}doc"
C O M M A N D $ { A N T _ E X E C U T A B L E } - n o i n p u t - k j a v a d o c
C O M M A N D $ { C M A K E _ C O M M A N D } - E t o u c h " $ { O P E N C V _ D E P H E L P E R } / $ { t h e _ m o d u l e } d o c "
W O R K I N G _ D I R E C T O R Y " $ { O P E N C V _ J A V A _ D I R } "
D E P E N D S $ { d e p e n d s }
C O M M E N T " G e n e r a t i n g J a v a d o c "
)
add_custom_target ( ${ the_module } doc DEPENDS "${OPENCV_DEPHELPER}/${the_module}doc" )
install ( DIRECTORY ${ OpenCV_BINARY_DIR } /doc/doxygen/html/javadoc
D E S T I N A T I O N " $ { O P E N C V _ D O C _ I N S T A L L _ P A T H } / h t m l "
C O M P O N E N T " d o c s " O P T I O N A L
$ { c o m p a t i b l e _ M E S S A G E _ N E V E R }
)
elseif ( OPENCV_JAVA_SDK_BUILD_TYPE STREQUAL "JAVA" )
set ( Java_JAVADOC_EXECUTABLE ${ Java_JAVADOC_EXECUTABLE } -encoding utf-8 )
# c r e a t e _ j a v a d o c p r o d u c e s t a r g e t $ { _ t a r g e t } _ j a v a d o c
create_javadoc ( ${ the_module }
F I L E S " @ $ { O P E N C V _ J A V A _ D I R } / j a v a _ s o u r c e s "
S O U R C E P A T H " $ { O P E N C V _ J A V A _ D I R } / j a v a "
I N S T A L L P A T H " $ { O P E N C V _ J A V A D O C _ D E S T I N A T I O N } "
W I N D O W T I T L E " O p e n C V $ { O P E N C V _ V E R S I O N _ P L A I N } J a v a d o c u m e n t a t i o n "
D O C T I T L E " O p e n C V J a v a documentation ( ${ OPENCV_VERSION } ) "
V E R S I O N T R U E
)
add_dependencies ( ${ the_module } _javadoc ${ the_module } _jar_sources )
add_custom_target ( ${ the_module } doc DEPENDS ${ the_module } _javadoc )
install ( DIRECTORY ${ OpenCV_BINARY_DIR } /doc/doxygen/html/javadoc/ ${ the_module } /
D E S T I N A T I O N " $ { O P E N C V _ D O C _ I N S T A L L _ P A T H } / h t m l / j a v a d o c "
C O M P O N E N T " d o c s " O P T I O N A L
$ { c o m p a t i b l e _ M E S S A G E _ N E V E R }
)
else ( )
ocv_assert ( 0 )
endif ( )
set ( CMAKE_DOXYGEN_JAVADOC_NODE
" < t a b t y p e = \ " u s e r \ " u r l = \ " . / j a v a d o c / i n d e x . h t m l \ " t i t l e = \ " J a v a d o c u m e n t a t i o n \ " / > "
C A C H E I N T E R N A L " L i n k t o t h e J a v a d o c u m e n t a t i o n " ) # s e t t o t h e c a c h e t o m a k e i t g l o b a l