mirror of https://github.com/opencv/opencv.git
Open Source Computer Vision Library
https://opencv.org/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
73 lines
3.2 KiB
73 lines
3.2 KiB
8 years ago
|
if(NOT ANT_EXECUTABLE
|
||
|
OR NOT BUILD_opencv_imgcodecs
|
||
|
OR NOT BUILD_opencv_calib3d)
|
||
12 years ago
|
return()
|
||
|
endif()
|
||
|
|
||
|
project(opencv_test_java)
|
||
|
|
||
|
set(opencv_test_java_bin_dir "${CMAKE_CURRENT_BINARY_DIR}/.build")
|
||
10 years ago
|
set(test_dir ${CMAKE_CURRENT_SOURCE_DIR})
|
||
|
set(test_common_dir "${CMAKE_CURRENT_SOURCE_DIR}/../common_test")
|
||
|
|
||
|
set(opencv_test_java_file_deps "")
|
||
12 years ago
|
|
||
11 years ago
|
# make sure the build directory exists
|
||
|
file(MAKE_DIRECTORY "${opencv_test_java_bin_dir}")
|
||
|
|
||
10 years ago
|
# 1. gather and copy common test files (resources, utils, etc.)
|
||
|
copy_common_tests(test_common_dir opencv_test_java_bin_dir opencv_test_java_file_deps)
|
||
12 years ago
|
|
||
10 years ago
|
# 2. gather and copy tests from each module
|
||
|
copy_modules_tests(OPENCV_JAVA_MODULES opencv_test_java_bin_dir opencv_test_java_file_deps)
|
||
12 years ago
|
|
||
10 years ago
|
# 3. gather and copy specific files for pure java
|
||
|
file(GLOB_RECURSE test_files RELATIVE "${test_dir}" "${test_dir}/src/*")
|
||
|
file(GLOB_RECURSE test_lib_files RELATIVE "${test_dir}" "${test_dir}/lib/*.jar")
|
||
|
foreach(f ${test_files} ${test_lib_files})
|
||
12 years ago
|
add_custom_command(OUTPUT "${opencv_test_java_bin_dir}/${f}"
|
||
9 years ago
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${test_dir}/${f}" "${opencv_test_java_bin_dir}/${f}"
|
||
10 years ago
|
DEPENDS "${test_dir}/${f}"
|
||
12 years ago
|
COMMENT "Copying ${f}"
|
||
|
)
|
||
10 years ago
|
list(APPEND opencv_test_java_file_deps "${test_dir}/${f}" "${opencv_test_java_bin_dir}/${f}")
|
||
12 years ago
|
endforeach()
|
||
|
|
||
|
# Copy the OpenCV jar after it has been generated.
|
||
12 years ago
|
add_custom_command(OUTPUT "${opencv_test_java_bin_dir}/bin/${JAR_NAME}"
|
||
9 years ago
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${JAR_FILE}" "${opencv_test_java_bin_dir}/bin/${JAR_NAME}"
|
||
12 years ago
|
DEPENDS "${JAR_FILE}"
|
||
|
COMMENT "Copying the OpenCV jar"
|
||
|
)
|
||
12 years ago
|
|
||
12 years ago
|
add_custom_command(OUTPUT "${opencv_test_java_bin_dir}/build.xml"
|
||
9 years ago
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/build.xml" "${opencv_test_java_bin_dir}/build.xml"
|
||
12 years ago
|
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/build.xml"
|
||
|
COMMENT "Copying build.xml"
|
||
|
)
|
||
12 years ago
|
|
||
12 years ago
|
add_custom_command(OUTPUT "${opencv_test_java_bin_dir}/build/jar/opencv-test.jar"
|
||
|
COMMAND "${ANT_EXECUTABLE}" build
|
||
|
WORKING_DIRECTORY "${opencv_test_java_bin_dir}"
|
||
|
DEPENDS ${opencv_test_java_file_deps} "${opencv_test_java_bin_dir}/build.xml" "${CMAKE_CURRENT_SOURCE_DIR}/build.xml" "${JAR_FILE}" "${opencv_test_java_bin_dir}/bin/${JAR_NAME}"
|
||
|
COMMENT "Build Java tests"
|
||
|
)
|
||
12 years ago
|
|
||
11 years ago
|
# Not add_custom_command because generator expressions aren't supported in
|
||
|
# OUTPUT file names, and we need to generate different files for different
|
||
|
# configurations.
|
||
|
add_custom_target(${PROJECT_NAME}_properties
|
||
|
COMMAND "${CMAKE_COMMAND}" -E echo "opencv.lib.path = $<TARGET_FILE_DIR:${the_module}>"
|
||
|
> "${opencv_test_java_bin_dir}/ant-$<CONFIGURATION>.properties"
|
||
|
VERBATIM
|
||
|
)
|
||
|
|
||
|
add_custom_target(${PROJECT_NAME} ALL
|
||
|
DEPENDS ${the_module} ${PROJECT_NAME}_properties
|
||
|
SOURCES "${opencv_test_java_bin_dir}/build/jar/opencv-test.jar"
|
||
|
)
|
||
12 years ago
|
|
||
|
if(ENABLE_SOLUTION_FOLDERS)
|
||
|
set_target_properties(${PROJECT_NAME} PROPERTIES FOLDER "tests accuracy")
|
||
|
endif()
|