mirror of
https://github.com/opencv/opencv.git
synced 2024-11-24 11:10:21 +08:00
cmake: fix includes processing
This commit is contained in:
parent
403c3c3d03
commit
3d6659112f
@ -164,7 +164,7 @@ macro(ocv_add_module _name)
|
||||
set(OPENCV_MODULE_${the_module}_LINK_DEPS "" CACHE INTERNAL "")
|
||||
|
||||
# parse list of dependencies
|
||||
if("${ARGV1}" STREQUAL "INTERNAL" OR "${ARGV1}" STREQUAL "BINDINGS")
|
||||
if(" ${ARGV1}" STREQUAL " INTERNAL" OR " ${ARGV1}" STREQUAL " BINDINGS")
|
||||
set(OPENCV_MODULE_${the_module}_CLASS "${ARGV1}" CACHE INTERNAL "The category of the module")
|
||||
set(__ocv_argn__ ${ARGN})
|
||||
list(REMOVE_AT __ocv_argn__ 0)
|
||||
@ -257,7 +257,7 @@ endmacro()
|
||||
# Usage: _glob_locations(<output paths list> <output names list> <folder> [<folder> ...])
|
||||
function(_glob_locations out_paths out_names)
|
||||
foreach(path ${ARGN})
|
||||
message(STATUS "Inspect: ${path}")
|
||||
#message(STATUS "Inspect: ${path}")
|
||||
list(LENGTH paths before)
|
||||
get_filename_component(path "${path}" ABSOLUTE)
|
||||
# Either module itself
|
||||
@ -269,7 +269,7 @@ function(_glob_locations out_paths out_names)
|
||||
# Either flat collection of modules
|
||||
file(GLOB subdirs RELATIVE "${path}" "${path}/*")
|
||||
foreach(subdir ${subdirs})
|
||||
message(STATUS "Inspect: ${path}/${subdir}")
|
||||
#message(STATUS "Inspect: ${path}/${subdir}")
|
||||
if(EXISTS "${path}/${subdir}/CMakeLists.txt")
|
||||
list(APPEND paths "${path}/${subdir}")
|
||||
list(APPEND names "${subdir}")
|
||||
@ -302,7 +302,7 @@ function(_add_modules_1 paths names)
|
||||
foreach(i RANGE ${len})
|
||||
list(GET ${paths} ${i} path)
|
||||
list(GET ${names} ${i} name)
|
||||
message(STATUS "First pass: ${name} => ${path}")
|
||||
#message(STATUS "First pass: ${name} => ${path}")
|
||||
include("${path}/cmake/init.cmake" OPTIONAL)
|
||||
add_subdirectory("${path}" "${CMAKE_CURRENT_BINARY_DIR}/.firstpass/${name}")
|
||||
endforeach()
|
||||
@ -320,7 +320,7 @@ function(_add_modules_2)
|
||||
message(WARNING "Incorrect module name: ${m}")
|
||||
endif()
|
||||
string(REGEX REPLACE "^opencv_" "" name "${m}")
|
||||
message(STATUS "Second pass: ${name} => ${OPENCV_MODULE_${m}_LOCATION}")
|
||||
#message(STATUS "Second pass: ${name} => ${OPENCV_MODULE_${m}_LOCATION}")
|
||||
add_subdirectory("${OPENCV_MODULE_${m}_LOCATION}" "${CMAKE_CURRENT_BINARY_DIR}/${name}")
|
||||
endif()
|
||||
endforeach()
|
||||
@ -427,7 +427,7 @@ function(__ocv_sort_modules_by_deps __lst)
|
||||
break()
|
||||
endif()
|
||||
else()
|
||||
message(FATAL_ERROR WARNING "Unresolved dependencies or loop in dependency graph (${length_after})\n"
|
||||
message(FATAL_ERROR "FATAL: Unresolved dependencies or loop in dependency graph (${length_after})\n"
|
||||
"Processed ${__lst}: ${${__lst}}\n"
|
||||
"Good modules: ${result}\n"
|
||||
"Bad modules: ${input}"
|
||||
@ -652,12 +652,14 @@ endmacro()
|
||||
# setup include paths for the list of passed modules
|
||||
macro(ocv_target_include_modules target)
|
||||
foreach(d ${ARGN})
|
||||
if(d MATCHES "^opencv_" AND HAVE_${d})
|
||||
if (EXISTS "${OPENCV_MODULE_${d}_LOCATION}/include")
|
||||
if(d MATCHES "^opencv_")
|
||||
if(HAVE_${d} AND EXISTS "${OPENCV_MODULE_${d}_LOCATION}/include")
|
||||
ocv_target_include_directories(${target} "${OPENCV_MODULE_${d}_LOCATION}/include")
|
||||
endif()
|
||||
elseif(EXISTS "${d}")
|
||||
ocv_target_include_directories(${target} "${d}")
|
||||
else()
|
||||
message(WARNING "Unexpected include: ${d} (module=${the_module})")
|
||||
endif()
|
||||
endforeach()
|
||||
endmacro()
|
||||
@ -686,14 +688,7 @@ macro(ocv_module_include_directories)
|
||||
"${OPENCV_MODULE_${the_module}_LOCATION}/src"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}" # for precompiled headers
|
||||
)
|
||||
foreach(arg ${ARGN})
|
||||
if(IS_ABSOLUTE "${arg}")
|
||||
list(APPEND incs "${arg}")
|
||||
else()
|
||||
list(APPEND incs "${OPENCV_MODULE_${the_module}_LOCATION}/${arg}")
|
||||
endif()
|
||||
endforeach()
|
||||
ocv_target_include_modules(${the_module} ${OPENCV_MODULE_${the_module}_DEPS} ${incs})
|
||||
ocv_target_include_modules(${the_module} ${OPENCV_MODULE_${the_module}_DEPS} ${ARGN})
|
||||
endmacro()
|
||||
|
||||
|
||||
|
@ -8,7 +8,7 @@ ocv_warnings_disable(CMAKE_CXX_FLAGS /wd4189 /wd4505 -Wundef -Wmissing-declarati
|
||||
|
||||
ocv_add_module(cudev)
|
||||
|
||||
ocv_module_include_directories(opencv_core opencv_hal)
|
||||
ocv_module_include_directories(opencv_core)
|
||||
|
||||
file(GLOB_RECURSE lib_hdrs "${CMAKE_CURRENT_LIST_DIR}/include/opencv2/${name}/*.hpp")
|
||||
file(GLOB lib_srcs "${CMAKE_CURRENT_LIST_DIR}/src/*.cpp")
|
||||
|
@ -53,16 +53,16 @@ ocv_warnings_disable(CMAKE_CXX_FLAGS
|
||||
)
|
||||
|
||||
if(PROTOBUF_UPDATE_FILES)
|
||||
file(GLOB proto_files "${CMAKE_CURRENT_SOURCE_DIR}/src/tensorflow/*.proto" "${CMAKE_CURRENT_SOURCE_DIR}/src/caffe/opencv-caffe.proto")
|
||||
file(GLOB proto_files "${CMAKE_CURRENT_LIST_DIR}/src/tensorflow/*.proto" "${CMAKE_CURRENT_LIST_DIR}/src/caffe/opencv-caffe.proto")
|
||||
set(PROTOBUF_GENERATE_CPP_APPEND_PATH ON) # required for tensorflow
|
||||
protobuf_generate_cpp(fw_srcs fw_hdrs ${proto_files})
|
||||
else()
|
||||
file(GLOB fw_srcs "${CMAKE_CURRENT_SOURCE_DIR}/misc/tensorflow/*.cc" "${CMAKE_CURRENT_SOURCE_DIR}/misc/caffe/opencv-caffe.pb.cc")
|
||||
file(GLOB fw_hdrs "${CMAKE_CURRENT_SOURCE_DIR}/misc/tensorflow/*.h" "${CMAKE_CURRENT_SOURCE_DIR}/misc/caffe/opencv-caffe.pb.h")
|
||||
set(fw_inc "misc/caffe" "misc/tensorflow")
|
||||
file(GLOB fw_srcs "${CMAKE_CURRENT_LIST_DIR}/misc/tensorflow/*.cc" "${CMAKE_CURRENT_LIST_DIR}/misc/caffe/opencv-caffe.pb.cc")
|
||||
file(GLOB fw_hdrs "${CMAKE_CURRENT_LIST_DIR}/misc/tensorflow/*.h" "${CMAKE_CURRENT_LIST_DIR}/misc/caffe/opencv-caffe.pb.h")
|
||||
set(fw_inc "${CMAKE_CURRENT_LIST_DIR}/misc/caffe" "${CMAKE_CURRENT_LIST_DIR}/misc/tensorflow")
|
||||
endif()
|
||||
|
||||
ocv_module_include_directories(${fw_inc} src/ocl4dnn/include ${OPENCL_INCLUDE_DIRS})
|
||||
ocv_module_include_directories(${fw_inc} ${CMAKE_CURRENT_LIST_DIR}/src/ocl4dnn/include ${OPENCL_INCLUDE_DIRS})
|
||||
ocv_glob_module_sources(SOURCES ${fw_srcs})
|
||||
ocv_create_module(libprotobuf ${LAPACK_LIBRARIES})
|
||||
ocv_add_samples()
|
||||
|
Loading…
Reference in New Issue
Block a user