mirror of
https://github.com/opencv/opencv.git
synced 2025-01-18 14:13:15 +08:00
Fixed optional dependencies tracking in CMake. Fixed TBB compiler definitions for Android.
This commit is contained in:
parent
6620c5c92d
commit
8748cbc232
1
3rdparty/tbb/CMakeLists.txt
vendored
1
3rdparty/tbb/CMakeLists.txt
vendored
@ -114,6 +114,7 @@ add_definitions(-D__TBB_DYNAMIC_LOAD_ENABLED=0 #required
|
||||
if(tbb_need_GENERIC_DWORD_LOAD_STORE)
|
||||
#needed by TBB 4.0 update 1,2; fixed in TBB 4.0 update 3 but it has 2 new problems
|
||||
add_definitions(-D__TBB_USE_GENERIC_DWORD_LOAD_STORE=1)
|
||||
set(tbb_need_GENERIC_DWORD_LOAD_STORE ON PARENT_SCOPE)
|
||||
endif()
|
||||
|
||||
add_library(tbb STATIC ${lib_srcs} ${lib_hdrs} "${CMAKE_CURRENT_SOURCE_DIR}/android_additional.h" "${CMAKE_CURRENT_SOURCE_DIR}/${tbb_version_file}")
|
||||
|
@ -2,7 +2,10 @@ if(ANDROID)
|
||||
add_subdirectory("${OpenCV_SOURCE_DIR}/3rdparty/tbb")
|
||||
include_directories(SYSTEM ${TBB_INCLUDE_DIRS})
|
||||
set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} tbb)
|
||||
add_definitions(-DTBB_USE_GCC_BUILTINS=1 -D__TBB_GCC_BUILTIN_ATOMICS_PRESENT=1 -D__TBB_USE_GENERIC_DWORD_LOAD_STORE=1)
|
||||
add_definitions(-DTBB_USE_GCC_BUILTINS=1 -D__TBB_GCC_BUILTIN_ATOMICS_PRESENT=1)
|
||||
if(tbb_need_GENERIC_DWORD_LOAD_STORE)
|
||||
add_definitions(-D__TBB_USE_GENERIC_DWORD_LOAD_STORE=1)
|
||||
endif()
|
||||
set(HAVE_TBB 1)
|
||||
elseif(UNIX AND NOT APPLE)
|
||||
PKG_CHECK_MODULES(TBB tbb)
|
||||
|
@ -220,9 +220,9 @@ endmacro()
|
||||
|
||||
# Internal macro for dependencies tracking
|
||||
macro(__ocv_flatten_module_optional_dependencies the_module)
|
||||
set(__flattened_deps ${OPENCV_MODULE_${the_module}_DEPS})
|
||||
set(__resolved_deps ${OPENCV_MODULE_${the_module}_DEPS})
|
||||
set(__opt_depends ${OPENCV_MODULE_${the_module}_OPT_DEPS})
|
||||
set(__flattened_deps "")
|
||||
set(__resolved_deps "")
|
||||
set(__opt_depends ${OPENCV_MODULE_${the_module}_REQ_DEPS} ${OPENCV_MODULE_${the_module}_OPT_DEPS})
|
||||
|
||||
while(__opt_depends)
|
||||
ocv_list_pop_front(__opt_depends __dep)
|
||||
@ -275,8 +275,15 @@ macro(__ocv_flatten_module_dependencies)
|
||||
set(OPENCV_MODULE_${m}_DEPS_EXT ${OPENCV_MODULE_${m}_DEPS_EXT} CACHE INTERNAL "Extra dependencies of ${m} module")
|
||||
endforeach()
|
||||
|
||||
# order modules by dependencies
|
||||
set(OPENCV_MODULES_BUILD_ "")
|
||||
foreach(m ${OPENCV_MODULES_BUILD})
|
||||
list(APPEND OPENCV_MODULES_BUILD_ ${OPENCV_MODULE_${m}_DEPS} ${m})
|
||||
endforeach()
|
||||
ocv_list_unique(OPENCV_MODULES_BUILD_)
|
||||
|
||||
set(OPENCV_MODULES_PUBLIC ${OPENCV_MODULES_PUBLIC} CACHE INTERNAL "List of OpenCV modules marked for export")
|
||||
set(OPENCV_MODULES_BUILD ${OPENCV_MODULES_BUILD} CACHE INTERNAL "List of OpenCV modules included into the build")
|
||||
set(OPENCV_MODULES_BUILD ${OPENCV_MODULES_BUILD_} CACHE INTERNAL "List of OpenCV modules included into the build")
|
||||
set(OPENCV_MODULES_DISABLED_AUTO ${OPENCV_MODULES_DISABLED_AUTO} CACHE INTERNAL "List of OpenCV modules implicitly disabled due to dependencies")
|
||||
endmacro()
|
||||
|
||||
@ -312,7 +319,16 @@ macro(ocv_glob_modules)
|
||||
endif()
|
||||
list(APPEND __directories_observed "${__modpath}")
|
||||
|
||||
add_subdirectory("${__modpath}" "${CMAKE_CURRENT_BINARY_DIR}/${mod}/.${mod}")
|
||||
if(OCV_MODULE_RELOCATE_ON_INITIAL_PASS)
|
||||
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${mod}/.${mod}")
|
||||
file(COPY "${__modpath}/CMakeLists.txt" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/${mod}/.${mod}")
|
||||
add_subdirectory("${CMAKE_CURRENT_BINARY_DIR}/${mod}/.${mod}" "${CMAKE_CURRENT_BINARY_DIR}/${mod}/.${mod}")
|
||||
if("${OPENCV_MODULE_opencv_${mod}_LOCATION}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}/${mod}/.${mod}")
|
||||
set(OPENCV_MODULE_opencv_${mod}_LOCATION "${__modpath}" CACHE PATH "" FORCE)
|
||||
endif()
|
||||
else()
|
||||
add_subdirectory("${__modpath}" "${CMAKE_CURRENT_BINARY_DIR}/${mod}/.${mod}")
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
@ -322,17 +338,10 @@ macro(ocv_glob_modules)
|
||||
# resolve dependencies
|
||||
__ocv_flatten_module_dependencies()
|
||||
|
||||
# order modules by dependencies
|
||||
set(OPENCV_MODULES_BUILD_ "")
|
||||
foreach(m ${OPENCV_MODULES_BUILD})
|
||||
list(APPEND OPENCV_MODULES_BUILD_ ${OPENCV_MODULE_${m}_DEPS} ${m})
|
||||
endforeach()
|
||||
ocv_list_unique(OPENCV_MODULES_BUILD_)
|
||||
|
||||
# create modules
|
||||
set(OPENCV_INITIAL_PASS OFF PARENT_SCOPE)
|
||||
set(OPENCV_INITIAL_PASS OFF)
|
||||
foreach(m ${OPENCV_MODULES_BUILD_})
|
||||
foreach(m ${OPENCV_MODULES_BUILD})
|
||||
if(m MATCHES "^opencv_")
|
||||
string(REGEX REPLACE "^opencv_" "" __shortname "${m}")
|
||||
add_subdirectory("${OPENCV_MODULE_${m}_LOCATION}" "${CMAKE_CURRENT_BINARY_DIR}/${__shortname}")
|
||||
|
Loading…
Reference in New Issue
Block a user