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
772fcf40
Commit
772fcf40
authored
Apr 02, 2015
by
Alexander Smorkalov
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3893 from SpecLad:cuda-imported-targets
parents
ba0a8dc7
6e121b2e
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
55 additions
and
64 deletions
+55
-64
CMakeLists.txt
CMakeLists.txt
+0
-3
OpenCVDetectCUDA.cmake
cmake/OpenCVDetectCUDA.cmake
+5
-27
OpenCVGenPkgconfig.cmake
cmake/OpenCVGenPkgconfig.cmake
+10
-9
OpenCVModule.cmake
cmake/OpenCVModule.cmake
+7
-4
OpenCVUtils.cmake
cmake/OpenCVUtils.cmake
+20
-9
OpenCV.mk.in
cmake/templates/OpenCV.mk.in
+3
-2
OpenCVConfig.cmake.in
cmake/templates/OpenCVConfig.cmake.in
+10
-10
No files found.
CMakeLists.txt
View file @
772fcf40
...
...
@@ -540,9 +540,6 @@ if(HAVE_CUDA AND NOT ENABLE_DYNAMIC_CUDA)
if
(
HAVE_CUFFT
)
set
(
OPENCV_LINKER_LIBS
${
OPENCV_LINKER_LIBS
}
${
CUDA_cufft_LIBRARY
}
)
endif
()
foreach
(
p
${
CUDA_LIBS_PATH
}
)
set
(
OPENCV_LINKER_LIBS
${
OPENCV_LINKER_LIBS
}
-L
${
p
}
)
endforeach
()
endif
()
# ----------------------------------------------------------------------------
...
...
cmake/OpenCVDetectCUDA.cmake
View file @
772fcf40
...
...
@@ -218,40 +218,18 @@ else()
endif
()
if
(
HAVE_CUDA
)
set
(
CUDA_LIBS_PATH
""
)
foreach
(
p
${
CUDA_LIBRARIES
}
${
CUDA_npp_LIBRARY
}
)
get_filename_component
(
_tmp
${
p
}
PATH
)
list
(
APPEND CUDA_LIBS_PATH
${
_tmp
}
)
endforeach
()
if
(
HAVE_CUBLAS
)
foreach
(
p
${
CUDA_cublas_LIBRARY
}
)
get_filename_component
(
_tmp
${
p
}
PATH
)
list
(
APPEND CUDA_LIBS_PATH
${
_tmp
}
)
endforeach
()
endif
()
if
(
HAVE_CUFFT
)
foreach
(
p
${
CUDA_cufft_LIBRARY
}
)
get_filename_component
(
_tmp
${
p
}
PATH
)
list
(
APPEND CUDA_LIBS_PATH
${
_tmp
}
)
endforeach
()
endif
()
list
(
REMOVE_DUPLICATES CUDA_LIBS_PATH
)
link_directories
(
${
CUDA_LIBS_PATH
}
)
set
(
CUDA_LIBRARIES_ABS
${
CUDA_LIBRARIES
}
)
ocv_c
onvert_to_lib_name
(
CUDA_LIBRARIES
${
CUDA_LIBRARIES
}
)
ocv_c
reate_imported_targets
(
CUDA_LIBRARIES
${
CUDA_LIBRARIES
}
)
set
(
CUDA_npp_LIBRARY_ABS
${
CUDA_npp_LIBRARY
}
)
ocv_convert_to_lib_name
(
CUDA_npp_LIBRARY
${
CUDA_npp_LIBRARY
}
)
ocv_create_imported_targets
(
CUDA_npp_LIBRARY
${
CUDA_npp_LIBRARY
}
)
if
(
HAVE_CUBLAS
)
set
(
CUDA_cublas_LIBRARY_ABS
${
CUDA_cublas_LIBRARY
}
)
ocv_c
onvert_to_lib_name
(
CUDA_cublas_LIBRARY
${
CUDA_cublas_LIBRARY
}
)
ocv_c
reate_imported_targets
(
CUDA_cublas_LIBRARY
${
CUDA_cublas_LIBRARY
}
)
endif
()
if
(
HAVE_CUFFT
)
set
(
CUDA_cufft_LIBRARY_ABS
${
CUDA_cufft_LIBRARY
}
)
ocv_c
onvert_to_lib_name
(
CUDA_cufft_LIBRARY
${
CUDA_cufft_LIBRARY
}
)
ocv_c
reate_imported_targets
(
CUDA_cufft_LIBRARY
${
CUDA_cufft_LIBRARY
}
)
endif
()
endif
()
cmake/OpenCVGenPkgconfig.cmake
View file @
772fcf40
...
...
@@ -63,22 +63,23 @@ endforeach()
# add extra dependencies required for OpenCV
if
(
OpenCV_EXTRA_COMPONENTS
)
foreach
(
extra_component
${
OpenCV_EXTRA_COMPONENTS
}
)
if
(
TARGET
"
${
extra_component
}
"
)
get_target_property
(
extra_component_is_imported
"
${
extra_component
}
"
IMPORTED
)
if
(
extra_component_is_imported
)
get_target_property
(
extra_component
"
${
extra_component
}
"
LOCATION
)
endif
()
endif
()
if
(
extra_component MATCHES
"^-[lL]"
)
set
(
libprefix
""
)
set
(
libname
"
${
extra_component
}
"
)
if
(
extra_component MATCHES
"^-l"
)
list
(
APPEND OpenCV_LIB_COMPONENTS_
"
${
extra_component
}
"
)
elseif
(
extra_component MATCHES
"[
\\
/]"
)
get_filename_component
(
libdir
"
${
extra_component
}
"
PATH
)
list
(
APPEND OpenCV_LIB_COMPONENTS_
"-L
${
libdir
}
"
)
get_filename_component
(
libname
"
${
extra_component
}
"
NAME_WE
)
string
(
REGEX REPLACE
"^lib"
""
libname
"
${
libname
}
"
)
set
(
libprefix
"-l
"
)
list
(
APPEND OpenCV_LIB_COMPONENTS_
"-L
${
libdir
}
"
"-l
${
libname
}
"
)
else
()
set
(
libprefix
"-l"
)
set
(
libname
"
${
extra_component
}
"
)
list
(
APPEND OpenCV_LIB_COMPONENTS_
"-l
${
extra_component
}
"
)
endif
()
list
(
APPEND OpenCV_LIB_COMPONENTS_
"
${
libprefix
}${
libname
}
"
)
endforeach
()
endif
()
...
...
cmake/OpenCVModule.cmake
View file @
772fcf40
...
...
@@ -919,12 +919,16 @@ macro(__ocv_track_module_link_dependencies the_module optkind)
list
(
REMOVE_AT __mod_depends 0
)
if
(
__dep STREQUAL the_module
)
set
(
__has_cycle TRUE
)
else
()
#if("${OPENCV_MODULES_BUILD}" MATCHES "(^|;)${__dep}(;|$)")
else
()
ocv_regex_escape
(
__rdep
"
${
__dep
}
"
)
if
(
__resolved_deps MATCHES
"(^|;)
${
__rdep
}
(;|$)"
)
#all dependencies of this module are already resolved
list
(
APPEND
${
the_module
}
_MODULE_DEPS_
${
optkind
}
"
${
__dep
}
"
)
elseif
(
TARGET
${
__dep
}
)
get_target_property
(
__dep_imported
${
__dep
}
IMPORTED
)
if
(
__dep_imported
)
list
(
APPEND
${
the_module
}
_EXTRA_DEPS_
${
optkind
}
"
${
__dep
}
"
)
else
()
get_target_property
(
__module_type
${
__dep
}
TYPE
)
if
(
__module_type STREQUAL
"STATIC_LIBRARY"
)
if
(
NOT DEFINED
${
__dep
}
_LIB_DEPENDS_
${
optkind
}
)
...
...
@@ -933,11 +937,10 @@ macro(__ocv_track_module_link_dependencies the_module optkind)
list
(
INSERT __mod_depends 0
${${
__dep
}
_LIB_DEPENDS_
${
optkind
}}
${
__dep
}
)
list
(
APPEND __resolved_deps
"
${
__dep
}
"
)
endif
()
endif
()
else
()
list
(
APPEND
${
the_module
}
_EXTRA_DEPS_
${
optkind
}
"
${
__dep
}
"
)
endif
()
#else()
# get_target_property(__dep_location "${__dep}" LOCATION)
endif
()
endwhile
()
...
...
@@ -951,7 +954,7 @@ macro(__ocv_track_module_link_dependencies the_module optkind)
list
(
APPEND
${
the_module
}
_MODULE_DEPS_
${
optkind
}
"
${
the_module
}
"
)
endif
()
unset
(
__dep_
location
)
unset
(
__dep_
imported
)
unset
(
__mod_depends
)
unset
(
__resolved_deps
)
unset
(
__has_cycle
)
...
...
cmake/OpenCVUtils.cmake
View file @
772fcf40
...
...
@@ -449,18 +449,29 @@ endmacro()
# convert list of paths to libraries names without lib prefix
macro
(
ocv_convert_to_lib_name var
)
set
(
__
tmp
""
)
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
}
)
list
(
APPEND
__tmp
"
${
__
tmp_name
}
"
)
get_filename_component
(
tmp_name
"
${
path
}
"
NAME_WE
)
string
(
REGEX REPLACE
"^lib"
""
tmp_name
"
${
tmp_name
}
"
)
list
(
APPEND
tmp
"
${
tmp_name
}
"
)
endforeach
()
set
(
${
var
}
${
__tmp
}
)
unset
(
__tmp
)
unset
(
__tmp_name
)
endmacro
()
set
(
${
var
}
${
tmp
}
PARENT_SCOPE
)
endfunction
()
# create imported targets for a list of external libraries
function
(
ocv_create_imported_targets var
)
set
(
target_list
""
)
foreach
(
library
${
ARGN
}
)
ocv_convert_to_lib_name
(
libname
"
${
library
}
"
)
add_library
(
"opencv_dep_
${
libname
}
"
UNKNOWN IMPORTED
)
set_target_properties
(
"opencv_dep_
${
libname
}
"
PROPERTIES IMPORTED_LOCATION
"
${
library
}
"
)
list
(
APPEND target_list
"opencv_dep_
${
libname
}
"
)
endforeach
()
set
(
"
${
var
}
"
"
${
target_list
}
"
PARENT_SCOPE
)
endfunction
()
# add install command
function
(
ocv_install_target
)
...
...
cmake/templates/OpenCV.mk.in
View file @
772fcf40
...
...
@@ -104,7 +104,7 @@ endef
define add_cuda_module
include $(CLEAR_VARS)
LOCAL_MODULE:=$1
LOCAL_SRC_FILES:=$(CUDA_TOOLKIT_DIR)/targets/armv7-linux-androideabi/lib/lib$
1
.so
LOCAL_SRC_FILES:=$(CUDA_TOOLKIT_DIR)/targets/armv7-linux-androideabi/lib/lib$
(1:opencv_dep_%=%)
.so
include $(PREBUILT_SHARED_LIBRARY)
endef
...
...
@@ -202,7 +202,8 @@ ifeq ($(OPENCV_USE_GPU_MODULE),on)
ifeq ($(INSTALL_CUDA_LIBRARIES),on)
LOCAL_SHARED_LIBRARIES += $(foreach mod, $(CUDA_RUNTIME_LIBS), $(mod))
else
LOCAL_LDLIBS += -L$(CUDA_TOOLKIT_DIR)/targets/armv7-linux-androideabi/lib $(foreach lib, $(CUDA_RUNTIME_LIBS), -l$(lib))
LOCAL_LDLIBS += -L$(CUDA_TOOLKIT_DIR)/targets/armv7-linux-androideabi/lib \
$(foreach lib, $(CUDA_RUNTIME_LIBS), -l$(lib:opencv_dep_%=%))
endif
LOCAL_STATIC_LIBRARIES+=libopencv_gpu
endif
...
...
cmake/templates/OpenCVConfig.cmake.in
View file @
772fcf40
...
...
@@ -234,9 +234,10 @@ endif()
foreach(__opttype OPT DBG)
SET(OpenCV_LIBS_${__opttype} "${OpenCV_LIBS}")
SET(OpenCV_EXTRA_LIBS_${__opttype} "")
endforeach()
# CUDA
if(OpenCV_CUDA_VERSION)
# Configure CUDA targets
if(OpenCV_CUDA_VERSION)
if(NOT CUDA_FOUND)
find_host_package(CUDA ${OpenCV_CUDA_VERSION} EXACT REQUIRED)
else()
...
...
@@ -272,16 +273,15 @@ foreach(__opttype OPT DBG)
list(APPEND OpenCV_CUDA_LIBS_ABSPATH ${CUDA_nvcuvenc_LIBRARIES})
endif()
set(OpenCV_CUDA_LIBS_RELPATH "")
foreach(l ${OpenCV_CUDA_LIBS_ABSPATH})
get_filename_component(_tmp ${l} PATH)
list(APPEND OpenCV_CUDA_LIBS_RELPATH ${_tmp})
endforeach()
list(REMOVE_DUPLICATES OpenCV_CUDA_LIBS_RELPATH)
link_directories(${OpenCV_CUDA_LIBS_RELPATH})
get_filename_component(_tmp "${l}" NAME_WE)
string(REGEX REPLACE "^lib" "" _tmp "${_tmp}")
if(NOT TARGET "opencv_dep_${_tmp}") # protect against repeated inclusions
add_library("opencv_dep_${_tmp}" UNKNOWN IMPORTED)
set_target_properties("opencv_dep_${_tmp}" PROPERTIES IMPORTED_LOCATION "${l}")
endif()
endforeach()
endforeach()
endif()
# ==============================================================
# Android camera helper macro
...
...
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