Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
a2120263
Commit
a2120263
authored
Aug 19, 2017
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #9415 from alalek:cmake_deprecated_policies
parents
3b38eeac
8c84763e
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
194 additions
and
143 deletions
+194
-143
CMakeLists.txt
CMakeLists.txt
+3
-16
FindCUDA.cmake
cmake/FindCUDA.cmake
+6
-6
OpenCVDetectAndroidSDK.cmake
cmake/OpenCVDetectAndroidSDK.cmake
+2
-3
OpenCVGenABI.cmake
cmake/OpenCVGenABI.cmake
+6
-6
OpenCVGenAndroidMK.cmake
cmake/OpenCVGenAndroidMK.cmake
+21
-4
OpenCVGenPkgconfig.cmake
cmake/OpenCVGenPkgconfig.cmake
+76
-19
OpenCVModule.cmake
cmake/OpenCVModule.cmake
+9
-29
OpenCVUtils.cmake
cmake/OpenCVUtils.cmake
+50
-24
opencv_abi.xml.in
cmake/templates/opencv_abi.xml.in
+0
-2
CMakeLists.txt
modules/core/CMakeLists.txt
+2
-2
CMakeLists.txt
modules/cudev/test/CMakeLists.txt
+3
-1
CMakeLists.txt
modules/highgui/CMakeLists.txt
+0
-5
CMakeLists.txt
modules/imgcodecs/CMakeLists.txt
+0
-3
CMakeLists.txt
modules/java/CMakeLists.txt
+8
-9
CMakeLists.txt
modules/java/android_test/CMakeLists.txt
+1
-4
common.cmake
modules/python/common.cmake
+3
-3
CMakeLists.txt
modules/videoio/CMakeLists.txt
+0
-5
CMakeLists.txt
modules/viz/CMakeLists.txt
+4
-2
No files found.
CMakeLists.txt
View file @
a2120263
...
...
@@ -77,21 +77,8 @@ if(WINRT)
endif
()
endif
()
if
(
POLICY CMP0020
)
cmake_policy
(
SET CMP0020 OLD
)
endif
()
if
(
POLICY CMP0022
)
cmake_policy
(
SET CMP0022 OLD
)
endif
()
if
(
POLICY CMP0023
)
cmake_policy
(
SET CMP0023 NEW
)
endif
()
if
(
POLICY CMP0026
)
# silence cmake 3.0+ warnings about reading LOCATION attribute
cmake_policy
(
SET CMP0026 OLD
)
cmake_policy
(
SET CMP0026 NEW
)
endif
()
if
(
POLICY CMP0042
)
...
...
@@ -99,7 +86,7 @@ if(POLICY CMP0042)
endif
()
if
(
POLICY CMP0046
)
cmake_policy
(
SET CMP0046
OLD
)
cmake_policy
(
SET CMP0046
NEW
)
endif
()
if
(
POLICY CMP0051
)
...
...
@@ -1380,7 +1367,7 @@ if(HAVE_OPENCL)
set
(
__libs
""
)
foreach
(
l
${
OPENCL_LIBRARIES
}
)
if
(
TARGET
${
l
}
)
get_target_property
(
p
${
l
}
LOCATION
)
get_target_property
(
p
${
l
}
IMPORTED_
LOCATION
)
if
(
p MATCHES NOTFOUND
)
list
(
APPEND __libs
"
${
l
}
"
)
else
()
...
...
cmake/FindCUDA.cmake
View file @
a2120263
...
...
@@ -1556,7 +1556,7 @@ macro(CUDA_ADD_LIBRARY cuda_target)
# variable will have been defined.
CUDA_LINK_SEPARABLE_COMPILATION_OBJECTS
(
"
${
link_file
}
"
${
cuda_target
}
"
${
_options
}
"
"
${${
cuda_target
}
_SEPARABLE_COMPILATION_OBJECTS
}
"
)
target_link_libraries
(
${
cuda_target
}
target_link_libraries
(
${
cuda_target
}
LINK_PRIVATE
${
CUDA_LIBRARIES
}
)
...
...
@@ -1600,7 +1600,7 @@ macro(CUDA_ADD_EXECUTABLE cuda_target)
# variable will have been defined.
CUDA_LINK_SEPARABLE_COMPILATION_OBJECTS
(
"
${
link_file
}
"
${
cuda_target
}
"
${
_options
}
"
"
${${
cuda_target
}
_SEPARABLE_COMPILATION_OBJECTS
}
"
)
target_link_libraries
(
${
cuda_target
}
target_link_libraries
(
${
cuda_target
}
LINK_PRIVATE
${
CUDA_LIBRARIES
}
)
...
...
@@ -1675,9 +1675,9 @@ endmacro()
###############################################################################
macro
(
CUDA_ADD_CUFFT_TO_TARGET target
)
if
(
CUDA_BUILD_EMULATION
)
target_link_libraries
(
${
target
}
${
CUDA_cufftemu_LIBRARY
}
)
target_link_libraries
(
${
target
}
LINK_PRIVATE
${
CUDA_cufftemu_LIBRARY
}
)
else
()
target_link_libraries
(
${
target
}
${
CUDA_cufft_LIBRARY
}
)
target_link_libraries
(
${
target
}
LINK_PRIVATE
${
CUDA_cufft_LIBRARY
}
)
endif
()
endmacro
()
...
...
@@ -1688,9 +1688,9 @@ endmacro()
###############################################################################
macro
(
CUDA_ADD_CUBLAS_TO_TARGET target
)
if
(
CUDA_BUILD_EMULATION
)
target_link_libraries
(
${
target
}
${
CUDA_cublasemu_LIBRARY
}
)
target_link_libraries
(
${
target
}
LINK_PRIVATE
${
CUDA_cublasemu_LIBRARY
}
)
else
()
target_link_libraries
(
${
target
}
${
CUDA_cublas_LIBRARY
}
)
target_link_libraries
(
${
target
}
LINK_PRIVATE
${
CUDA_cublas_LIBRARY
}
)
endif
()
endmacro
()
...
...
cmake/OpenCVDetectAndroidSDK.cmake
View file @
a2120263
...
...
@@ -290,16 +290,15 @@ macro(add_android_project target path)
add_library
(
${
JNI_LIB_NAME
}
SHARED
${
android_proj_jni_files
}
)
ocv_target_include_modules_recurse
(
${
JNI_LIB_NAME
}
${
android_proj_NATIVE_DEPS
}
)
ocv_target_include_directories
(
${
JNI_LIB_NAME
}
"
${
path
}
/jni"
)
ocv_target_link_libraries
(
${
JNI_LIB_NAME
}
${
OPENCV_LINKER_LIBS
}
${
android_proj_NATIVE_DEPS
}
)
ocv_target_link_libraries
(
${
JNI_LIB_NAME
}
LINK_PRIVATE
${
OPENCV_LINKER_LIBS
}
${
android_proj_NATIVE_DEPS
}
)
set_target_properties
(
${
JNI_LIB_NAME
}
PROPERTIES
OUTPUT_NAME
"
${
JNI_LIB_NAME
}
"
LIBRARY_OUTPUT_DIRECTORY
"
${
android_proj_bin_dir
}
/libs/
${
ANDROID_NDK_ABI_NAME
}
"
)
get_target_property
(
android_proj_jni_location
"
${
JNI_LIB_NAME
}
"
LOCATION
)
if
(
NOT
(
CMAKE_BUILD_TYPE MATCHES
"debug"
))
add_custom_command
(
TARGET
${
JNI_LIB_NAME
}
POST_BUILD COMMAND
${
CMAKE_STRIP
}
--strip-unneeded
"
$
{
android_proj_jni_location
}
"
)
add_custom_command
(
TARGET
${
JNI_LIB_NAME
}
POST_BUILD COMMAND
${
CMAKE_STRIP
}
--strip-unneeded
"$
<TARGET_FILE:
${
JNI_LIB_NAME
}
>
"
)
endif
()
endif
()
endif
()
...
...
cmake/OpenCVGenABI.cmake
View file @
a2120263
...
...
@@ -26,7 +26,9 @@ set(OPENCV_ABI_SKIP_HEADERS "")
set
(
OPENCV_ABI_SKIP_LIBRARIES
""
)
foreach
(
mod
${
OPENCV_MODULES_BUILD
}
)
string
(
REGEX REPLACE
"^opencv_"
""
mod
"
${
mod
}
"
)
if
(
NOT
"
${
OPENCV_MODULE_opencv_
${
mod
}
_LOCATION
}
"
STREQUAL
"
${
OpenCV_SOURCE_DIR
}
/modules/
${
mod
}
"
)
if
(
NOT OPENCV_MODULE_opencv_
${
mod
}
_CLASS STREQUAL
"PUBLIC"
OR NOT
"
${
OPENCV_MODULE_opencv_
${
mod
}
_LOCATION
}
"
STREQUAL
"
${
OpenCV_SOURCE_DIR
}
/modules/
${
mod
}
"
# opencv_contrib
)
# headers
foreach
(
h
${
OPENCV_MODULE_opencv_
${
mod
}
_HEADERS
}
)
file
(
RELATIVE_PATH h
"
${
OPENCV_MODULE_opencv_
${
mod
}
_LOCATION
}
/include"
"
${
h
}
"
)
...
...
@@ -34,10 +36,7 @@ foreach(mod ${OPENCV_MODULES_BUILD})
endforeach
()
# libraries
if
(
TARGET opencv_
${
mod
}
)
# opencv_world
set
(
lib_name
""
)
get_target_property
(
lib_name opencv_
${
mod
}
LOCATION
)
get_filename_component
(
lib_name
"
${
lib_name
}
"
NAME
)
list
(
APPEND OPENCV_ABI_SKIP_LIBRARIES
"
${
lib_name
}
"
)
list
(
APPEND OPENCV_ABI_SKIP_LIBRARIES
"
\$
<TARGET_FILE_NAME:opencv_
${
mod
}
>"
)
endif
()
endif
()
endforeach
()
...
...
@@ -48,4 +47,5 @@ string(REPLACE ";" "\n " OPENCV_ABI_SKIP_LIBRARIES "${OPENCV_ABI_SKIP_LIBRARI
set
(
OPENCV_ABI_GCC_OPTIONS
"
${
CMAKE_CXX_FLAGS
}
${
CMAKE_CXX_FLAGS_RELEASE
}
-DOPENCV_ABI_CHECK=1"
)
string
(
REGEX REPLACE
"([^ ]) +([^ ])"
"
\\
1
\\
n
\\
2"
OPENCV_ABI_GCC_OPTIONS
"
${
OPENCV_ABI_GCC_OPTIONS
}
"
)
configure_file
(
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/cmake/templates/opencv_abi.xml.in"
"
${
path1
}
"
)
configure_file
(
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/cmake/templates/opencv_abi.xml.in"
"
${
path1
}
.base"
)
file
(
GENERATE OUTPUT
"
${
path1
}
"
INPUT
"
${
path1
}
.base"
)
cmake/OpenCVGenAndroidMK.cmake
View file @
a2120263
...
...
@@ -20,12 +20,29 @@ if(ANDROID)
endif
()
# build the list of opencv libs and dependencies for all modules
ocv_get_all_libs
(
OPENCV_MODULES
_CONFIGMAKE OPENCV_EXTRA_COMPONENTS_CONFIGMAKE OPENCV_3RDPARTY_COMPONENTS_CONFIGMAKE
)
ocv_get_all_libs
(
OPENCV_MODULES
OPENCV_EXTRA_COMPONENTS OPENCV_3RDPARTY_COMPONENTS
)
# list -> string
string
(
REPLACE
";"
" "
OPENCV_MODULES_CONFIGMAKE
"
${
OPENCV_MODULES_CONFIGMAKE
}
"
)
string
(
REPLACE
";"
" "
OPENCV_EXTRA_COMPONENTS_CONFIGMAKE
"
${
OPENCV_EXTRA_COMPONENTS_CONFIGMAKE
}
"
)
string
(
REPLACE
";"
" "
OPENCV_3RDPARTY_COMPONENTS_CONFIGMAKE
"
${
OPENCV_3RDPARTY_COMPONENTS_CONFIGMAKE
}
"
)
foreach
(
_var OPENCV_MODULES OPENCV_EXTRA_COMPONENTS OPENCV_3RDPARTY_COMPONENTS
)
set
(
var
"
${
_var
}
_CONFIGMAKE"
)
set
(
${
var
}
""
)
foreach
(
lib
${${
_var
}}
)
set
(
lib_name
"
${
lib
}
"
)
if
(
TARGET
${
lib
}
)
get_target_property
(
_output
${
lib
}
IMPORTED_LOCATION
)
if
(
NOT _output
)
get_target_property
(
output_name
${
lib
}
OUTPUT_NAME
)
if
(
output_name
)
set
(
lib_name
"
${
output_name
}
"
)
endif
()
else
()
ocv_get_libname
(
lib_name
"
${
_output
}
"
)
endif
()
endif
()
set
(
${
var
}
"
${${
var
}}
${
lib_name
}
"
)
endforeach
()
string
(
STRIP
"
${${
var
}}
"
${
var
}
)
endforeach
()
# replace 'opencv_<module>' -> '<module>''
string
(
REPLACE
"opencv_"
""
OPENCV_MODULES_CONFIGMAKE
"
${
OPENCV_MODULES_CONFIGMAKE
}
"
)
...
...
cmake/OpenCVGenPkgconfig.cmake
View file @
a2120263
if
(
MSVC OR IOS
)
return
()
endif
()
# --------------------------------------------------------------------------------------------
# according to man pkg-config
# The package name specified on the pkg-config command line is defined to
...
...
@@ -12,11 +16,11 @@
macro
(
fix_prefix lst isown
)
set
(
_lst
)
foreach
(
item
${${
lst
}}
)
if
(
TARGET
${
item
}
)
get_target_property
(
item
"
${
item
}
"
LOCATION_
${
CMAKE_BUILD_TYPE
}
)
if
(
"
${
isown
}
"
)
get_filename_component
(
item
"
${
item
}
"
NAME
_WE
)
string
(
REGEX REPLACE
"^lib(.*)"
"
\\
1"
item
"
${
item
}
"
)
if
(
DEFINED TARGET_LOCATION_
${
item
}
)
set
(
item
"
${
TARGET_LOCATION_
${
item
}}
"
)
if
(
${
isown
}
)
get_filename_component
(
item
"
${
item
}
"
NAME
)
ocv_get_libname
(
item
"
${
item
}
"
)
endif
()
endif
()
if
(
item MATCHES
"^-l"
)
...
...
@@ -25,8 +29,8 @@ macro(fix_prefix lst isown)
list
(
APPEND _lst
"
${
item
}
"
)
elseif
(
item MATCHES
"[
\\
/]"
)
get_filename_component
(
libdir
"
${
item
}
"
PATH
)
get_filename_component
(
libname
"
${
item
}
"
NAME_W
E
)
string
(
REGEX REPLACE
"^lib(.*)"
"
\\
1"
libname
"
${
libname
}
"
)
get_filename_component
(
_libname
"
${
item
}
"
NAM
E
)
ocv_get_libname
(
libname
"
${
_
libname
}
"
)
list
(
APPEND _lst
"-L
${
libdir
}
"
"-l
${
libname
}
"
)
else
()
list
(
APPEND _lst
"-l
${
item
}
"
)
...
...
@@ -36,6 +40,14 @@ macro(fix_prefix lst isown)
unset
(
_lst
)
endmacro
()
if
(
NOT DEFINED CMAKE_HELPER_SCRIPT
)
if
(
INSTALL_TO_MANGLED_PATHS
)
set
(
OPENCV_PC_FILE_NAME
"opencv-
${
OPENCV_VERSION
}
.pc"
)
else
()
set
(
OPENCV_PC_FILE_NAME opencv.pc
)
endif
()
# build the list of opencv libs and dependencies for all modules
ocv_get_all_libs
(
_modules _extra _3rdparty
)
...
...
@@ -56,9 +68,61 @@ if(_modules MATCHES "opencv_contrib_world")
list
(
INSERT _modules 0
"opencv_contrib_world"
)
endif
()
fix_prefix
(
_modules TRUE
)
fix_prefix
(
_extra FALSE
)
fix_prefix
(
_3rdparty TRUE
)
set
(
HELPER_SCRIPT
""
)
ocv_cmake_script_append_var
(
HELPER_SCRIPT
BUILD_SHARED_LIBS
CMAKE_BINARY_DIR
CMAKE_INSTALL_PREFIX
OpenCV_SOURCE_DIR
OPENCV_PC_FILE_NAME
OPENCV_VERSION_PLAIN
OPENCV_LIB_INSTALL_PATH
OPENCV_INCLUDE_INSTALL_PATH
OPENCV_3P_LIB_INSTALL_PATH
_modules
_extra
_3rdparty
)
foreach
(
item
${
_modules
}
${
_extra
}
${
_3rdparty
}
)
if
(
TARGET
${
item
}
)
set
(
HELPER_SCRIPT
"
${
HELPER_SCRIPT
}
set(TARGET_LOCATION_
${
item
}
\"
$<TARGET_FILE:
${
item
}
>
\"
)
"
)
endif
()
endforeach
()
set
(
CMAKE_HELPER_SCRIPT
"
${
CMAKE_BINARY_DIR
}
/OpenCVGenPkgConfig.info.cmake"
)
file
(
GENERATE OUTPUT
"
${
CMAKE_HELPER_SCRIPT
}
"
CONTENT
"
${
HELPER_SCRIPT
}
"
)
add_custom_target
(
developer_scripts
)
add_custom_command
(
OUTPUT
"
${
CMAKE_BINARY_DIR
}
/unix-install/
${
OPENCV_PC_FILE_NAME
}
"
COMMAND
${
CMAKE_COMMAND
}
"-DCMAKE_HELPER_SCRIPT=
${
CMAKE_HELPER_SCRIPT
}
"
-P
"
${
OpenCV_SOURCE_DIR
}
/cmake/OpenCVGenPkgconfig.cmake"
DEPENDS
"
${
CMAKE_BINARY_DIR
}
/OpenCVGenPkgConfig.info.cmake"
"
${
OpenCV_SOURCE_DIR
}
/cmake/OpenCVGenPkgconfig.cmake"
COMMENT
"Generate
${
OPENCV_PC_FILE_NAME
}
"
)
add_custom_target
(
gen-pkgconfig ALL SOURCES
"
${
CMAKE_BINARY_DIR
}
/unix-install/
${
OPENCV_PC_FILE_NAME
}
"
)
add_dependencies
(
developer_scripts gen-pkgconfig
)
if
(
UNIX AND NOT ANDROID
)
install
(
FILES
${
CMAKE_BINARY_DIR
}
/unix-install/
${
OPENCV_PC_FILE_NAME
}
DESTINATION
${
OPENCV_LIB_INSTALL_PATH
}
/pkgconfig COMPONENT dev
)
endif
()
# =============================================================================
else
()
# DEFINED CMAKE_HELPER_SCRIPT
cmake_minimum_required
(
VERSION 2.8.12.2
)
cmake_policy
(
SET CMP0012 NEW
)
include
(
"
${
CMAKE_HELPER_SCRIPT
}
"
)
include
(
"
${
OpenCV_SOURCE_DIR
}
/cmake/OpenCVUtils.cmake"
)
fix_prefix
(
_modules 1
)
fix_prefix
(
_extra 0
)
fix_prefix
(
_3rdparty 1
)
ocv_list_unique
(
_modules
)
ocv_list_unique
(
_extra
)
...
...
@@ -68,7 +132,7 @@ set(OPENCV_PC_LIBS
"-L
\$
{exec_prefix}/
${
OPENCV_LIB_INSTALL_PATH
}
"
"
${
_modules
}
"
)
if
(
BUILD_SHARED_LIBS
)
if
(
BUILD_SHARED_LIBS
)
set
(
OPENCV_PC_LIBS_PRIVATE
"
${
_extra
}
"
)
else
()
set
(
OPENCV_PC_LIBS_PRIVATE
...
...
@@ -86,15 +150,8 @@ set(exec_prefix "\${prefix}")
set
(
libdir
"
\$
{exec_prefix}/
${
OPENCV_LIB_INSTALL_PATH
}
"
)
set
(
includedir
"
\$
{prefix}/
${
OPENCV_INCLUDE_INSTALL_PATH
}
"
)
if
(
INSTALL_TO_MANGLED_PATHS
)
set
(
OPENCV_PC_FILE_NAME
"opencv-
${
OPENCV_VERSION
}
.pc"
)
else
()
set
(
OPENCV_PC_FILE_NAME opencv.pc
)
endif
()
configure_file
(
"
${
OpenCV_SOURCE_DIR
}
/cmake/templates/opencv-XXX.pc.in"
"
${
CMAKE_BINARY_DIR
}
/unix-install/
${
OPENCV_PC_FILE_NAME
}
"
@ONLY
)
if
(
UNIX AND NOT ANDROID
)
install
(
FILES
${
CMAKE_BINARY_DIR
}
/unix-install/
${
OPENCV_PC_FILE_NAME
}
DESTINATION
${
OPENCV_LIB_INSTALL_PATH
}
/pkgconfig COMPONENT dev
)
endif
()
endif
()
# DEFINED CMAKE_HELPER_SCRIPT
cmake/OpenCVModule.cmake
View file @
a2120263
...
...
@@ -787,15 +787,12 @@ macro(_ocv_create_module)
endif
()
set
(
sub_objs
""
)
set
(
sub_links
""
)
set
(
cuda_objs
""
)
if
(
OPENCV_MODULE_
${
the_module
}
_CHILDREN
)
message
(
STATUS
"Complex module
${
the_module
}
"
)
foreach
(
m
${
OPENCV_MODULE_
${
the_module
}
_CHILDREN
}
)
if
(
BUILD_
${
m
}
AND TARGET
${
m
}
_object
)
get_target_property
(
_sub_links
${
m
}
LINK_LIBRARIES
)
list
(
APPEND sub_objs $<TARGET_OBJECTS:
${
m
}
_object>
)
list
(
APPEND sub_links
${
_sub_links
}
)
message
(
STATUS
" +
${
m
}
"
)
else
()
message
(
STATUS
" -
${
m
}
"
)
...
...
@@ -837,38 +834,21 @@ macro(_ocv_create_module)
)
if
(
cuda_objs
)
target_link_libraries
(
${
the_module
}
${
cuda_objs
}
)
endif
()
# TODO: is it needed?
if
(
sub_links
)
ocv_list_filterout
(
sub_links
"^opencv_"
)
ocv_list_unique
(
sub_links
)
target_link_libraries
(
${
the_module
}
${
sub_links
}
)
target_link_libraries
(
${
the_module
}
LINK_PRIVATE
${
cuda_objs
}
)
endif
()
unset
(
sub_objs
)
unset
(
sub_links
)
unset
(
cuda_objs
)
set_target_properties
(
${
the_module
}
PROPERTIES LABELS
"
${
OPENCV_MODULE_
${
the_module
}
_LABEL
}
;Module"
)
set_source_files_properties
(
${
OPENCV_MODULE_
${
the_module
}
_HEADERS
}
${
OPENCV_MODULE_
${
the_module
}
_SOURCES
}
${${
the_module
}
_pch
}
PROPERTIES LABELS
"
${
OPENCV_MODULE_
${
the_module
}
_LABEL
}
;Module"
)
if
(
NOT BUILD_SHARED_LIBS OR NOT INSTALL_CREATE_DISTRIB
)
ocv_target_link_libraries
(
${
the_module
}
${
OPENCV_MODULE_
${
the_module
}
_DEPS_TO_LINK
}
)
ocv_target_link_libraries
(
${
the_module
}
LINK_INTERFACE_LIBRARIES
${
OPENCV_MODULE_
${
the_module
}
_DEPS_TO_LINK
}
)
ocv_target_link_libraries
(
${
the_module
}
${
OPENCV_MODULE_
${
the_module
}
_DEPS_EXT
}
${
OPENCV_LINKER_LIBS
}
${
IPP_LIBS
}
${
ARGN
}
)
if
(
HAVE_CUDA
)
ocv_target_link_libraries
(
${
the_module
}
${
CUDA_LIBRARIES
}
${
CUDA_npp_LIBRARY
}
)
endif
()
else
()
ocv_target_link_libraries
(
${
the_module
}
LINK_PRIVATE
${
OPENCV_MODULE_
${
the_module
}
_DEPS_TO_LINK
}
)
ocv_target_link_libraries
(
${
the_module
}
LINK_PRIVATE
${
OPENCV_MODULE_
${
the_module
}
_DEPS_TO_LINK
}
)
ocv_target_link_libraries
(
${
the_module
}
LINK_PRIVATE
${
OPENCV_MODULE_
${
the_module
}
_DEPS_EXT
}
${
OPENCV_LINKER_LIBS
}
${
IPP_LIBS
}
${
ARGN
}
)
if
(
HAVE_CUDA
)
ocv_target_link_libraries
(
${
the_module
}
LINK_PRIVATE
${
CUDA_LIBRARIES
}
${
CUDA_npp_LIBRARY
}
)
endif
()
ocv_target_link_libraries
(
${
the_module
}
LINK_PUBLIC
${
OPENCV_MODULE_
${
the_module
}
_DEPS_TO_LINK
}
)
ocv_target_link_libraries
(
${
the_module
}
LINK_PUBLIC
${
OPENCV_MODULE_
${
the_module
}
_DEPS_EXT
}
)
ocv_target_link_libraries
(
${
the_module
}
LINK_PRIVATE
${
OPENCV_LINKER_LIBS
}
${
OPENCV_HAL_LINKER_LIBS
}
${
IPP_LIBS
}
${
ARGN
}
)
if
(
HAVE_CUDA
)
ocv_target_link_libraries
(
${
the_module
}
LINK_PRIVATE
${
CUDA_LIBRARIES
}
${
CUDA_npp_LIBRARY
}
)
endif
()
add_dependencies
(
opencv_modules
${
the_module
}
)
...
...
@@ -1074,7 +1054,7 @@ function(ocv_add_perf_tests)
source_group
(
"Src"
FILES
"
${${
the_target
}
_pch
}
"
)
ocv_add_executable
(
${
the_target
}
${
OPENCV_PERF_
${
the_module
}
_SOURCES
}
${${
the_target
}
_pch
}
)
ocv_target_include_modules
(
${
the_target
}
${
perf_deps
}
"
${
perf_path
}
"
)
ocv_target_link_libraries
(
${
the_target
}
${
perf_deps
}
${
OPENCV_MODULE_
${
the_module
}
_DEPS
}
${
OPENCV_LINKER_LIBS
}
)
ocv_target_link_libraries
(
${
the_target
}
LINK_PRIVATE
${
perf_deps
}
${
OPENCV_MODULE_
${
the_module
}
_DEPS
}
${
OPENCV_LINKER_LIBS
}
)
add_dependencies
(
opencv_perf_tests
${
the_target
}
)
set_target_properties
(
${
the_target
}
PROPERTIES LABELS
"
${
OPENCV_MODULE_
${
the_module
}
_LABEL
}
;PerfTest"
)
...
...
@@ -1151,7 +1131,7 @@ function(ocv_add_accuracy_tests)
source_group
(
"Src"
FILES
"
${${
the_target
}
_pch
}
"
)
ocv_add_executable
(
${
the_target
}
${
OPENCV_TEST_
${
the_module
}
_SOURCES
}
${${
the_target
}
_pch
}
)
ocv_target_include_modules
(
${
the_target
}
${
test_deps
}
"
${
test_path
}
"
)
ocv_target_link_libraries
(
${
the_target
}
${
test_deps
}
${
OPENCV_MODULE_
${
the_module
}
_DEPS
}
${
OPENCV_LINKER_LIBS
}
)
ocv_target_link_libraries
(
${
the_target
}
LINK_PRIVATE
${
test_deps
}
${
OPENCV_MODULE_
${
the_module
}
_DEPS
}
${
OPENCV_LINKER_LIBS
}
)
add_dependencies
(
opencv_tests
${
the_target
}
)
set_target_properties
(
${
the_target
}
PROPERTIES LABELS
"
${
OPENCV_MODULE_
${
the_module
}
_LABEL
}
;AccuracyTest"
)
...
...
@@ -1208,7 +1188,7 @@ function(ocv_add_samples)
ocv_add_executable
(
${
the_target
}
"
${
source
}
"
)
ocv_target_include_modules
(
${
the_target
}
${
samples_deps
}
)
ocv_target_link_libraries
(
${
the_target
}
${
samples_deps
}
)
ocv_target_link_libraries
(
${
the_target
}
LINK_PRIVATE
${
samples_deps
}
)
set_target_properties
(
${
the_target
}
PROPERTIES PROJECT_LABEL
"(sample)
${
name
}
"
)
set_target_properties
(
${
the_target
}
PROPERTIES LABELS
"
${
OPENCV_MODULE_
${
the_module
}
_LABEL
}
;Sample"
)
...
...
cmake/OpenCVUtils.cmake
View file @
a2120263
...
...
@@ -517,6 +517,7 @@ macro(CHECK_MODULE module_name define cv_module)
endif
()
endmacro
()
if
(
NOT DEFINED CMAKE_ARGC
)
# Guard CMake standalone invocations
set
(
OPENCV_BUILD_INFO_FILE
"
${
CMAKE_BINARY_DIR
}
/version_string.tmp"
)
file
(
REMOVE
"
${
OPENCV_BUILD_INFO_FILE
}
"
)
...
...
@@ -597,6 +598,7 @@ function(status text)
endif
()
endfunction
()
endif
()
# NOT DEFINED CMAKE_ARGC
# remove all matching elements from the list
macro
(
ocv_list_filterout lst regex
)
...
...
@@ -689,8 +691,8 @@ endmacro()
function
(
ocv_convert_to_lib_name var
)
set
(
tmp
""
)
foreach
(
path
${
ARGN
}
)
get_filename_component
(
tmp_name
"
${
path
}
"
NAME
_WE
)
string
(
REGEX REPLACE
"^lib"
""
tmp_name
"
${
tmp_name
}
"
)
get_filename_component
(
tmp_name
"
${
path
}
"
NAME
)
ocv_get_libname
(
tmp_name
"
${
tmp_name
}
"
)
list
(
APPEND tmp
"
${
tmp_name
}
"
)
endforeach
()
set
(
${
var
}
${
tmp
}
PARENT_SCOPE
)
...
...
@@ -899,32 +901,42 @@ function(ocv_source_group group)
endif
()
endfunction
()
function
(
ocv_target_link_libraries target
)
_ocv_fix_target
(
target
)
set
(
LINK_DEPS
${
ARGN
}
)
# process world
if
(
BUILD_opencv_world
)
foreach
(
m
${
OPENCV_MODULES_BUILD
}
)
if
(
OPENCV_MODULE_
${
m
}
_IS_PART_OF_WORLD
)
if
(
";
${
LINK_DEPS
}
;"
MATCHES
";
${
m
}
;"
)
list
(
REMOVE_ITEM LINK_DEPS
${
m
}
)
if
(
NOT
(
";
${
LINK_DEPS
}
;"
MATCHES
";opencv_world;"
))
list
(
APPEND LINK_DEPS opencv_world
)
endif
()
endif
()
endif
()
endforeach
()
endif
()
if
(
";
${
LINK_DEPS
}
;"
MATCHES
";
${
target
}
;"
)
list
(
REMOVE_ITEM LINK_DEPS
"
${
target
}
"
)
# prevent "link to itself" warning (world problem)
endif
()
macro
(
__ocv_push_target_link_libraries
)
if
(
NOT TARGET
${
target
}
)
if
(
NOT DEFINED OPENCV_MODULE_
${
target
}
_LOCATION
)
message
(
FATAL_ERROR
"ocv_target_link_libraries: invalid target: '
${
target
}
'"
)
endif
()
set
(
OPENCV_MODULE_
${
target
}
_LINK_DEPS
${
OPENCV_MODULE_
${
target
}
_LINK_DEPS
}
${
LINK_DEPS
}
CACHE INTERNAL
""
FORCE
)
set
(
OPENCV_MODULE_
${
target
}
_LINK_DEPS
${
OPENCV_MODULE_
${
target
}
_LINK_DEPS
}
${
ARGN
}
CACHE INTERNAL
""
FORCE
)
else
()
target_link_libraries
(
${
target
}
${
LINK_DEPS
}
)
target_link_libraries
(
${
target
}
${
ARGN
}
)
endif
()
endmacro
()
function
(
ocv_target_link_libraries target
)
set
(
LINK_DEPS
${
ARGN
}
)
_ocv_fix_target
(
target
)
set
(
LINK_MODE
"LINK_PRIVATE"
)
set
(
LINK_PENDING
""
)
foreach
(
dep
${
LINK_DEPS
}
)
if
(
"
${
dep
}
"
STREQUAL
"
${
target
}
"
)
# prevent "link to itself" warning (world problem)
elseif
(
"
${
dep
}
"
STREQUAL
" LINK_PRIVATE"
OR
"
${
dep
}
"
STREQUAL
"LINK_PUBLIC"
)
if
(
NOT LINK_PENDING STREQUAL
""
)
__ocv_push_target_link_libraries
(
${
LINK_MODE
}
${
LINK_PENDING
}
)
set
(
LINK_PENDING
""
)
set
(
LINK_MODE
"
${
dep
}
"
)
endif
()
else
()
if
(
BUILD_opencv_world
)
if
(
OPENCV_MODULE_
${
dep
}
_IS_PART_OF_WORLD
)
set
(
dep opencv_world
)
endif
()
endif
()
list
(
APPEND LINK_PENDING
"
${
dep
}
"
)
endif
()
endforeach
()
if
(
NOT LINK_PENDING STREQUAL
""
)
__ocv_push_target_link_libraries
(
${
LINK_MODE
}
${
LINK_PENDING
}
)
endif
()
endfunction
()
...
...
@@ -1037,6 +1049,12 @@ macro(ocv_get_all_libs _modules _extra _3rdparty)
endforeach
()
foreach
(
dep
${
deps
}
${
OPENCV_LINKER_LIBS
}
)
if
(
NOT DEFINED OPENCV_MODULE_
${
dep
}
_LOCATION
)
if
(
dep MATCHES
"^
\\
$<LINK_ONLY:([^>]+)>$"
)
set
(
dep
"
${
CMAKE_MATCH_1
}
"
)
endif
()
if
(
dep MATCHES
"^
\\
$<"
)
message
(
WARNING
"Unexpected CMake generator expression:
${
dep
}
"
)
endif
()
if
(
TARGET
${
dep
}
)
get_target_property
(
_type
${
dep
}
TYPE
)
if
(
_type STREQUAL
"STATIC_LIBRARY"
AND BUILD_SHARED_LIBS
)
...
...
@@ -1055,7 +1073,7 @@ macro(ocv_get_all_libs _modules _extra _3rdparty)
string
(
FIND
"
${
_output
}
"
"
${
CMAKE_BINARY_DIR
}
"
_POS
)
if
(
_POS EQUAL 0
)
ocv_get_libname
(
_libname
"
${
_output_name
}
"
)
list
(
INSERT
${
_3rdparty
}
0
${
_libname
}
)
list
(
INSERT
${
_3rdparty
}
0
${
dep
}
)
else
()
if
(
_output
)
list
(
INSERT
${
_extra
}
0
${
_output
}
)
...
...
@@ -1175,3 +1193,11 @@ macro(ocv_generate_vs_version_file DESTINATION)
configure_file
(
"
${
OpenCV_SOURCE_DIR
}
/cmake/templates/vs_version.rc.in"
"
${
DESTINATION
}
"
@ONLY
)
endmacro
()
macro
(
ocv_cmake_script_append_var content_var
)
foreach
(
var_name
${
ARGN
}
)
set
(
${
content_var
}
"
${${
content_var
}}
set(
${
var_name
}
\"
${${
var_name
}}
\"
)
"
)
endforeach
()
endmacro
()
cmake/templates/opencv_abi.xml.in
View file @
a2120263
...
...
@@ -29,8 +29,6 @@
opencv2/flann/hdf5.h
opencv2/imgcodecs/ios.h
opencv2/videoio/cap_ios.h
opencv2/ts.hpp
opencv2/ts/*
opencv2/xobjdetect/private.hpp
@OPENCV_ABI_SKIP_HEADERS@
</skip_headers>
...
...
modules/core/CMakeLists.txt
View file @
a2120263
...
...
@@ -4,7 +4,6 @@ ocv_add_dispatched_file(mathfuncs_core SSE2 AVX AVX2)
ocv_add_dispatched_file
(
stat SSE4_2 AVX2
)
ocv_add_module
(
core
"
${
OPENCV_HAL_LINKER_LIBS
}
"
OPTIONAL opencv_cudev
WRAP java python
)
...
...
@@ -57,10 +56,11 @@ endif()
ocv_create_module
(
${
extra_libs
}
)
ocv_target_link_libraries
(
${
the_module
}
ocv_target_link_libraries
(
${
the_module
}
LINK_PRIVATE
"
${
ZLIB_LIBRARIES
}
"
"
${
OPENCL_LIBRARIES
}
"
"
${
VA_LIBRARIES
}
"
"
${
LAPACK_LIBRARIES
}
"
"
${
CPUFEATURES_LIBRARIES
}
"
"
${
HALIDE_LIBRARIES
}
"
"
${
ITT_LIBRARIES
}
"
"
${
OPENCV_HAL_LINKER_LIBS
}
"
)
ocv_add_accuracy_tests
()
...
...
modules/cudev/test/CMakeLists.txt
View file @
a2120263
...
...
@@ -16,7 +16,9 @@ if(OCV_DEPENDENCIES_FOUND)
ocv_cuda_filter_options
()
CUDA_ADD_EXECUTABLE
(
${
the_target
}
${
OPENCV_TEST_
${
the_module
}
_SOURCES
}
)
ocv_target_link_libraries
(
${
the_target
}
${
test_deps
}
${
OPENCV_LINKER_LIBS
}
${
CUDA_LIBRARIES
}
)
ocv_target_link_libraries
(
${
the_target
}
LINK_PRIVATE
${
test_deps
}
${
OPENCV_LINKER_LIBS
}
${
CUDA_LIBRARIES
}
)
add_dependencies
(
opencv_tests
${
the_target
}
)
set_target_properties
(
${
the_target
}
PROPERTIES LABELS
"
${
OPENCV_MODULE_
${
the_module
}
_LABEL
}
"
)
...
...
modules/highgui/CMakeLists.txt
View file @
a2120263
...
...
@@ -147,11 +147,6 @@ if(MSVC)
set_target_properties
(
${
the_module
}
PROPERTIES LINK_FLAGS
"/NODEFAULTLIB:atlthunk.lib /NODEFAULTLIB:atlsd.lib /NODEFAULTLIB:libcmt.lib /DEBUG"
)
endif
()
if
(
NOT BUILD_opencv_world
)
#stop automatic dependencies propagation for this module
set_target_properties
(
${
the_module
}
PROPERTIES LINK_INTERFACE_LIBRARIES
""
)
endif
()
ocv_warnings_disable
(
CMAKE_CXX_FLAGS -Wno-deprecated-declarations
)
endmacro
()
...
...
modules/imgcodecs/CMakeLists.txt
View file @
a2120263
...
...
@@ -123,9 +123,6 @@ if(MSVC)
set_target_properties
(
${
the_module
}
PROPERTIES LINK_FLAGS
"/NODEFAULTLIB:atlthunk.lib /NODEFAULTLIB:atlsd.lib /NODEFAULTLIB:libcmt.lib /DEBUG"
)
endif
()
#stop automatic dependencies propagation for this module
set_target_properties
(
${
the_module
}
PROPERTIES LINK_INTERFACE_LIBRARIES
""
)
ocv_warnings_disable
(
CMAKE_CXX_FLAGS -Wno-deprecated-declarations
)
endmacro
()
...
...
modules/java/CMakeLists.txt
View file @
a2120263
...
...
@@ -435,14 +435,14 @@ if(BUILD_FAT_JAVA_LIB)
endif()
if(APPLE)
foreach(_dep
${
__deps
}
)
ocv_target_link_libraries(
${
the_module
}
-Wl,-force_load "
${
_dep
}
")
ocv_target_link_libraries(
${
the_module
}
LINK_PRIVATE
-Wl,-force_load "
${
_dep
}
")
endforeach()
else()
ocv_target_link_libraries(
${
the_module
}
-Wl,-whole-archive
${
__deps
}
-Wl,-no-whole-archive)
ocv_target_link_libraries(
${
the_module
}
LINK_PRIVATE
-Wl,-whole-archive
${
__deps
}
-Wl,-no-whole-archive)
endif()
ocv_target_link_libraries(
${
the_module
}
${
__extradeps
}
${
OPENCV_LINKER_LIBS
}
)
ocv_target_link_libraries(
${
the_module
}
LINK_PRIVATE
${
__extradeps
}
${
OPENCV_LINKER_LIBS
}
)
else()
ocv_target_link_libraries(
${
the_module
}
${
OPENCV_MODULE_
${
the_module
}
_DEPS
}
${
OPENCV_LINKER_LIBS
}
)
ocv_target_link_libraries(
${
the_module
}
LINK_PRIVATE
${
OPENCV_MODULE_
${
the_module
}
_DEPS
}
${
OPENCV_LINKER_LIBS
}
)
endif()
# Additional target properties
...
...
@@ -451,19 +451,18 @@ set_target_properties(${the_module} PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY
${
LIBRARY_OUTPUT_PATH
}
LIBRARY_OUTPUT_DIRECTORY
${
LIBRARY_OUTPUT_PATH
}
RUNTIME_OUTPUT_DIRECTORY
${
EXECUTABLE_OUTPUT_PATH
}
LINK_INTERFACE_LIBRARIES ""
)
if(ANDROID)
ocv_target_link_libraries(
${
the_module
}
jnigraphics) # for Mat <=> Bitmap converters
ocv_target_link_libraries(
${
the_module
}
LINK_INTERFACE_LIBRARIES
${
OPENCV_LINKER_LIBS
}
jnigraphics)
ocv_target_link_libraries(
${
the_module
}
LINK_PUBLIC jnigraphics) # for Mat <=> Bitmap converters
ocv_target_link_libraries(
${
the_module
}
LINK_PUBLIC log dl z)
ocv_target_link_libraries(
${
the_module
}
LINK_PRIVATE
${
OPENCV_LINKER_LIBS
}
)
# force strip library after the build command
# because samples and tests will make a copy of the library before install
get_target_property(__opencv_java_location
${
the_module
}
LOCATION)
# Turn off stripping in debug build
if ( NOT (CMAKE_BUILD_TYPE MATCHES "
Debug
"))
add_custom_command(TARGET
${
the_module
}
POST_BUILD COMMAND
${
CMAKE_STRIP
}
--strip-unneeded "
$
{
__opencv_java_location
}
")
add_custom_command(TARGET
${
the_module
}
POST_BUILD COMMAND
${
CMAKE_STRIP
}
--strip-unneeded "
$
<TARGET_FILE:
${
the_module
}
>
")
endif()
endif()
...
...
modules/java/android_test/CMakeLists.txt
View file @
a2120263
...
...
@@ -43,13 +43,10 @@ add_custom_command(
list
(
APPEND opencv_test_java_file_deps
${
android_proj_target_files
}
)
get_target_property
(
java_location opencv_java LOCATION
)
get_filename_component
(
java_name
"
${
java_location
}
"
NAME
)
# build java part
add_custom_command
(
OUTPUT
"
${
opencv_test_java_bin_dir
}
/bin/OpenCVTest-debug.apk"
COMMAND
${
CMAKE_COMMAND
}
-E copy_if_different
"
$
{
java_location
}
"
"
${
opencv_test_java_bin_dir
}
/libs/
${
ANDROID_NDK_ABI_NAME
}
/
${
java_name
}
"
COMMAND
${
CMAKE_COMMAND
}
-E copy_if_different
"$
<TARGET_FILE:opencv_java>"
"
${
opencv_test_java_bin_dir
}
/libs/
${
ANDROID_NDK_ABI_NAME
}
/$<TARGET_FILE_NAME:opencv_java>
"
COMMAND
${
ANT_EXECUTABLE
}
-q -noinput -k debug -Djava.target=1.6 -Djava.source=1.6
COMMAND
${
CMAKE_COMMAND
}
-E touch
"
${
opencv_test_java_bin_dir
}
/bin/OpenCVTest-debug.apk"
# needed because ant does not update the timestamp of updated apk
WORKING_DIRECTORY
"
${
opencv_test_java_bin_dir
}
"
...
...
modules/python/common.cmake
View file @
a2120263
...
...
@@ -72,12 +72,12 @@ if(APPLE)
set_target_properties
(
${
the_module
}
PROPERTIES LINK_FLAGS
"-undefined dynamic_lookup"
)
elseif
(
WIN32 OR OPENCV_FORCE_PYTHON_LIBS
)
if
(
${
PYTHON
}
_DEBUG_LIBRARIES AND NOT
${
PYTHON
}
_LIBRARIES MATCHES
"optimized.*debug"
)
ocv_target_link_libraries
(
${
the_module
}
debug
${${
PYTHON
}
_DEBUG_LIBRARIES
}
optimized
${${
PYTHON
}
_LIBRARIES
}
)
ocv_target_link_libraries
(
${
the_module
}
LINK_PRIVATE
debug
${${
PYTHON
}
_DEBUG_LIBRARIES
}
optimized
${${
PYTHON
}
_LIBRARIES
}
)
else
()
ocv_target_link_libraries
(
${
the_module
}
${${
PYTHON
}
_LIBRARIES
}
)
ocv_target_link_libraries
(
${
the_module
}
LINK_PRIVATE
${${
PYTHON
}
_LIBRARIES
}
)
endif
()
endif
()
ocv_target_link_libraries
(
${
the_module
}
${
OPENCV_MODULE_
${
the_module
}
_DEPS
}
)
ocv_target_link_libraries
(
${
the_module
}
LINK_PRIVATE
${
OPENCV_MODULE_
${
the_module
}
_DEPS
}
)
if
(
DEFINED
${
PYTHON
}
_CVPY_SUFFIX
)
set
(
CVPY_SUFFIX
"
${${
PYTHON
}
_CVPY_SUFFIX
}
"
)
...
...
modules/videoio/CMakeLists.txt
View file @
a2120263
...
...
@@ -261,11 +261,6 @@ if(MSVC)
endif
()
endif
()
#stop automatic dependencies propagation for this module
if
(
NOT BUILD_opencv_world
)
set_target_properties
(
${
the_module
}
PROPERTIES LINK_INTERFACE_LIBRARIES
""
)
endif
()
ocv_warnings_disable
(
CMAKE_CXX_FLAGS -Wno-deprecated-declarations
)
if
(
WIN32 AND HAVE_FFMPEG
)
...
...
modules/viz/CMakeLists.txt
View file @
a2120263
...
...
@@ -24,11 +24,13 @@ if(NOT BUILD_SHARED_LIBS)
endif
()
endif
()
ocv_warnings_disable
(
CMAKE_CXX_FLAGS -Winconsistent-missing-override
)
ocv_define_module
(
viz opencv_core WRAP python
)
ocv_target_link_libraries
(
${
the_module
}
${
VTK_LIBRARIES
}
)
ocv_target_link_libraries
(
${
the_module
}
LINK_PRIVATE
${
VTK_LIBRARIES
}
)
if
(
APPLE AND BUILD_opencv_viz
)
ocv_target_link_libraries
(
${
the_module
}
"-framework Cocoa"
)
ocv_target_link_libraries
(
${
the_module
}
LINK_PRIVATE
"-framework Cocoa"
)
endif
()
if
(
TARGET opencv_test_viz
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment