mirror of
https://github.com/opencv/opencv.git
synced 2025-06-07 01:13:28 +08:00
Compiling the Java tutorials codes using Apache Ant.
This commit is contained in:
parent
9bb17caa24
commit
3611396c0b
@ -11,6 +11,7 @@ if(NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_LIST_DIR)
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
add_subdirectory(cpp)
|
||||
add_subdirectory(java/tutorial_code)
|
||||
add_subdirectory(gpu)
|
||||
add_subdirectory(tapi)
|
||||
|
||||
@ -78,6 +79,8 @@ endif()
|
||||
add_subdirectory(cpp)
|
||||
# FIXIT: can't use cvconfig.h in samples: add_subdirectory(gpu)
|
||||
|
||||
add_subdirectory(java/tutorial_code)
|
||||
|
||||
add_subdirectory(opencl)
|
||||
|
||||
if(WIN32)
|
||||
|
40
samples/java/tutorial_code/CMakeLists.txt
Normal file
40
samples/java/tutorial_code/CMakeLists.txt
Normal file
@ -0,0 +1,40 @@
|
||||
# ----------------------------------------------------------------------------
|
||||
# CMake file for Java tutorials compilation.
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
if(NOT ANT_EXECUTABLE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
project(compile_java_tutorials)
|
||||
|
||||
set(curdir "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
set(opencv_tutorial_java_bin_dir "${CMAKE_CURRENT_BINARY_DIR}/.compiled")
|
||||
set(target_name "compile_java_tutorials")
|
||||
set(TUTORIALS_DIRS "")
|
||||
|
||||
FILE(GLOB children RELATIVE ${curdir} ${curdir}/*/*)
|
||||
FOREACH(child ${children})
|
||||
if(IS_DIRECTORY ${curdir}/${child})
|
||||
FILE(GLOB contains_java_files "${child}/*.java")
|
||||
if(contains_java_files)
|
||||
LIST(APPEND TUTORIALS_DIRS ${child})
|
||||
endif()
|
||||
endif()
|
||||
ENDFOREACH()
|
||||
|
||||
add_custom_target("${target_name}" ALL
|
||||
DEPENDS opencv_java
|
||||
)
|
||||
|
||||
FOREACH(tutorial_dir ${TUTORIALS_DIRS})
|
||||
get_filename_component(tutorial_name ${tutorial_dir} NAME_WE)
|
||||
add_custom_command(TARGET "${target_name}"
|
||||
COMMAND ${ANT_EXECUTABLE} -q
|
||||
-DocvJarDir="${OpenCV_BINARY_DIR}/bin"
|
||||
-DsrcDir="${tutorial_dir}"
|
||||
-DdstDir="${opencv_tutorial_java_bin_dir}/${tutorial_name}"
|
||||
WORKING_DIRECTORY "${curdir}"
|
||||
COMMENT "Compile the tutorial: ${tutorial_name}"
|
||||
)
|
||||
ENDFOREACH()
|
13
samples/java/tutorial_code/build.xml
Normal file
13
samples/java/tutorial_code/build.xml
Normal file
@ -0,0 +1,13 @@
|
||||
<project default="compile">
|
||||
|
||||
<property name="lib.dir" value="${ocvJarDir}"/>
|
||||
<path id="classpath">
|
||||
<fileset dir="${lib.dir}" includes="**/*.jar"/>
|
||||
</path>
|
||||
|
||||
<target name="compile">
|
||||
<mkdir dir="${dstDir}"/>
|
||||
<javac includeantruntime="false" srcdir="${srcDir}" destdir="${dstDir}" classpathref="classpath"/>
|
||||
</target>
|
||||
|
||||
</project>
|
Loading…
Reference in New Issue
Block a user