opencv/modules/world/CMakeLists.txt

79 lines
2.4 KiB
CMake
Raw Normal View History

set(the_description "All the selected OpenCV modules in a single binary")
set(OPENCV_MODULE_IS_PART_OF_WORLD FALSE)
set(BUILD_opencv_world_INIT OFF)
if(IOS OR NOT BUILD_SHARED_LIBS)
set(OPENCV_MODULE_TYPE STATIC)
set(OPENCV_WORLD_FLAGS_PROPERTY STATIC_LIBRARY_FLAGS)
else()
set(OPENCV_WORLD_FLAGS_PROPERTY LINK_FLAGS)
endif()
2014-08-01 22:11:20 +08:00
if(NOT OPENCV_INITIAL_PASS)
project(opencv_world)
message(STATUS "Processing WORLD modules...")
foreach(m ${OPENCV_MODULES_BUILD})
if(OPENCV_MODULE_${m}_IS_PART_OF_WORLD)
message(STATUS " module ${m}...")
set(CMAKE_CURRENT_SOURCE_DIR ${OPENCV_MODULE_${m}_LOCATION})
#add_subdirectory("${OPENCV_MODULE_${m}_LOCATION}" ${CMAKE_CURRENT_BINARY_DIR}/${m})
include("${OPENCV_MODULE_${m}_LOCATION}/CMakeLists.txt")
endif()
endforeach()
2014-08-01 22:11:20 +08:00
message(STATUS "Processing WORLD modules... DONE")
set(CMAKE_CURRENT_SOURCE_DIR OPENCV_MODULE_${opencv_world}_LOCATION)
endif()
2014-08-01 22:11:20 +08:00
ocv_add_module(world opencv_core)
2014-08-01 22:11:20 +08:00
set(headers_list "HEADERS")
set(sources_list "SOURCES")
set(link_deps "")
foreach(m ${OPENCV_MODULE_${the_module}_DEPS})
2014-08-01 22:11:20 +08:00
set(headers_list "${headers_list};${OPENCV_MODULE_${m}_HEADERS}")
set(sources_list "${sources_list};${OPENCV_MODULE_${m}_SOURCES}")
set(link_deps "${link_deps};${OPENCV_MODULE_${m}_LINK_DEPS}")
endforeach()
2014-08-01 22:11:20 +08:00
ocv_glob_module_sources(${headers_list} ${sources_list})
2013-03-25 00:07:55 +08:00
2014-08-01 22:11:20 +08:00
ocv_module_include_directories()
2013-03-25 00:07:55 +08:00
2014-08-01 22:11:20 +08:00
#message(STATUS "${OPENCV_MODULE_${the_module}_HEADERS}")
#message(STATUS "${OPENCV_MODULE_${the_module}_SOURCES}")
ocv_create_module(${link_deps})
2013-08-21 20:44:09 +08:00
2014-08-01 22:11:20 +08:00
if(BUILD_opencv_imgcodecs)
ocv_imgcodecs_configure_target()
2013-08-21 20:44:09 +08:00
endif()
2014-08-01 22:11:20 +08:00
if(BUILD_opencv_videoio)
ocv_videoio_configure_target()
2013-08-21 20:44:09 +08:00
endif()
2014-08-01 22:11:20 +08:00
if(BUILD_opencv_highgui)
ocv_highgui_configure_target()
endif()
2014-08-08 19:57:54 +08:00
if(IOS OR APPLE)
set(merge_libs "")
macro(ios_include_3party_libs)
foreach(l ${ARGN})
add_dependencies(${the_module} ${l})
list(APPEND merge_libs "$<TARGET_LINKER_FILE:${l}>")
endforeach()
endmacro()
if(WITH_PNG)
ios_include_3party_libs(zlib libpng)
endif()
if(WITH_JPEG)
ios_include_3party_libs(libjpeg)
endif()
add_custom_command(TARGET ${the_module} POST_BUILD
COMMAND /usr/bin/libtool -static -o ${CMAKE_CURRENT_BINARY_DIR}/${the_module}_fat.a $<TARGET_LINKER_FILE:${the_module}> ${merge_libs}
COMMAND mv ${CMAKE_CURRENT_BINARY_DIR}/${the_module}_fat.a $<TARGET_LINKER_FILE:${the_module}>
)
endif()