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
0fc58496
Commit
0fc58496
authored
Jul 05, 2019
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmake: workaround to fix link issues with stubs/libcuda.so.1
parent
0e9a865b
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
24 deletions
+49
-24
CMakeLists.txt
CMakeLists.txt
+0
-24
OpenCVDetectCUDA.cmake
cmake/OpenCVDetectCUDA.cmake
+49
-0
No files found.
CMakeLists.txt
View file @
0fc58496
...
@@ -915,30 +915,6 @@ configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/custom_hal.hpp.in" "${CMAKE
...
@@ -915,30 +915,6 @@ configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/custom_hal.hpp.in" "${CMAKE
unset
(
_hal_includes
)
unset
(
_hal_includes
)
# ----------------------------------------------------------------------------
# Add CUDA libraries (needed for apps/tools, samples)
# ----------------------------------------------------------------------------
if
(
HAVE_CUDA
)
set
(
OPENCV_LINKER_LIBS
${
OPENCV_LINKER_LIBS
}
${
CUDA_LIBRARIES
}
${
CUDA_CUDA_LIBRARY
}
${
CUDA_npp_LIBRARY
}
)
if
(
HAVE_CUBLAS
)
set
(
OPENCV_LINKER_LIBS
${
OPENCV_LINKER_LIBS
}
${
CUDA_cublas_LIBRARY
}
)
endif
()
if
(
HAVE_CUDNN
)
set
(
OPENCV_LINKER_LIBS
${
OPENCV_LINKER_LIBS
}
${
CUDNN_LIBRARIES
}
)
endif
()
if
(
HAVE_CUFFT
)
set
(
OPENCV_LINKER_LIBS
${
OPENCV_LINKER_LIBS
}
${
CUDA_cufft_LIBRARY
}
)
endif
()
foreach
(
p
${
CUDA_LIBS_PATH
}
)
if
(
MSVC AND CMAKE_GENERATOR MATCHES
"Ninja|JOM"
)
set
(
OPENCV_LINKER_LIBS
${
OPENCV_LINKER_LIBS
}
${
CMAKE_LIBRARY_PATH_FLAG
}
"
${
p
}
"
)
else
()
set
(
OPENCV_LINKER_LIBS
${
OPENCV_LINKER_LIBS
}
${
CMAKE_LIBRARY_PATH_FLAG
}${
p
}
)
endif
()
endforeach
()
endif
()
# ----------------------------------------------------------------------------
# ----------------------------------------------------------------------------
# Code trace support
# Code trace support
# ----------------------------------------------------------------------------
# ----------------------------------------------------------------------------
...
...
cmake/OpenCVDetectCUDA.cmake
View file @
0fc58496
...
@@ -337,3 +337,52 @@ if(HAVE_CUDA)
...
@@ -337,3 +337,52 @@ if(HAVE_CUDA)
ocv_convert_to_lib_name
(
CUDA_cufft_LIBRARY
${
CUDA_cufft_LIBRARY
}
)
ocv_convert_to_lib_name
(
CUDA_cufft_LIBRARY
${
CUDA_cufft_LIBRARY
}
)
endif
()
endif
()
endif
()
endif
()
# ----------------------------------------------------------------------------
# Add CUDA libraries (needed for apps/tools, samples)
# ----------------------------------------------------------------------------
if
(
HAVE_CUDA
)
# details: https://github.com/NVIDIA/nvidia-docker/issues/775
if
(
"
${
CUDA_CUDA_LIBRARY
}
"
MATCHES
"/stubs/libcuda.so"
AND NOT OPENCV_SKIP_CUDA_STUB_WORKAROUND
)
set
(
CUDA_STUB_ENABLED_LINK_WORKAROUND 1
)
if
(
EXISTS
"
${
CUDA_CUDA_LIBRARY
}
"
AND NOT OPENCV_SKIP_CUDA_STUB_WORKAROUND_RPATH_LINK
)
set
(
CUDA_STUB_TARGET_PATH
"
${
CMAKE_BINARY_DIR
}${
CMAKE_FILES_DIRECTORY
}
/"
)
execute_process
(
COMMAND
${
CMAKE_COMMAND
}
-E create_symlink
"
${
CUDA_CUDA_LIBRARY
}
"
"
${
CUDA_STUB_TARGET_PATH
}
/libcuda.so.1"
RESULT_VARIABLE CUDA_STUB_SYMLINK_RESULT
)
if
(
NOT CUDA_STUB_SYMLINK_RESULT EQUAL 0
)
execute_process
(
COMMAND
${
CMAKE_COMMAND
}
-E copy_if_different
"
${
CUDA_CUDA_LIBRARY
}
"
"
${
CUDA_STUB_TARGET_PATH
}
/libcuda.so.1"
RESULT_VARIABLE CUDA_STUB_COPY_RESULT
)
if
(
NOT CUDA_STUB_COPY_RESULT EQUAL 0
)
set
(
CUDA_STUB_ENABLED_LINK_WORKAROUND 0
)
endif
()
endif
()
if
(
CUDA_STUB_ENABLED_LINK_WORKAROUND
)
set
(
CMAKE_EXE_LINKER_FLAGS
"
${
CMAKE_EXE_LINKER_FLAGS
}
-Wl,-rpath-link,
\"
${
CUDA_STUB_TARGET_PATH
}
\"
"
)
endif
()
else
()
set
(
CMAKE_EXE_LINKER_FLAGS
"
${
CMAKE_EXE_LINKER_FLAGS
}
-Wl,--allow-shlib-undefined"
)
endif
()
if
(
NOT CUDA_STUB_ENABLED_LINK_WORKAROUND
)
message
(
WARNING
"CUDA: workaround for stubs/libcuda.so.1 is not applied"
)
endif
()
endif
()
set
(
OPENCV_LINKER_LIBS
${
OPENCV_LINKER_LIBS
}
${
CUDA_LIBRARIES
}
${
CUDA_CUDA_LIBRARY
}
${
CUDA_npp_LIBRARY
}
)
if
(
HAVE_CUBLAS
)
set
(
OPENCV_LINKER_LIBS
${
OPENCV_LINKER_LIBS
}
${
CUDA_cublas_LIBRARY
}
)
endif
()
if
(
HAVE_CUDNN
)
set
(
OPENCV_LINKER_LIBS
${
OPENCV_LINKER_LIBS
}
${
CUDNN_LIBRARIES
}
)
endif
()
if
(
HAVE_CUFFT
)
set
(
OPENCV_LINKER_LIBS
${
OPENCV_LINKER_LIBS
}
${
CUDA_cufft_LIBRARY
}
)
endif
()
foreach
(
p
${
CUDA_LIBS_PATH
}
)
if
(
MSVC AND CMAKE_GENERATOR MATCHES
"Ninja|JOM"
)
set
(
OPENCV_LINKER_LIBS
${
OPENCV_LINKER_LIBS
}
${
CMAKE_LIBRARY_PATH_FLAG
}
"
${
p
}
"
)
else
()
set
(
OPENCV_LINKER_LIBS
${
OPENCV_LINKER_LIBS
}
${
CMAKE_LIBRARY_PATH_FLAG
}${
p
}
)
endif
()
endforeach
()
endif
()
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