1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-31 00:03:03 +04:00

cmake: Java/Android SDK refactoring

This commit is contained in:
Alexander Alekhin
2017-12-29 04:15:30 +00:00
parent 0cad2d2a83
commit 8533b45ce9
45 changed files with 914 additions and 847 deletions
+53
View File
@@ -0,0 +1,53 @@
project(${the_module}_jar)
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 "")
ocv_copyfiles_append_dir(JAVA_SRC_COPY "${OPENCV_JAVA_BINDINGS_DIR}/gen/java" "${java_src_dir}")
set(depends gen_opencv_java_source "${OPENCV_DEPHELPER}/gen_opencv_java_source")
ocv_copyfiles_add_target(${the_module}_jar_source_copy JAVA_SRC_COPY "Copy Java(JAR) source files" ${depends})
set(depends ${the_module}_jar_source_copy "${OPENCV_DEPHELPER}/${the_module}_jar_source_copy")
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/build.xml.in" "${OPENCV_JAVA_DIR}/build.xml" @ONLY)
list(APPEND depends "${OPENCV_JAVA_DIR}/build.xml")
add_custom_command(OUTPUT "${OPENCV_DEPHELPER}/${the_module}_jar"
COMMAND ${ANT_EXECUTABLE} -noinput -k jar
COMMAND ${CMAKE_COMMAND} -E touch "${OPENCV_DEPHELPER}/${the_module}_jar"
WORKING_DIRECTORY "${OPENCV_JAVA_DIR}"
DEPENDS ${depends}
COMMENT "Generating ${JAR_NAME}"
)
add_custom_target(${the_module}_jar DEPENDS "${OPENCV_DEPHELPER}/${the_module}_jar")
add_custom_command(OUTPUT "${OPENCV_DEPHELPER}/${the_module}doc"
COMMAND ${ANT_EXECUTABLE} -noinput -k javadoc
COMMAND ${CMAKE_COMMAND} -E touch "${OPENCV_DEPHELPER}/${the_module}doc"
WORKING_DIRECTORY "${OPENCV_JAVA_DIR}"
DEPENDS ${depends}
COMMENT "Generating Javadoc"
)
add_custom_target(${the_module}doc DEPENDS "${OPENCV_DEPHELPER}/${the_module}doc")
install(FILES ${OPENCV_JAR_FILE} OPTIONAL DESTINATION ${OPENCV_JAR_INSTALL_PATH} COMPONENT java)
add_dependencies(${the_module} ${the_module}_jar)
if(BUILD_DOCS)
add_dependencies(opencv_docs ${the_module}doc)
install(DIRECTORY ${OpenCV_BINARY_DIR}/doc/javadoc
DESTINATION "${OPENCV_DOC_INSTALL_PATH}/javadoc"
COMPONENT "docs" OPTIONAL
)
endif()
+19 -8
View File
@@ -3,28 +3,39 @@
<!-- interface files into OpenCV.jar -->
<project name="OpenCV">
<tstamp>
<format property="timestamp" pattern="EEE MMM d yyyy HH:mm:ss z"/>
</tstamp>
<target name="jar">
<!-- This is to make a jar with a source attachment, for e.g. easy -->
<!-- navigation in Eclipse. See this question: -->
<!-- http://stackoverflow.com/questions/3584968/ant-how-to-compile-jar-that-includes-source-attachment -->
<javac sourcepath="" srcdir="src" destdir="src" debug="on" includeantruntime="false" >
<javac sourcepath="" srcdir="java" destdir="build/classes" debug="on" includeantruntime="false" >
<include name="**/*.java"/>
<compilerarg line="-encoding utf-8"/>
</javac>
<jar basedir="src" destfile="bin/@JAR_NAME@"/>
<jar destfile="@OPENCV_JAR_FILE@">
<fileset dir="java"/>
<fileset dir="build/classes"/>
<manifest>
<attribute name="Specification-Title" value="OpenCV"/>
<attribute name="Specification-Version" value="@OPENCV_VERSION@"/>
<attribute name="Implementation-Title" value="OpenCV"/>
<attribute name="Implementation-Version" value="@OPENCV_VCSVERSION@"/>
<attribute name="Implementation-Date" value="${timestamp}"/>
</manifest>
</jar>
</target>
<target name="javadoc">
<tstamp>
<format property="doctimestamp" pattern="EEE MMM d yyyy HH:mm:ss z"/>
</tstamp>
<javadoc
packagenames="org.opencv.*"
sourcepath="src"
destdir="doc/javadoc"
sourcepath="java"
destdir="@OpenCV_BINARY_DIR@/doc/javadoc"
Windowtitle="OpenCV @OPENCV_VERSION_PLAIN@ Java documentation"
Doctitle="OpenCV Java documentation (@OPENCV_VERSION@)"
bottom="Generated on ${doctimestamp} / OpenCV @OPENCV_VCSVERSION@"
bottom="Generated on ${timestamp} / OpenCV @OPENCV_VCSVERSION@"
/>
</target>