Commit 199ffc63 authored by Andrey Morozov's avatar Andrey Morozov

added flags OpenCV_COMPUTE_CAPABILITIES, which stores the version compute…

added flags OpenCV_COMPUTE_CAPABILITIES, which stores the version compute capability from which it is compiled opencv
now use opencv with cuda in your application  in the such way : set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} ${OpenCV_COMPUTE_CAPABILITIES})
parent 096080de
This diff is collapsed.
......@@ -3,24 +3,30 @@
#
# ** File generated automatically, do not modify **
#
# Usage from an external project:
# Usage from an external project:
# In your CMakeLists.txt, add these lines:
#
# FIND_PACKAGE(OpenCV REQUIRED )
# TARGET_LINK_LIBRARIES(MY_TARGET_NAME ${OpenCV_LIBS})
# TARGET_LINK_LIBRARIES(MY_TARGET_NAME ${OpenCV_LIBS})
#
# This file will define the following variables:
# - OpenCV_LIBS : The list of libraries to links against.
# - OpenCV_LIB_DIR : The directory where lib files are. Calling LINK_DIRECTORIES
# with this path is NOT needed.
# - OpenCV_INCLUDE_DIRS : The OpenCV include directories.
# - OpenCV_VERSION : The version of this OpenCV build. Example: "1.2.0"
# - OpenCV_VERSION_MAJOR : Major version part of OpenCV_VERSION. Example: "1"
# - OpenCV_VERSION_MINOR : Minor version part of OpenCV_VERSION. Example: "2"
# - OpenCV_VERSION_PATCH : Patch version part of OpenCV_VERSION. Example: "0"
# - OpenCV_LIBS : The list of libraries to links against.
# - OpenCV_LIB_DIR : The directory where lib files are. Calling LINK_DIRECTORIES
# with this path is NOT needed.
# - OpenCV_INCLUDE_DIRS : The OpenCV include directories.
# - OpenCV_COMPUTE_CAPABILITIES : The version of compute capability
# - OpenCV_VERSION : The version of this OpenCV build. Example: "1.2.0"
# - OpenCV_VERSION_MAJOR : Major version part of OpenCV_VERSION. Example: "1"
# - OpenCV_VERSION_MINOR : Minor version part of OpenCV_VERSION. Example: "2"
# - OpenCV_VERSION_PATCH : Patch version part of OpenCV_VERSION. Example: "0"
#
# ===================================================================================
# =================================================================================================
# ======================================================
# Version Compute Capability from which library OpenCV
# has been compiled is remembered
# ======================================================
SET(OpenCV_COMPUTE_CAPABILITIES @OpenCV_CUDA_CC@)
# Extract the directory where *this* file has been installed (determined at cmake run-time)
# This variable may or may not be used below, depending on the parsing of OpenCVConfig.cmake
......@@ -68,26 +74,26 @@ if(NOT @CMAKE_BASE_INCLUDE_DIRS_CONFIGCMAKE@ STREQUAL "")
endforeach(__CVLIB)
endif(NOT @CMAKE_BASE_INCLUDE_DIRS_CONFIGCMAKE@ STREQUAL "")
# For OpenCV built as static libs, we need the user to link against
# For OpenCV built as static libs, we need the user to link against
# many more dependencies:
IF (NOT @OPENCV_BUILD_SHARED_LIB@)
# Under static libs, the user of OpenCV needs access to the 3rdparty libs as well:
LINK_DIRECTORIES("@CMAKE_BINARY_DIR@/3rdparty/lib")
SET(OpenCV_LIBS
@OPENCV_LINKER_LIBS@
SET(OpenCV_LIBS
@OPENCV_LINKER_LIBS@
@IPP_LIBS@
@JPEG_LIBRARIES@
@PNG_LIBRARIES@
@TIFF_LIBRARIES@
@JASPER_LIBRARIES@
@HIGHGUI_LIBRARIES@
@JPEG_LIBRARIES@
@PNG_LIBRARIES@
@TIFF_LIBRARIES@
@JASPER_LIBRARIES@
@HIGHGUI_LIBRARIES@
${OpenCV_LIBS}) # The standard libs BEFORE (OpenCV_LIBS) since these can have "debug","optimized".
ENDIF(NOT @OPENCV_BUILD_SHARED_LIB@)
# ======================================================
# Version variables:
# Version variables:
# ======================================================
SET(OpenCV_VERSION @OPENCV_VERSION@)
SET(OpenCV_VERSION_MAJOR @OPENCV_VERSION_MAJOR@)
......
......@@ -36,28 +36,6 @@ if (HAVE_CUDA)
include_directories(${CUDA_INCLUDE_DIRS})
link_directories(${CUDA_LIBRARIES})
set(CUDA_COMPUTE_CAPABILITIES " 1.0 1.1 1.2 1.3 2.0 " CACHE STRING "Add or remove compute capability")
set(CUDA_NVCC_FLAGS_ARCH ${CUDA_COMPUTE_CAPABILITIES})
set(CUDA_NVCC_FLAGS_NUM "")
while(NOT ${CUDA_NVCC_FLAGS_ARCH} STREQUAL "")
string(REGEX MATCH "[0-9]+.[0-9]+" RESULT_NUM ${CUDA_NVCC_FLAGS_ARCH})
string(REGEX MATCHALL "[0-9]" RESULT_STR ${RESULT_NUM})
string(REGEX REPLACE ";" "\ " RESULT ${RESULT_STR})
list(APPEND CUDA_NVCC_FLAGS_NUM ${RESULT})
string(REGEX REPLACE "${RESULT_NUM}" "\ " CUDA_NVCC_FLAGS_ARCH_STR ${CUDA_NVCC_FLAGS_ARCH})
string(STRIP ${CUDA_NVCC_FLAGS_ARCH_STR} CUDA_NVCC_FLAGS_ARCH)
endwhile()
set (loop_var "")
foreach( loop_var IN LISTS CUDA_NVCC_FLAGS_NUM)
set (CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -gencode arch=compute_${loop_var},code=sm_${loop_var})
endforeach()
message(STATUS " CUDA_NVCC_FLAGS: ${CUDA_NVCC_FLAGS} ")
if (UNIX OR APPLE)
set (CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} "-Xcompiler;-fPIC;")
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" "-fPIC")
......@@ -66,7 +44,7 @@ if (HAVE_CUDA)
#set (CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} "-keep")
#set (CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} "-Xcompiler;/EHsc-;")
string(REPLACE "/W4" "/W3" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
string(REPLACE "/W4" "/W3" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
string(REPLACE "/W4" "/W3" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment