-
Notifications
You must be signed in to change notification settings - Fork 40
/
external-project-macros.cmake
240 lines (216 loc) · 5.92 KB
/
external-project-macros.cmake
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
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
#
# force build macro
#
macro(force_build proj)
ExternalProject_Add_Step(${proj} forcebuild
COMMAND ${CMAKE_COMMAND} -E remove ${base}/Stamp/${proj}/${proj}-build
DEPENDEES configure
DEPENDERS build
ALWAYS 1
)
endmacro()
macro(get_toolchain_file tag)
string(REPLACE "-" "_" tag_with_underscore ${tag})
set(toolchain_file ${toolchain_${tag_with_underscore}})
endmacro()
macro(get_try_run_results_file tag)
string(REPLACE "-" "_" tag_with_underscore ${tag})
set(try_run_results_file ${try_run_results_${tag_with_underscore}})
endmacro()
#
# Eigen fetch and install
#
macro(install_eigen)
set(eigen_url http://www.vtk.org/files/support/eigen-3.1.0-alpha1.tar.gz)
set(eigen_md5 c04dedf4ae97b055b6dd2aaa01daf5e9)
ExternalProject_Add(
eigen
SOURCE_DIR ${source_prefix}/eigen
URL ${eigen_url}
URL_MD5 ${eigen_md5}
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory "${source_prefix}/eigen/Eigen" "${install_prefix}/eigen/Eigen" && ${CMAKE_COMMAND} -E copy_directory "${source_prefix}/eigen/unsupported" "${install_prefix}/eigen/unsupported"
)
endmacro()
#
# VTK fetch
#
macro(fetch_vtk)
ExternalProject_Add(
vtk-fetch
SOURCE_DIR ${source_prefix}/vtk
GIT_REPOSITORY git://github.com/patmarion/VTK.git
GIT_TAG ce4a267
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
)
endmacro()
#
# VTK compile
#
macro(compile_vtk)
set(proj vtk-host)
ExternalProject_Add(
${proj}
SOURCE_DIR ${source_prefix}/vtk
DOWNLOAD_COMMAND ""
INSTALL_COMMAND ""
DEPENDS vtk-fetch
CMAKE_ARGS
-DCMAKE_INSTALL_PREFIX:PATH=${install_prefix}/${proj}
-DCMAKE_BUILD_TYPE:STRING=${build_type}
-DBUILD_SHARED_LIBS:BOOL=ON
-DBUILD_TESTING:BOOL=OFF
${vtk_module_defaults}
)
endmacro()
#
# VTK crosscompile
#
macro(crosscompile_vtk tag)
set(proj vtk-${tag})
get_toolchain_file(${tag})
get_try_run_results_file(${proj})
ExternalProject_Add(
${proj}
SOURCE_DIR ${source_prefix}/vtk
DOWNLOAD_COMMAND ""
DEPENDS vtk-host
CMAKE_ARGS
-DCMAKE_INSTALL_PREFIX:PATH=${install_prefix}/${proj}
-DCMAKE_BUILD_TYPE:STRING=${build_type}
-DBUILD_SHARED_LIBS:BOOL=OFF
-DBUILD_TESTING:BOOL=OFF
-DCMAKE_TOOLCHAIN_FILE:FILEPATH=${toolchain_file}
-DVTKCompileTools_DIR:PATH=${build_prefix}/vtk-host
${vtk_module_defaults}
-C ${try_run_results_file}
)
endmacro()
#
# FLANN fetch
#
macro(fetch_flann)
ExternalProject_Add(
flann-fetch
SOURCE_DIR ${source_prefix}/flann
GIT_REPOSITORY git://github.com/mariusmuja/flann
GIT_TAG cee08ec38a8df7bc70397f10a4d30b9b33518bb4
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
)
endmacro()
#
# FLANN crosscompile
#
macro(crosscompile_flann tag)
set(proj flann-${tag})
get_toolchain_file(${tag})
ExternalProject_Add(
${proj}
SOURCE_DIR ${source_prefix}/flann
DOWNLOAD_COMMAND ""
DEPENDS flann-fetch
CMAKE_ARGS
-DCMAKE_INSTALL_PREFIX:PATH=${install_prefix}/${proj}
-DCMAKE_BUILD_TYPE:STRING=${build_type}
-DCMAKE_TOOLCHAIN_FILE:FILEPATH=${toolchain_file}
# -DBUILD_SHARED_LIBS:BOOL=OFF
-DBUILD_EXAMPLES:BOOL=OFF
-DBUILD_PYTHON_BINDINGS:BOOL=OFF
-DBUILD_MATLAB_BINDINGS:BOOL=OFF
)
force_build(${proj})
endmacro()
#
# Boost fetch
#
macro(fetch_boost)
ExternalProject_Add(
boost-fetch
SOURCE_DIR ${source_prefix}/boost
GIT_REPOSITORY git://github.com/patmarion/boost-build
GIT_TAG origin/master
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
)
endmacro()
#
# Boost crosscompile
#
macro(crosscompile_boost tag)
set(proj boost-${tag})
get_toolchain_file(${tag})
ExternalProject_Add(
${proj}
SOURCE_DIR ${source_prefix}/boost
DOWNLOAD_COMMAND ""
DEPENDS boost-fetch
CMAKE_ARGS
-DCMAKE_INSTALL_PREFIX:PATH=${install_prefix}/${proj}
-DCMAKE_BUILD_TYPE:STRING=${build_type}
-DCMAKE_TOOLCHAIN_FILE:FILEPATH=${toolchain_file}
-DBUILD_SHARED_LIBS:BOOL=OFF
)
force_build(${proj})
endmacro()
#
# PCL fetch
#
macro(fetch_pcl)
ExternalProject_Add(
pcl-fetch
SOURCE_DIR ${source_prefix}/pcl
GIT_REPOSITORY git://github.com/patmarion/PCL.git
GIT_TAG origin/android-tag
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
)
endmacro()
#
# PCL crosscompile
#
macro(crosscompile_pcl tag)
set(proj pcl-${tag})
get_toolchain_file(${tag})
get_try_run_results_file(${proj})
# copy the toolchain file and append the boost install dir to CMAKE_FIND_ROOT_PATH
set(original_toolchain_file ${toolchain_file})
get_filename_component(toolchain_file ${original_toolchain_file} NAME)
set(toolchain_file ${build_prefix}/${proj}/${toolchain_file})
configure_file(${original_toolchain_file} ${toolchain_file} COPYONLY)
file(APPEND ${toolchain_file}
"\nlist(APPEND CMAKE_FIND_ROOT_PATH ${install_prefix}/boost-${tag})\n")
ExternalProject_Add(
${proj}
SOURCE_DIR ${source_prefix}/pcl
DOWNLOAD_COMMAND ""
DEPENDS pcl-fetch boost-${tag} flann-${tag} eigen
CMAKE_ARGS
-DCMAKE_INSTALL_PREFIX:PATH=${install_prefix}/${proj}
-DCMAKE_BUILD_TYPE:STRING=${build_type}
-DCMAKE_TOOLCHAIN_FILE:FILEPATH=${toolchain_file}
-DBUILD_SHARED_LIBS:BOOL=OFF
-DPCL_SHARED_LIBS:BOOL=OFF
-DBUILD_visualization:BOOL=OFF
-DBUILD_examples:BOOL=OFF
-DEIGEN_INCLUDE_DIR=${install_prefix}/eigen
-DFLANN_INCLUDE_DIR=${install_prefix}/flann-${tag}/include
-DFLANN_LIBRARY=${install_prefix}/flann-${tag}/lib/libflann_cpp_s.a
-DBOOST_ROOT=${install_prefix}/boost-${tag}
-C ${try_run_results_file}
)
force_build(${proj})
endmacro()
macro(create_pcl_framework)
add_custom_target(pclFramework ALL
COMMAND ${CMAKE_SOURCE_DIR}/makeFramework.sh pcl
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
DEPENDS pcl-ios-device pcl-ios-simulator
COMMENT "Creating pcl.framework")
endmacro()