Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Tetragramm
GitHub Repository: Tetragramm/opencv
Path: blob/master/modules/java/CMakeLists.txt
16337 views
1
if(OPENCV_INITIAL_PASS)
2
# generator for JNI/JAR source code and documentation signatures
3
add_subdirectory(generator)
4
endif()
5
6
if(APPLE_FRAMEWORK OR WINRT OR NOT PYTHON_DEFAULT_AVAILABLE OR NOT ANT_EXECUTABLE
7
OR NOT (JNI_FOUND OR (ANDROID AND ANDROID_NATIVE_API_LEVEL GREATER 7))
8
OR BUILD_opencv_world
9
)
10
ocv_module_disable(java)
11
endif()
12
13
set(the_description "The java bindings")
14
ocv_add_module(java BINDINGS opencv_core opencv_imgproc PRIVATE_REQUIRED opencv_java_bindings_generator)
15
16
include(${CMAKE_CURRENT_SOURCE_DIR}/common.cmake)
17
18
# UTILITY: glob specific sources and append them to list (type is in H, CPP, JAVA, AIDL)
19
macro(glob_more_specific_sources _type _root _output)
20
unset(_masks)
21
if(${_type} STREQUAL "H")
22
set(_masks "${_root}/cpp/*.h" "${root}/cpp/*.hpp")
23
elseif(${_type} STREQUAL "CPP")
24
set(_masks "${_root}/cpp/*.cpp")
25
elseif(${_type} STREQUAL "JAVA")
26
set(_masks "${_root}/java/*.java" "${_root}/java/*.java.in")
27
elseif(${_type} STREQUAL "AIDL")
28
set(_masks "${_root}/java/*.aidl")
29
endif()
30
if (_masks)
31
file(GLOB _result ${_masks})
32
list(APPEND ${_output} ${_result})
33
else()
34
message(WARNING "Bad argument passed to macro: skipped")
35
endif()
36
endmacro()
37
38
# UTILITY: copy common java test files and add them to _deps
39
# copy_common_tests(<source-folder> <destination-folder> <variable-to-store-deps>)
40
macro(copy_common_tests _src_location _dst_location _deps)
41
set(_src ${_src_location})
42
set(_dst ${_dst_location})
43
file(GLOB_RECURSE _files RELATIVE "${_src}" "${_src}/res/*" "${_src}/src/*")
44
foreach(f ${_files})
45
add_custom_command(
46
OUTPUT "${_dst}/${f}"
47
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${_src}/${f}" "${_dst}/${f}"
48
MAIN_DEPENDENCY "${_src}/${f}"
49
COMMENT "Copying ${f}")
50
list(APPEND ${_deps} "${_src}/${f}" "${_dst}/${f}")
51
endforeach()
52
unset(_files)
53
unset(_src)
54
unset(_dst)
55
endmacro()
56
57
58
add_subdirectory(jni) # generates ${the_module} target (${the_module}_jni doesn't work properly with Android samples)
59
if(ANDROID)
60
add_subdirectory(android_sdk) # generates ${the_module}_android target
61
else()
62
add_subdirectory(jar) # generates ${the_module}_jar target
63
endif()
64
65
if(BUILD_TESTS)
66
if(ANDROID)
67
add_subdirectory(test/android_test)
68
else()
69
add_subdirectory(test/pure_test)
70
endif()
71
endif()
72
73