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)
14 SET(${PROJECT_NAME}SharedTarget osgcudautil)
17 SET(OSG_CUDAUTIL_PLT_SRC_INPUT stopwatch_linux.cpp)
19 SET(OSG_CUDAUTIL_PLT_SRC_INPUT stopwatch_win.cpp)
22 SET(OSG_CUDAUTIL_SRC_INPUT cutil.cpp
25 ${OSG_CUDAUTIL_PLT_SRC_INPUT})
28 SET(OSG_CUDAUTIL_PLT_HDR_INPUT stopwatch_linux.h)
30 SET(OSG_CUDAUTIL_PLT_HDR_INPUT stopwatch_win.h)
33 SET(OSG_CUDAUTIL_HDR_INPUT bank_checker.h
37 cutil_inline_bankchecker.h
38 cutil_inline_runtime.h
45 ${OSG_CUDAUTIL_PLT_HDR_INPUT})
49 SetupFiles(OSG_CUDAUTIL_SRC_INPUT
51 "${OSGNVidiaSDKSrcDir}/C/common/src"
52 "${OSG_SUPP_CC_BBASE}/CudaUtil/src")
54 SetupFiles(OSG_CUDAUTIL_HDR_INPUT
56 "${OSGNVidiaSDKSrcDir}/C/common/inc"
57 "${OSG_SUPP_CC_BBASE}/CudaUtil/src")
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)
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}")
72 SET(OSGCUDACOMLIB_DEF GL_GLEXT_PROTOTYPES=1)
78 ADD_LIBRARY(${${PROJECT_NAME}SharedTarget} SHARED ${OSG_CUDAUTIL_SRCS})
80 ADD_DEPENDENCIES(ALL_STANDARD_BUILD ${${PROJECT_NAME}SharedTarget})
83 SET_TARGET_PROPERTIES(${${PROJECT_NAME}SharedTarget} PROPERTIES
87 SET(OSGCUDACOMLIB_DEF_SHARED ${OSGCUDACOMLIB_DEF};BUILD_DLL)
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})
97 TARGET_LINK_LIBRARIES(${${PROJECT_NAME}SharedTarget} ${GLUT_glut_LIBRARY})
99 # TARGET_LINK_LIBRARIES(${${PROJECT_NAME}SharedTarget} ${OSG_GLUT_SHARED_LIBRARY})
103 # TARGET_LINK_LIBRARIES(${${PROJECT_NAME}SharedTarget} ${OSG_GLEW_SHARED_LIBRARY})
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)
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)
122 INSTALL(FILES ${OSG_CUDAUTIL_HDR}
123 DESTINATION include${OSG_SUPPORT_INC_SUBDIR}/cuda
124 COMPONENT code_headers
125 PERMISSIONS OWNER_WRITE OWNER_READ
130 # INSTALL(FILES ${_OSGSUPP_DST_DIR}/GL/glew.h
131 # DESTINATION include${OSG_SUPPORT_INC_SUBDIR}/cuda/GL
132 # PERMISSIONS OWNER_WRITE OWNER_READ
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)