1if (NOT GENERATE_ABI_DESCRIPTOR)
2  return()
3endif()
4
5set(filename "opencv_abi.xml")
6set(path1 "${CMAKE_BINARY_DIR}/${filename}")
7
8set(modules "${OPENCV_MODULES_PUBLIC}")
9ocv_list_filterout(modules "opencv_ts")
10
11message(STATUS "Generating ABI compliance checker configuration: ${filename}")
12
13if (OPENCV_VCSVERSION AND NOT OPENCV_VCSVERSION STREQUAL "unknown")
14  set(OPENCV_ABI_VERSION "${OPENCV_VCSVERSION}")
15else()
16  set(OPENCV_ABI_VERSION "${OPENCV_VERSION}")
17endif()
18
19# Headers
20set(OPENCV_ABI_HEADERS "{RELPATH}/${OPENCV_INCLUDE_INSTALL_PATH}")
21
22# Libraries
23set(OPENCV_ABI_LIBRARIES "{RELPATH}/${OPENCV_LIB_INSTALL_PATH}")
24
25set(OPENCV_ABI_SKIP_HEADERS "")
26set(OPENCV_ABI_SKIP_LIBRARIES "")
27foreach(mod ${OPENCV_MODULES_BUILD})
28  string(REGEX REPLACE "^opencv_" "" mod "${mod}")
29  if(NOT "${OPENCV_MODULE_opencv_${mod}_LOCATION}" STREQUAL "${OpenCV_SOURCE_DIR}/modules/${mod}")
30    # headers
31    foreach(h ${OPENCV_MODULE_opencv_${mod}_HEADERS})
32      file(RELATIVE_PATH h "${OPENCV_MODULE_opencv_${mod}_LOCATION}/include" "${h}")
33      list(APPEND OPENCV_ABI_SKIP_HEADERS "${h}")
34    endforeach()
35    # libraries
36    set(lib_name "")
37    get_target_property(lib_name opencv_${mod} LOCATION)
38    get_filename_component(lib_name "${lib_name}" NAME)
39    list(APPEND OPENCV_ABI_SKIP_LIBRARIES "${lib_name}")
40  endif()
41endforeach()
42string(REPLACE ";" "\n    " OPENCV_ABI_SKIP_HEADERS "${OPENCV_ABI_SKIP_HEADERS}")
43string(REPLACE ";" "\n    " OPENCV_ABI_SKIP_LIBRARIES "${OPENCV_ABI_SKIP_LIBRARIES}")
44
45# Options
46set(OPENCV_ABI_GCC_OPTIONS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE}")
47string(REGEX REPLACE "([^ ]) +([^ ])" "\\1\\n    \\2" OPENCV_ABI_GCC_OPTIONS "${OPENCV_ABI_GCC_OPTIONS}")
48
49configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/opencv_abi.xml.in" "${path1}")
50