fixed: gcc8 compile issues
[opensg.git] / Source / Contrib / ComputeBase / Support / CudaUtil / CMakeLists.txt
blob4a0728696777cbf1f3ae88d614967393f0cb7d4b
2 CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
4 INCLUDE(OSGContribComputeBase.SetupHelper)
6 SET(OSG_CUDA_UTIL_BUILD FALSE CACHE INTERNAL "" FORCE)
8 MESSAGE(STATUS "add CudaUtil")
10 IF(OSGNVidiaSDKSrcDir)
12   PROJECT(OSGCudaUtil)
14   SET(${PROJECT_NAME}SharedTarget    osgcudautil)
16   IF(NOT WIN32)
17     SET(OSG_CUDAUTIL_PLT_SRC_INPUT stopwatch_linux.cpp)
18   ELSE()
19     SET(OSG_CUDAUTIL_PLT_SRC_INPUT stopwatch_win.cpp)
20   ENDIF()
22   SET(OSG_CUDAUTIL_SRC_INPUT cutil.cpp
23                              bank_checker.cpp
24                              stopwatch.cpp
25                              ${OSG_CUDAUTIL_PLT_SRC_INPUT})
27   IF(NOT WIN32)
28     SET(OSG_CUDAUTIL_PLT_HDR_INPUT stopwatch_linux.h)
29   ELSE()
30     SET(OSG_CUDAUTIL_PLT_HDR_INPUT stopwatch_win.h)
31   ENDIF()
33   SET(OSG_CUDAUTIL_HDR_INPUT bank_checker.h
34                              cutil.h
35                              cutil_math.h
36                              cutil_inline.h
37                              cutil_inline_bankchecker.h
38                              cutil_inline_runtime.h
39                              cutil_inline_drvapi.h
40                              cutil_gl_inline.h
41                              error_checker.h
42                              stopwatch.h
43                              stopwatch_base.h
44                              stopwatch_base.inl
45                              ${OSG_CUDAUTIL_PLT_HDR_INPUT})
47 #                             cutil_gl_error.h
49   SetupFiles(OSG_CUDAUTIL_SRC_INPUT 
50              OSG_CUDAUTIL_SRCS 
51              "${OSGNVidiaSDKSrcDir}/C/common/src"
52              "${OSG_SUPP_CC_BBASE}/CudaUtil/src")
54   SetupFiles(OSG_CUDAUTIL_HDR_INPUT 
55              OSG_CUDAUTIL_HDR 
56              "${OSGNVidiaSDKSrcDir}/C/common/inc"
57              "${OSG_SUPP_CC_BBASE}/CudaUtil/src")
59   IF(NOT WIN32)
60     IF(NOT EXISTS ${_OSGSUPP_DST_DIR}/GL/glew.h)
61       FILE(MAKE_DIRECTORY ${_OSGSUPP_DST_DIR}/GL)
62       FILE(WRITE ${_OSGSUPP_DST_DIR}/GL/glew.h "/* dummy on unix */\n"
63                                                "#include <GL/gl.h>\n")
64     ENDIF(NOT EXISTS ${_OSGSUPP_DST_DIR}/GL/glew.h)
65   ENDIF(NOT WIN32)
67   INCLUDE_DIRECTORIES("${CMAKE_BINARY_DIR}/${OSG_SUPP_CC_BBASE}/CudaUtil/src")
68   INCLUDE_DIRECTORIES("${CUDA_TOOLKIT_INCLUDE}")
69   INCLUDE_DIRECTORIES("${OSG_NVSDK_COMMON_INCLUDEDIR}")
71   IF(UNIX)
72     SET(OSGCUDACOMLIB_DEF GL_GLEXT_PROTOTYPES=1)
73   ENDIF(UNIX)
76   ## device lib
78   ADD_LIBRARY(${${PROJECT_NAME}SharedTarget} SHARED ${OSG_CUDAUTIL_SRCS})
80   ADD_DEPENDENCIES(ALL_STANDARD_BUILD ${${PROJECT_NAME}SharedTarget})
82   IF(WIN32)
83     SET_TARGET_PROPERTIES(${${PROJECT_NAME}SharedTarget} PROPERTIES
84                           DEBUG_POSTFIX "D")
85   ENDIF(WIN32)
87   SET(OSGCUDACOMLIB_DEF_SHARED ${OSGCUDACOMLIB_DEF};BUILD_DLL)
88                           
89   SET_TARGET_PROPERTIES(${${PROJECT_NAME}SharedTarget} PROPERTIES
90                         COMPILE_DEFINITIONS "${OSGCUDACOMLIB_DEF_SHARED}")
92   TARGET_LINK_LIBRARIES(${${PROJECT_NAME}SharedTarget} ${OPENGL_gl_LIBRARY})
93   TARGET_LINK_LIBRARIES(${${PROJECT_NAME}SharedTarget} ${OPENGL_glu_LIBRARY})
94   TARGET_LINK_LIBRARIES(${${PROJECT_NAME}SharedTarget} ${OSG_NVSDK_COMMON_LIBRARY})
95     
96   IF(NOT WIN32)
97     TARGET_LINK_LIBRARIES(${${PROJECT_NAME}SharedTarget} ${GLUT_glut_LIBRARY})
98   ELSE()
99 #    TARGET_LINK_LIBRARIES(${${PROJECT_NAME}SharedTarget} ${OSG_GLUT_SHARED_LIBRARY})
100   ENDIF()
102   IF(WIN32)
103 #    TARGET_LINK_LIBRARIES(${${PROJECT_NAME}SharedTarget} ${OSG_GLEW_SHARED_LIBRARY})
104   ENDIF()
107   IF(WIN32)
108     INSTALL(TARGETS ${${PROJECT_NAME}SharedTarget}
109                     CONFIGURATIONS ${_OSG_INSTALL_CONFIGS}
110                     RUNTIME DESTINATION bin COMPONENT runtimes
111                     LIBRARY DESTINATION lib COMPONENT libraries
112                     ARCHIVE DESTINATION lib COMPONENT libraries)
114   ELSE(WIN32)
115     INSTALL(TARGETS ${${PROJECT_NAME}SharedTarget}
116                     RUNTIME DESTINATION lib${OSG_LIBDIR_SUFFIX} COMPONENT libraries
117                     LIBRARY DESTINATION lib${OSG_LIBDIR_SUFFIX} COMPONENT libraries
118                     ARCHIVE DESTINATION lib${OSG_LIBDIR_SUFFIX} COMPONENT libraries)
119   ENDIF(WIN32)
122   INSTALL(FILES ${OSG_CUDAUTIL_HDR} 
123           DESTINATION include${OSG_SUPPORT_INC_SUBDIR}/cuda
124           COMPONENT code_headers
125           PERMISSIONS OWNER_WRITE OWNER_READ
126                       GROUP_READ
127                       WORLD_READ)
129 #  IF(NOT WIN32)
130 #    INSTALL(FILES ${_OSGSUPP_DST_DIR}/GL/glew.h
131 #            DESTINATION include${OSG_SUPPORT_INC_SUBDIR}/cuda/GL
132 #            PERMISSIONS OWNER_WRITE OWNER_READ
133 #                        GROUP_READ
134 #                        WORLD_READ)
135 #  ENDIF(NOT WIN32)
137   SET(OSG_CUDA_UTIL_BUILD TRUE CACHE INTERNAL "" FORCE)
138   SET(OSG_CUDA_UTIL_INCLUDEDIR "${CMAKE_BINARY_DIR}/${OSG_SUPP_CC_BBASE}/CudaUtil/src" CACHE PATH "")
140 ELSE(OSGNVidiaSDKSrcDir)
141   SET(OSGNVidiaSDKSrcDir "" CACHE PATH "")
142 ENDIF(OSGNVidiaSDKSrcDir)