-
Notifications
You must be signed in to change notification settings - Fork 3
/
CMakeLists.txt
executable file
·208 lines (169 loc) · 6.02 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
cmake_minimum_required(VERSION 3.1)
project(RGBDTracking)
set(RGBDTRACKING_MAJOR_VERSION 0)
set(RGBDTRACKING_MINOR_VERSION 1)
set(RGBDTRACKING_VERSION ${RGBDTRACKING_MAJOR_VERSION}.${RGBDTRACKING_MINOR_VERSION})
find_package(OpenCV)
option(WITH_CUDA FALSE)
set(HAVECUDA FALSE)
IF(WITH_CUDA)
find_package(CUDA)
IF(CUDA_FOUND)
MESSAGE(STATUS "CUDA found")
set(HAVECUDA TRUE)
ELSE(CUDA_FOUND)
MESSAGE(STATUS "CUDA not found")
ENDIF(CUDA_FOUND)
ELSE(WITH_CUDA)
MESSAGE(STATUS "Without CUDA")
ENDIF(WITH_CUDA)
find_package(image QUIET)
FIND_PACKAGE(VISP REQUIRED)
IF(VISP_FOUND)
INCLUDE(${VISP_USE_FILE})
ENDIF(VISP_FOUND)
LINK_DIRECTORIES(${VISP_LINK_DIRECTORIES})
message(STATUS ${VISP_INCLUDE_DIRS})
find_package(PCL 1.9 REQUIRED COMPONENTS)
link_directories(${PCL_LIBRARY_DIRS})
include_directories(BEFORE ${PCL_INCLUDE_DIRS})
add_definitions(${PCL_DEFINITIONS})
find_package(Boost COMPONENTS system filesystem REQUIRED)
set(ALL_LIBRARIES ${OpenCV_LIBS} freeimage ${FREEGLUT_LIBRARY} ${GLEW_LIBRARY} ${OPENGL_LIBRARIES} ${PCL_LIBRARIES} ${VISP_LIBRARIES})
set(HEADER_FILES
RGBDDataProcessing.h
RGBDDataProcessing.inl
DataIO.h
DataIO.inl
MeshProcessing.h
MeshProcessing.inl
ClosestPoint.h
ClosestPoint.inl
ClosestPointForceField.h
FeatureMatchingForceField.h
RenderTextureAR.h
RenderTextureAR.inl
RegistrationRigid.h
ImageConverter.h
ImageConverter.inl
#DataGeneration.h
segmentation.h
KalmanFilter.h
ccd.h
p_helper.h
RenderingManager.h
ShapeSpringsForceField.h
VirtualCamera.h
VirtualCamera.inl
DataSource.hpp
serialization.h
ZMQCommunication.h
)
set(SOURCE_FILES
initRGBDTracking.cpp
RegistrationRigid.cpp
ImageConverter.cpp
#DataGeneration.cpp
segmentation.cpp
KalmanFilter.cpp
ccd.cpp
RGBDDataProcessing.cpp
DataIO.cpp
MeshProcessing.cpp
RenderTextureAR.cpp
ClosestPoint.cpp
ClosestPointForceField.cpp
FeatureMatchingForceField.cpp
RenderingManager.cpp
ShapeSpringsForceField.cpp
VirtualCamera.cpp
ZMQCommunication.cpp
)
set(README_FILES rgbdtracking.txt)
if (HAVECUDA)
list(APPEND HEADER_FILES cudaSegmentation.h)
list(APPEND SOURCE_FILES cudaSegmentation.cpp)
set(CUDA_SOURCES
GrabcutGMM.cu
GrabcutHistogram.cu
GrabcutUtil.cu
#emicp.cu
)
set(${PROJECT_NAME}_INCLUDE_EXPORTS
${OpenCV_INCLUDE_DIRS}
${VISP_INCLUDE_DIR}
${VISP_INCLUDE_DIRS}
/usr/local/cuda-7.0/include/
/usr/local/cuda-7.0/samples/common/
/usr/local/cuda-7.0/samples/common/inc/
/usr/local/cuda-7.0/samples/7_CUDALibraries/common/UtilNPP/
)
# build options
set(GENCODE -gencode=arch=compute_30,code=sm_30 -gencode=arch=compute_35,code=compute_35)
set(GENCODE ${GENCODE} -gencode=arch=compute_20,code=sm_20)
set(GENCODE ${GENCODE} -gencode=arch=compute_11,code=sm_11)
# debug options
set(CUDA_NVCC_FLAGS_DEBUG "-G;-g")
set(CUDA_NVCC_FLAGS_RELEASE "-O2")
set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} \"-D_FORCE_INLINES\" ")
#Give current directory to nvcc compiler
cuda_include_directories(${CMAKE_CURRENT_SOURCE_DIR})
cuda_include_directories(${SOFA_FRAMEWORK_DIR})
cuda_include_directories(${SOFA_EXTLIBS_DIR})
cuda_include_directories(${SOFA_INC_DIR})
else(HAVECUDA)
set(${PROJECT_NAME}_INCLUDE_EXPORTS
${OpenCV_INCLUDE_DIRS}
${VISP_INCLUDE_DIR}
${VISP_INCLUDE_DIRS}
)
#Give current directory to nvcc compiler
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${SOFA_FRAMEWORK_DIR})
include_directories(${SOFA_EXTLIBS_DIR})
include_directories(${SOFA_INC_DIR})
endif(HAVECUDA)
set(CMAKE_CXX_FLAGS_DEBUG "-g")
set(CMAKE_CXX_FLAGS_RELEASE "-O2")
set_directory_properties( PROPERTIES COMPILE_DEFINITIONS "" )
## Specify additional locations of header files
## Your package locations should be listed before other locations
include_directories(
INCLUDE_DIRS ${${PROJECT_NAME}_INCLUDE_EXPORTS}
)
## RGBDTracking/config.h
configure_file(config.h.in "${CMAKE_BINARY_DIR}/include/RGBDTracking/config.h")
install(FILES "${CMAKE_BINARY_DIR}/include/RGBDTracking/config.h" DESTINATION "include/RGBDTracking")
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR})
# Config files and install rules for pythons scripts
sofa_set_python_directory(RGBDTracking "python")
#Get nvcc compiler to build the library
if(HAVECUDA)
cuda_add_library(${PROJECT_NAME} SHARED ${HEADER_FILES} ${SOURCE_FILES} ${CUDA_SOURCES} ${README_FILES} OPTIONS ${VERBOSE_PTXAS})
else(HAVECUDA)
add_library(${PROJECT_NAME} SHARED ${HEADER_FILES} ${SOURCE_FILES} ${README_FILES})
endif(HAVECUDA)
if(SOFA-CUDA_CUBLAS)
CUDA_ADD_CUBLAS_TO_TARGET(${PROJECT_NAME})
find_package(CUDASparse REQUIRED)
#message(STATUS CUDA_SPARSE_LIBRARY=${CUDA_SPARSE_LIBRARY})
target_link_libraries(${PROJECT_NAME} ${CUDA_SPARSE_LIBRARY} ${GENCODE})
endif()
target_link_libraries(${PROJECT_NAME} ${ALL_LIBRARIES} ${Boost_FILESYSTEM_LIBRARY} ${Boost_SYSTEM_LIBRARY} image SofaGuiQt SofaMeshCollision SofaMiscCollision SofaBaseCollision SofaGuiCommon SofaBaseVisual SofaExporter SofaLoader SofaMiscForceField SofaGeneralEngine -lzmq)
if (HAVECUDA)
target_link_libraries(${PROJECT_NAME} ${GENCODE} ${CUDA_LIBRARIES} ${CUDA_nppi_LIBRARY})
endif(HAVECUDA)
if(NOT ${SOFA_NO_OPENGL})
target_link_libraries(${PROJECT_NAME} SofaOpenglVisual)
endif()
target_include_directories(${PROJECT_NAME} PUBLIC "$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/include>")
target_include_directories(${PROJECT_NAME} PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>")
target_include_directories(${PROJECT_NAME} PUBLIC "$<INSTALL_INTERFACE:include>")
set_target_properties(${PROJECT_NAME} PROPERTIES VERSION ${RGBDTRACKING_VERSION})
set_target_properties(${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "-DSOFA_BUILD_RGBDTRACKING")
set_target_properties(${PROJECT_NAME} PROPERTIES PUBLIC_HEADER "${HEADER_FILES}")
set(RGBDTRACKING_COMPILER_FLAGS "-DSOFA_BUILD_RGBDTRACKING")
set_target_properties(${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "${RGBDTRACKING_COMPILER_FLAGS}")
## Install rules for the library; CMake package configurations files
sofa_create_package(RGBDTracking ${RGBDTRACKING_VERSION} RGBDTracking RGBDTracking)
install(DIRECTORY examples/ DESTINATION share/sofa/plugins/${PROJECT_NAME})