Simplifies cross compilation with CUDA for ARM boards. CUDA arch is set for all ARM targets, --unresolved-symbols=ignore-in-shared-libs is set when cross-compiling for ARM and FindCUDA.cmake was adjusted to find shared library stubs within the CUDA toolkit.
This commit is contained in:
parent
dfec99691b
commit
01c5a0ed12
@ -685,6 +685,9 @@ macro(cuda_find_library_local_first_with_path_ext _var _names _doc _path_ext )
|
||||
# and old paths.
|
||||
set(_cuda_64bit_lib_dir "${_path_ext}lib/x64" "${_path_ext}lib64" "${_path_ext}libx64" )
|
||||
endif()
|
||||
if(CMAKE_CROSSCOMPILING AND (ARM OR AARCH64))
|
||||
set(_cuda_cross_arm_lib_dir "${_path_ext}lib/stubs")
|
||||
endif()
|
||||
if(CUDA_VERSION VERSION_GREATER "6.0")
|
||||
set(_cuda_static_lib_names "")
|
||||
foreach(name ${_names})
|
||||
@ -698,7 +701,7 @@ macro(cuda_find_library_local_first_with_path_ext _var _names _doc _path_ext )
|
||||
PATHS "${CUDA_TOOLKIT_TARGET_DIR}" "${CUDA_TOOLKIT_ROOT_DIR}"
|
||||
ENV CUDA_PATH
|
||||
ENV CUDA_LIB_PATH
|
||||
PATH_SUFFIXES ${_cuda_64bit_lib_dir} "${_path_ext}lib/Win32" "${_path_ext}lib" "${_path_ext}libWin32"
|
||||
PATH_SUFFIXES ${_cuda_64bit_lib_dir} ${_cuda_cross_arm_lib_dir} "${_path_ext}lib/Win32" "${_path_ext}lib" "${_path_ext}libWin32"
|
||||
DOC ${_doc}
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
|
@ -79,14 +79,12 @@ if(CUDA_FOUND)
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED __cuda_arch_bin)
|
||||
if(ANDROID)
|
||||
if(ARM)
|
||||
set(__cuda_arch_bin "3.2")
|
||||
set(__cuda_arch_ptx "")
|
||||
elseif(AARCH64)
|
||||
set(__cuda_arch_bin "5.3")
|
||||
set(__cuda_arch_ptx "")
|
||||
endif()
|
||||
else()
|
||||
if(${CUDA_VERSION} VERSION_LESS "5.0")
|
||||
set(__cuda_arch_bin "1.1 1.2 1.3 2.0 2.1(2.0) 3.0")
|
||||
@ -200,6 +198,10 @@ if(CUDA_FOUND)
|
||||
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -Xcompiler -fno-finite-math-only)
|
||||
endif()
|
||||
|
||||
if(CMAKE_CROSSCOMPILING AND (ARM OR AARCH64))
|
||||
set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -Xlinker --unresolved-symbols=ignore-in-shared-libs)
|
||||
endif()
|
||||
|
||||
# disabled because of multiple warnings during building nvcc auto generated files
|
||||
if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_GCC_REGEX_VERSION VERSION_GREATER "4.6.0")
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wunused-but-set-variable)
|
||||
|
Loading…
x
Reference in New Issue
Block a user