mirror of
https://github.com/opencv/opencv.git
synced 2026-07-30 07:43:03 +04:00
Merge remote-tracking branch 'upstream/3.4' into merge-3.4
This commit is contained in:
@@ -29,8 +29,10 @@ function(ocv_tbb_cmake_guess _found)
|
||||
message(STATUS "Found TBB (cmake): ${_lib}")
|
||||
get_target_property(_inc TBB::tbb INTERFACE_INCLUDE_DIRECTORIES)
|
||||
ocv_tbb_read_version("${_inc}")
|
||||
add_library(tbb INTERFACE)
|
||||
target_link_libraries(tbb INTERFACE TBB::tbb)
|
||||
add_library(tbb INTERFACE IMPORTED)
|
||||
set_target_properties(tbb PROPERTIES
|
||||
INTERFACE_LINK_LIBRARIES TBB::tbb
|
||||
)
|
||||
set(${_found} TRUE PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
@@ -42,24 +42,34 @@ endif()
|
||||
ocv_clear_vars(HAVE_GTK HAVE_GTK3 HAVE_GTHREAD HAVE_GTKGLEXT)
|
||||
if(WITH_GTK AND NOT HAVE_QT)
|
||||
if(NOT WITH_GTK_2_X)
|
||||
CHECK_MODULE(gtk+-3.0 HAVE_GTK3 HIGHGUI)
|
||||
ocv_check_modules(GTK3 gtk+-3.0)
|
||||
if(HAVE_GTK3)
|
||||
ocv_append_build_options(HIGHGUI GTK3)
|
||||
set(HAVE_GTK TRUE)
|
||||
endif()
|
||||
endif()
|
||||
if(NOT HAVE_GTK)
|
||||
CHECK_MODULE(gtk+-2.0 HAVE_GTK HIGHGUI)
|
||||
if(HAVE_GTK AND (ALIASOF_gtk+-2.0_VERSION VERSION_LESS MIN_VER_GTK))
|
||||
message (FATAL_ERROR "GTK support requires a minimum version of ${MIN_VER_GTK} (${ALIASOF_gtk+-2.0_VERSION} found)")
|
||||
set(HAVE_GTK FALSE)
|
||||
ocv_check_modules(GTK2 gtk+-2.0)
|
||||
if(HAVE_GTK2)
|
||||
if (GTK2_VERSION VERSION_LESS MIN_VER_GTK)
|
||||
message (FATAL_ERROR "GTK support requires a minimum version of ${MIN_VER_GTK} (${GTK2_VERSION} found)")
|
||||
else()
|
||||
ocv_append_build_options(HIGHGUI GTK2)
|
||||
set(HAVE_GTK TRUE)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
CHECK_MODULE(gthread-2.0 HAVE_GTHREAD HIGHGUI)
|
||||
ocv_check_modules(GTHREAD gthread-2.0)
|
||||
if(HAVE_GTK AND NOT HAVE_GTHREAD)
|
||||
message(FATAL_ERROR "gthread not found. This library is required when building with GTK support")
|
||||
else()
|
||||
ocv_append_build_options(HIGHGUI GTHREAD)
|
||||
endif()
|
||||
if(WITH_OPENGL AND NOT HAVE_GTK3)
|
||||
CHECK_MODULE(gtkglext-1.0 HAVE_GTKGLEXT HIGHGUI)
|
||||
ocv_check_modules(GTKGLEXT gtkglext-1.0)
|
||||
if(HAVE_GTKGLEXT)
|
||||
ocv_append_build_options(GTKGLEXT GTHREAD)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
@@ -59,14 +59,13 @@ endif(WITH_EIGEN)
|
||||
ocv_clear_vars(HAVE_CLP)
|
||||
if(WITH_CLP)
|
||||
if(UNIX)
|
||||
PKG_CHECK_MODULES(CLP clp)
|
||||
ocv_check_modules(CLP clp)
|
||||
if(CLP_FOUND)
|
||||
set(HAVE_CLP TRUE)
|
||||
if(NOT ${CLP_INCLUDE_DIRS} STREQUAL "")
|
||||
ocv_include_directories(${CLP_INCLUDE_DIRS})
|
||||
endif()
|
||||
link_directories(${CLP_LIBRARY_DIRS})
|
||||
set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} ${CLP_LIBRARIES})
|
||||
list(APPEND OPENCV_LINKER_LIBS ${CLP_LIBRARIES})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
@@ -43,18 +43,9 @@ MACRO(_PCH_GET_COMPILE_FLAGS _out_compile_flags)
|
||||
LIST(APPEND ${_out_compile_flags} "-fPIC")
|
||||
ENDIF()
|
||||
|
||||
GET_PROPERTY(_definitions DIRECTORY PROPERTY COMPILE_DEFINITIONS)
|
||||
if(_definitions)
|
||||
foreach(_def ${_definitions})
|
||||
LIST(APPEND ${_out_compile_flags} "\"-D${_def}\"")
|
||||
endforeach()
|
||||
endif()
|
||||
GET_TARGET_PROPERTY(_target_definitions ${_PCH_current_target} COMPILE_DEFINITIONS)
|
||||
if(_target_definitions)
|
||||
foreach(_def ${_target_definitions})
|
||||
LIST(APPEND ${_out_compile_flags} "\"-D${_def}\"")
|
||||
endforeach()
|
||||
endif()
|
||||
# Processed via $<TARGET_PROPERTY:target,COMPILE_DEFINITIONS>
|
||||
#GET_PROPERTY(_definitions DIRECTORY PROPERTY COMPILE_DEFINITIONS)
|
||||
#GET_TARGET_PROPERTY(_target_definitions ${_PCH_current_target} COMPILE_DEFINITIONS)
|
||||
|
||||
GET_TARGET_PROPERTY(_cxx_standard ${_PCH_current_target} CXX_STANDARD)
|
||||
if (_cxx_standard)
|
||||
@@ -304,12 +295,22 @@ MACRO(ADD_PRECOMPILED_HEADER _targetName _input)
|
||||
#message("_command ${_input} ${_output}")
|
||||
_PCH_GET_COMPILE_COMMAND(_command ${CMAKE_CURRENT_BINARY_DIR}/${_name} ${_output} )
|
||||
|
||||
set(_pch_generate_file_cmd "${CMAKE_CURRENT_BINARY_DIR}/${_name}.command.sh")
|
||||
string(REPLACE " " "\\ " _command "${_command}")
|
||||
string(REPLACE ";" " " _command "${_command}")
|
||||
file(GENERATE OUTPUT "${_pch_generate_file_cmd}" CONTENT "#!/bin/sh
|
||||
if [ -n \"$VERBOSE\" ]; then
|
||||
tail -n1 \$0
|
||||
fi
|
||||
${_command} -D$<JOIN:$<TARGET_PROPERTY:${_targetName},COMPILE_DEFINITIONS>, -D>
|
||||
")
|
||||
GET_FILENAME_COMPONENT(_outdir ${_output} PATH)
|
||||
ADD_CUSTOM_COMMAND(
|
||||
OUTPUT "${_output}"
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory "${_outdir}"
|
||||
COMMAND ${_command}
|
||||
DEPENDS "${_input}"
|
||||
COMMAND chmod +x "${_pch_generate_file_cmd}"
|
||||
COMMAND "${_pch_generate_file_cmd}"
|
||||
DEPENDS "${_input}" "${_pch_generate_file_cmd}"
|
||||
DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/${_name}"
|
||||
DEPENDS ${_targetName}_pch_dephelp
|
||||
)
|
||||
|
||||
+58
-31
@@ -1,3 +1,7 @@
|
||||
if(COMMAND ocv_cmake_dump_vars) # include guard
|
||||
return()
|
||||
endif()
|
||||
|
||||
include(CMakeParseArguments)
|
||||
|
||||
# Debugging function
|
||||
@@ -701,7 +705,7 @@ endfunction()
|
||||
|
||||
# Usage: ocv_append_build_options(HIGHGUI FFMPEG)
|
||||
macro(ocv_append_build_options var_prefix pkg_prefix)
|
||||
foreach(suffix INCLUDE_DIRS LIBRARIES LIBRARY_DIRS)
|
||||
foreach(suffix INCLUDE_DIRS LIBRARIES LIBRARY_DIRS LINK_LIBRARIES)
|
||||
if(${pkg_prefix}_${suffix})
|
||||
list(APPEND ${var_prefix}_${suffix} ${${pkg_prefix}_${suffix}})
|
||||
list(REMOVE_DUPLICATES ${var_prefix}_${suffix})
|
||||
@@ -739,7 +743,9 @@ macro(ocv_check_modules define)
|
||||
endif()
|
||||
unset(${define}_${__modname}_FOUND)
|
||||
endforeach()
|
||||
pkg_check_modules(${define} ${ARGN})
|
||||
if(COMMAND pkg_check_modules)
|
||||
pkg_check_modules(${define} ${ARGN})
|
||||
endif()
|
||||
if(${define}_FOUND)
|
||||
set(HAVE_${define} 1)
|
||||
endif()
|
||||
@@ -753,29 +759,47 @@ macro(ocv_check_modules define)
|
||||
set(${define}_${__modname}_FOUND 1)
|
||||
endif()
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
|
||||
# Macro that checks if module has been installed.
|
||||
# After it adds module to build and define
|
||||
# constants passed as second arg
|
||||
macro(CHECK_MODULE module_name define cv_module)
|
||||
set(${define} 0)
|
||||
if(PKG_CONFIG_FOUND)
|
||||
set(ALIAS ALIASOF_${module_name})
|
||||
set(ALIAS_FOUND ${ALIAS}_FOUND)
|
||||
set(ALIAS_INCLUDE_DIRS ${ALIAS}_INCLUDE_DIRS)
|
||||
set(ALIAS_LIBRARY_DIRS ${ALIAS}_LIBRARY_DIRS)
|
||||
set(ALIAS_LIBRARIES ${ALIAS}_LIBRARIES)
|
||||
|
||||
PKG_CHECK_MODULES(${ALIAS} ${module_name})
|
||||
if(${ALIAS_FOUND})
|
||||
set(${define} 1)
|
||||
ocv_append_build_options(${cv_module} ${ALIAS})
|
||||
if(${define}_FOUND AND ${define}_LIBRARIES)
|
||||
if(${define}_LINK_LIBRARIES_XXXXX) # CMake 3.12+: https://gitlab.kitware.com/cmake/cmake/merge_requests/2068
|
||||
set(${define}_LIBRARIES "${${define}_LINK_LIBRARIES}" CACHE INTERNAL "")
|
||||
else()
|
||||
unset(_libs) # absolute paths
|
||||
unset(_libs_paths) # -L args
|
||||
foreach(flag ${${define}_LDFLAGS})
|
||||
if(flag MATCHES "^-L(.*)")
|
||||
list(APPEND _libs_paths ${CMAKE_MATCH_1})
|
||||
elseif(IS_ABSOLUTE "${flag}")
|
||||
list(APPEND _libs "${flag}")
|
||||
elseif(flag MATCHES "^-l(.*)")
|
||||
set(_lib "${CMAKE_MATCH_1}")
|
||||
if(_libs_paths)
|
||||
find_library(pkgcfg_lib_${define}_${_lib} NAMES ${_lib}
|
||||
HINTS ${_libs_paths} NO_DEFAULT_PATH)
|
||||
endif()
|
||||
find_library(pkgcfg_lib_${define}_${_lib} NAMES ${_lib})
|
||||
mark_as_advanced(pkgcfg_lib_${define}_${_lib})
|
||||
if(pkgcfg_lib_${define}_${_lib})
|
||||
list(APPEND _libs "${pkgcfg_lib_${define}_${_lib}}")
|
||||
else()
|
||||
message(WARNING "ocv_check_modules(${define}): can't find library '${_lib}'. Specify 'pkgcfg_lib_${define}_${_lib}' manualy")
|
||||
list(APPEND _libs "${_lib}")
|
||||
endif()
|
||||
else()
|
||||
# -pthread
|
||||
#message(WARNING "ocv_check_modules(${define}): unknown LDFLAG '${flag}'")
|
||||
endif()
|
||||
endforeach()
|
||||
set(${define}_LINK_LIBRARIES "${_libs}")
|
||||
set(${define}_LIBRARIES "${_libs}" CACHE INTERNAL "")
|
||||
unset(_lib)
|
||||
unset(_libs)
|
||||
unset(_libs_paths)
|
||||
endif()
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
|
||||
|
||||
if(NOT DEFINED CMAKE_ARGC) # Guard CMake standalone invocations
|
||||
|
||||
# Use this option carefully, CMake's install() will install symlinks instead of real files
|
||||
@@ -1091,15 +1115,6 @@ function(ocv_convert_to_lib_name var)
|
||||
set(${var} ${tmp} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
if(MSVC AND BUILD_SHARED_LIBS) # no defaults for static libs (modern CMake is required)
|
||||
if(NOT CMAKE_VERSION VERSION_LESS 3.6.0)
|
||||
option(INSTALL_PDB_COMPONENT_EXCLUDE_FROM_ALL "Don't install PDB files by default" ON)
|
||||
option(INSTALL_PDB "Add install PDB rules" ON)
|
||||
elseif(NOT CMAKE_VERSION VERSION_LESS 3.1.0)
|
||||
option(INSTALL_PDB_COMPONENT_EXCLUDE_FROM_ALL "Don't install PDB files by default (not supported)" OFF)
|
||||
option(INSTALL_PDB "Add install PDB rules" OFF)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# add install command
|
||||
function(ocv_install_target)
|
||||
@@ -1132,6 +1147,18 @@ function(ocv_install_target)
|
||||
|
||||
if(MSVC)
|
||||
set(__target "${ARGV0}")
|
||||
|
||||
# don't move this into global scope of this file: compiler settings (like MSVC variable) are not available during processing
|
||||
if(BUILD_SHARED_LIBS) # no defaults for static libs (modern CMake is required)
|
||||
if(NOT CMAKE_VERSION VERSION_LESS 3.6.0)
|
||||
option(INSTALL_PDB_COMPONENT_EXCLUDE_FROM_ALL "Don't install PDB files by default" ON)
|
||||
option(INSTALL_PDB "Add install PDB rules" ON)
|
||||
elseif(NOT CMAKE_VERSION VERSION_LESS 3.1.0)
|
||||
option(INSTALL_PDB_COMPONENT_EXCLUDE_FROM_ALL "Don't install PDB files by default (not supported)" OFF)
|
||||
option(INSTALL_PDB "Add install PDB rules" OFF)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(INSTALL_PDB AND NOT INSTALL_IGNORE_PDB
|
||||
AND NOT OPENCV_${__target}_PDB_SKIP
|
||||
)
|
||||
@@ -1176,7 +1203,7 @@ function(ocv_install_target)
|
||||
endif()
|
||||
|
||||
# message(STATUS "Adding PDB file installation rule: target=${__target} dst=${__dst} component=${__pdb_install_component}")
|
||||
if("${__target_type}" STREQUAL "SHARED_LIBRARY")
|
||||
if("${__target_type}" STREQUAL "SHARED_LIBRARY" OR "${__target_type}" STREQUAL "MODULE_LIBRARY")
|
||||
install(FILES "$<TARGET_PDB_FILE:${__target}>" DESTINATION "${__dst}"
|
||||
COMPONENT ${__pdb_install_component} OPTIONAL ${__pdb_exclude_from_all})
|
||||
else()
|
||||
|
||||
@@ -76,7 +76,7 @@ endif()
|
||||
|
||||
# Extract the directory where *this* file has been installed (determined at cmake run-time)
|
||||
# Get the absolute path with no ../.. relative marks, to eliminate implicit linker warnings
|
||||
set(OpenCV_CONFIG_PATH "${CMAKE_CURRENT_LIST_DIR}")
|
||||
get_filename_component(OpenCV_CONFIG_PATH "${CMAKE_CURRENT_LIST_DIR}" REALPATH)
|
||||
get_filename_component(OpenCV_INSTALL_PATH "${OpenCV_CONFIG_PATH}/@OpenCV_INSTALL_PATH_RELATIVE_CONFIGCMAKE@" REALPATH)
|
||||
|
||||
# Search packages for host system instead of packages for target system.
|
||||
|
||||
Reference in New Issue
Block a user