fixed problem with building module gpu on linux
authorAndrey Morozov <no@email>
Thu, 15 Jul 2010 12:24:06 +0000 (12:24 +0000)
committerAndrey Morozov <no@email>
Thu, 15 Jul 2010 12:24:06 +0000 (12:24 +0000)
modules/gpu/CMakeLists.txt

index f8d12fd..17e2eb8 100644 (file)
@@ -5,10 +5,14 @@ if (CUDA_FOUND)
     include_directories(${CUDA_INCLUDE_DIRS})\r
     link_directories(${CUDA_LIBRARIES})\r
 \r
+    #message ("CUDA_LIBRARIES = ${CUDA_LIBRARIES}")\r
+    #message ("CUDA_INCLUDE_DIRS = ${CUDA_INCLUDE_DIRS}")\r
+    #message ("CUDA_TARGET_LINK = ${CUDA_TARGET_LINK}")\r
+\r
+\r
        #CUDA_GENERATED_OUTPUT_DIR (Default CMAKE_CURRENT_BINARY_DIR)\r
 \r
        #====================================================================================\r
-\r
        \r
        set(name "gpu") \r
        set(DEPS "opencv_core")\r
@@ -30,7 +34,7 @@ if (CUDA_FOUND)
 \r
        file(GLOB lib_srcs "src/*.cpp")\r
        file(GLOB lib_int_hdrs "src/*.h*")\r
-       file(GLOB lib_cuda "cuda/*.cu")\r
+        file(GLOB lib_cuda "cuda/*.cu")\r
        file(GLOB lib_cuda_hdrs "cuda/*.h*")    \r
        source_group("Src" FILES ${lib_srcs} ${lib_int_hdrs})\r
        source_group("Cuda" FILES ${lib_cuda} ${lib_cuda_hdrs})\r
@@ -38,11 +42,17 @@ if (CUDA_FOUND)
        file(GLOB lib_hdrs "include/opencv2/${name}/*.h*")              \r
        source_group("Include" FILES ${lib_hdrs})\r
 \r
+        if (UNIX OR APPLE)\r
+            set (CUDA_NVCC_FLAGS "-Xcompiler;-fPIC")\r
+        endif()\r
+\r
        CUDA_COMPILE(cuda_objs ${lib_cuda})\r
+        #message ("lib cuda : ${cuda_objs}")\r
        #CUDA_BUILD_CLEAN_TARGET()\r
                \r
        set(the_target "opencv_${name}")\r
-       add_library(${the_target} ${lib_srcs} ${lib_hdrs} ${lib_int_hdrs} ${lib_cuda} ${lib_cuda_hdrs} ${cuda_objs})\r
+        #message ("cuda_add_library : ${the_target} ${lib_srcs} ${lib_hdrs} ${lib_int_hdrs} ${lib_cuda} ${lib_cuda_hdrs}")\r
+        add_library(${the_target} ${lib_srcs} ${lib_hdrs} ${lib_int_hdrs} ${lib_cuda} ${lib_cuda_hdrs} ${cuda_objs})\r
 \r
        if(PCHSupport_FOUND)\r
                set(pch_header ${CMAKE_CURRENT_SOURCE_DIR}/src/precomp.hpp)\r
@@ -71,7 +81,8 @@ if (CUDA_FOUND)
                INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib"\r
                )\r
 \r
-       # Add the required libraries for linking:\r
+        # Add the required libraries for linking:\r
+        #message (" ++++ target_link_libraries = ${the_target} ${OPENCV_LINKER_LIBS} ${IPP_LIBS} ${DEPS} ${CUDA_LIBRARIES}")\r
        target_link_libraries(${the_target} ${OPENCV_LINKER_LIBS} ${IPP_LIBS} ${DEPS} ${CUDA_LIBRARIES})\r
 \r
        if(MSVC)\r