-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathCMakeLists.txt
217 lines (173 loc) · 5.39 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
208
209
210
211
212
213
214
215
216
217
project(dirtchamber)
cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
set(CMAKE_MODULE_PATH
${CMAKE_SOURCE_DIR}/cmake
${CMAKE_MODULE_PATH})
find_package(Boost REQUIRED)
find_package(Assimp REQUIRED)
find_package(D3D REQUIRED)
find_package(DXUT REQUIRED)
find_package(OpenCV)
find_package(KinectSDK)
find_package(WMF)
# configure
set(D3D_LIBS
${D3D_D3D11_LIBRARY}
${D3D_D3DCompiler_LIBRARY}
${WINDOWS_SDK_USP10_LIBRARY}
${DXUT_LIBRARIES})
include_directories(
${Boost_INCLUDE_DIR}
${D3D_INCLUDE_DIR}
${WINDOWS_SDK_INCLUDE_DIR}
${DXUT_INCLUDE_DIRS}
${Assimp_INCLUDE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/src)
if(KINECTSDK_FOUND)
add_definitions(-D MICROSOFT_KINECT_SDK)
include_directories(${KinectSDK_INCLUDE_DIR})
endif()
if (OPENCV_FOUND)
add_definitions(-D OPENCV)
include_directories(${OpenCV_INCLUDE_DIR})
endif()
add_definitions(-D UNICODE)
add_definitions(-D NOMINMAX)
add_definitions(-D _WIN32_WINNT=0x0601)
# dune
file(GLOB_RECURSE ext_src src/ext/*)
source_group("Ext" FILES ${ext_src})
file(GLOB dune_src src/dune/* ${ext_src})
option(BUILD_WITH_WMF "Build with Windows Media Foundation support" ON)
set(dune_dir ${CMAKE_CURRENT_SOURCE_DIR}/src/dune)
if (NOT BUILD_WITH_WMF)
list(REMOVE_ITEM dune_src
${dune_dir}/video_gbuffer.h
${dune_dir}/video_gbuffer.cpp)
endif()
if (NOT KINECTSDK_FOUND)
list(REMOVE_ITEM dune_src
${dune_dir}/kinect_gbuffer.cpp
${dune_dir}/kinect_gbuffer.h)
endif()
if (NOT OPENCV_FOUND)
list(REMOVE_ITEM dune_src
${dune_dir}/tracker.cpp
${dune_dir}/tracker.h)
endif()
list(REMOVE_ITEM dune_src
${dune_dir}/sdk_mesh.cpp
${dune_dir}/sdk_mesh.h)
add_library(dune ${dune_src})
# shaders
file(GLOB hlsl_src shader/*.hlsl shader/common.h)
source_group("Shader Files" FILES ${hlsl_src})
set_source_files_properties(${hlsl_src} HEADER_FILE_ONLY TRUE EXTERNAL_OBJECT TRUE)
set(cso_dir ${CMAKE_BINARY_DIR}/cso)
file(MAKE_DIRECTORY ${cso_dir})
add_custom_target(cso
ALL
COMMAND ${CMAKE_SOURCE_DIR}/shader/compile.bat ${cso_dir}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/shader
DEPENDS ${cso_dir})
add_custom_target(shaders
COMMAND ${CMAKE_SOURCE_DIR}/shader/compile.bat ${cso_dir}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/shader
SOURCES ${hlsl_src})
# common files
set(common_src src/pppipe.cpp src/pppipe.h src/common_gui.cpp src/common_gui.h src/common_renderer.cpp src/common_renderer.h src/common_dxut.cpp src/common_dxut.h)
# lpv
add_executable(lpv WIN32 src/main_gi.cpp src/skydome.h ${common_src})
set_target_properties (lpv PROPERTIES COMPILE_DEFINITIONS "LPV")
target_link_libraries(lpv
dune
${D3D_LIBS}
${Assimp_LIBRARY}
comctl32.lib)
# vct
add_executable(vct WIN32 src/main_gi.cpp src/skydome.h ${common_src})
target_link_libraries(vct
dune
${D3D_LIBS}
${Assimp_LIBRARY}
comctl32.lib)
if(OPENCV_FOUND)
# dlpv kinect
add_executable(delta_lpv WIN32 src/main_gi_mr.cpp ${common_src})
set_target_properties (delta_lpv PROPERTIES COMPILE_DEFINITIONS "DLPV")
target_link_libraries(delta_lpv
dune
${D3D_LIBS}
${Assimp_LIBRARY}
${OpenCV_LIBRARIES}
comctl32.lib)
# dvct kinect
add_executable(delta_vct WIN32 src/main_gi_mr.cpp ${common_src})
target_link_libraries(delta_vct
dune
${D3D_LIBS}
${Assimp_LIBRARY}
${OpenCV_LIBRARIES}
comctl32.lib)
if(BUILD_WITH_WMF)
target_link_libraries(delta_vct ${WMF_LIBRARIES})
target_link_libraries(delta_lpv ${WMF_LIBRARIES})
endif()
if (KINECTSDK_FOUND)
target_link_libraries(delta_vct ${KinectSDK_LIBRARY})
target_link_libraries(delta_lpv ${KinectSDK_LIBRARY})
endif()
endif()
# documentation
include(Documentation)
if(BUILD_DOCUMENTATION AND DOXYGEN_EXECUTABLE)
set(doc_dir ${CMAKE_SOURCE_DIR}/doc)
add_custom_target(doc
ALL
COMMAND ${DOXYGEN_EXECUTABLE}
WORKING_DIRECTORY ${doc_dir})
if(DOCUMENTATION_HTML_HELP)
add_custom_command(TARGET doc
POST_BUILD
COMMAND ${HTML_HELP_COMPILER} html/index.hhp || (exit 0)
WORKING_DIRECTORY ${doc_dir})
endif()
endif()
# install
install(TARGETS lpv vct
DESTINATION bin/release)
install(DIRECTORY ${cso_dir}
DESTINATION shader)
install(FILES ${Assimp_BINARY_RELEASE}
DESTINATION bin/release)
if(NOT OPENCV_FOUND)
set(EXCLUDE_PATTERN
PATTERN "camera_parameters.xml" EXCLUDE
PATTERN "demo_gi_*" EXCLUDE
PATTERN "real_static_scene.png" EXCLUDE
PATTERN "marker.png" EXCLUDE
PATTERN "tracked" EXCLUDE)
endif()
install(DIRECTORY data
DESTINATION .
PATTERN "log.txt" EXCLUDE
${EXCLUDE_PATTERN})
install(DIRECTORY UI
DESTINATION .)
install(FILES ${CMAKE_SOURCE_DIR}/LICENSE
${CMAKE_SOURCE_DIR}/LICENSE.thirdparty
DESTINATION .)
if(BUILD_DOCUMENTATION AND DOCUMENTATION_HTML_HELP)
install(FILES ${CMAKE_SOURCE_DIR}/doc/html/index.chm
DESTINATION .
RENAME Documentation.chm)
else()
install(FILES ${CMAKE_SOURCE_DIR}/README.md
DESTINATION .)
endif()
if(OPENCV_FOUND)
install(TARGETS delta_lpv delta_vct
DESTINATION bin/release)
endif()
# create package
include(cmake/cpack/Package.cmake)