File: CMakeLists.txt

package info (click to toggle)
activiz.net 1%3A1.0~git20111214-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 11,280 kB
  • ctags: 5,957
  • sloc: cs: 28,767; python: 915; cpp: 130; makefile: 35; sh: 11
file content (351 lines) | stat: -rw-r--r-- 9,747 bytes parent folder | download | duplicates (2)
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
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
##############################################################################
# A SuperBuild for ActiViz .NET and its pre-requisites

cmake_minimum_required(VERSION 2.8.6 FATAL_ERROR)
project(ActiVizDotNetSuperBuild NONE)

include(ExternalProject)
include(CTest)


##############################################################################
# ActiViz .NET requires tools, data and libraries.
#
# Tools: (these must be installed before configuring this SuperBuild)
#   cmake 2.8.6 or later
#   python 2.6 or later
#   cvs
#   git
#
#
# The following are all built by this SuperBuild before ActiViz .NET:
#
# Tools:
#   gccxml
#   mummy (depends on gccxml)
#
# Data:
#   VTKData
#
# Libraries:
#   VTK (depends on VTKData)
#
#
# If doxygen is installed, the mummy build will include some doxygen
# generated docs.
#
# Python must be installed in order to configure ActiViz .NET: the test suite
# has some tests that are generated using python scripts.


##############################################################################
# CMAKE_GENERATOR restriction
#
# On Windows, with the 32-bit Visual Studio generators, this SuperBuild
# includes targets for both 32-bit and 64-bit VTK and ActiViz .NET.
#
# The mummy build also includes both 32-bit and 64-bit outputs when
# configured with the 32-bit generators. Therefore, we disallow the Win64
# generators.
#
# gccxml and mummy are built with the chosen CMAKE_GENERATOR. When the
# generator matches "Visual Studio" VTK and ActiViz .NET get targets with
# both "${CMAKE_GENERATOR}" and "${CMAKE_GENERATOR} Win64"...

if(CMAKE_GENERATOR MATCHES "Win64")
  set(msg "Do not use a Win64 generator with the ActiViz .NET SuperBuild.")
  set(msg "${msg} The SuperBuild includes targets for both x86 and x64 when")
  set(msg "${msg} you use the non-Win64 generator...")
  message(FATAL_ERROR "${msg}")
endif()

set(AVSB_build_x64_targets OFF)
if(CMAKE_GENERATOR MATCHES "Visual Studio")
  set(AVSB_build_x64_targets ON)
endif()


##############################################################################
# Versions this SuperBuild references:

set(gccxml_version "2011-11-03 01:00:00 UTC")
set(mummy_version "1.0.2")

set(vtk_version "5.8.0")
if(NOT "$ENV{AVSB_VTK_VERSION}" STREQUAL "")
  set(vtk_version "$ENV{AVSB_VTK_VERSION}")
endif()

set(vtk_git_tag "v${vtk_version}")
if(NOT "$ENV{AVSB_VTK_GIT_TAG}" STREQUAL "")
  set(vtk_git_tag "$ENV{AVSB_VTK_GIT_TAG}")
endif()

set(vtkdata_git_tag "v${vtk_version}-data")
if(NOT "$ENV{AVSB_VTKDATA_GIT_TAG}" STREQUAL "")
  set(vtkdata_git_tag "$ENV{AVSB_VTKDATA_GIT_TAG}")
endif()


##############################################################################
# SuperBuild options:

option(BUILD_SHARED_LIBS "Build pre-requisite libs as shared libraries" ON)
option(AVSB_BUILD_FOR_REDIST "Strong-name sign build products, create installers" ON)
set(AVSB_SNKEYFILE "" CACHE FILEPATH "Strong name signing key")


##############################################################################
# Double checks:

set(avdn_redist_args "")

if(AVSB_BUILD_FOR_REDIST)
  set(avdn_redist_args "-DAVDN_BUILD_CSHARP_DEBUG:BOOL=OFF")

  if(NOT AVSB_SNKEYFILE)
    set(msg "Empty AVSB_SNKEYFILE value, C# dlls will not be correctly")
    set(msg "${msg} strong-name signed...")
    message(AUTHOR_WARNING "${msg}")
      # If this warning is emitted, the mummy and ActiViz .NET test suites
      # will not run correctly on this machine unless strong name validation
      # is disabled...
  endif()
endif()


##############################################################################
# gccxml

ExternalProject_Add(gccxml
  CVS_REPOSITORY ":pserver:anoncvs:@www.gccxml.org:/cvsroot/GCC_XML"
  CVS_MODULE gccxml
  CVS_TAG -D "${gccxml_version}"
  UPDATE_COMMAND "" # update unnecessary, because it's a fixed static tag
  CMAKE_ARGS
    -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
)

ExternalProject_Get_Property(gccxml binary_dir)
set(gccxml_binary_dir "${binary_dir}")

ExternalProject_Get_Property(gccxml install_dir)
set(gccxml_dir "${install_dir}")
set(gccxml_exe "${gccxml_dir}/bin/gccxml")

if(WIN32)
  ExternalProject_Add_Step(gccxml gccxml_clean_install
    COMMAND ${CMAKE_COMMAND} -E remove_directory ${gccxml_dir}/bin
    COMMAND ${CMAKE_COMMAND} -E remove_directory ${gccxml_dir}/share
    WORKING_DIRECTORY ${gccxml_dir}
    DEPENDEES build # happens after build...
    DEPENDERS install # ...but before install
  )

  ExternalProject_Add_Step(gccxml gccxml_vcconfig
    COMMAND gccxml_vcconfig.bat
    WORKING_DIRECTORY ${gccxml_dir}/bin
    DEPENDEES install
  )
endif()


##############################################################################
# mummy

set(mummy_keyfile_args "")
if(AVSB_SNKEYFILE)
  set(mummy_keyfile_args "-DMummy_SNKEYFILE:FILEPATH=${AVSB_SNKEYFILE}")
endif()

ExternalProject_Add(mummy
  GIT_REPOSITORY "git://public.kitware.com/mummy.git"
  GIT_TAG "v${mummy_version}"
  UPDATE_COMMAND "" # update unnecessary, because it's a fixed static tag
  CMAKE_ARGS
    -Dgccxml_EXECUTABLE:FILEPATH=${gccxml_exe}
    -DMummy_INSTALL_PREFIX:PATH=<INSTALL_DIR>
    ${mummy_keyfile_args}
  DEPENDS gccxml
)

ExternalProject_Get_Property(mummy binary_dir)
set(mummy_binary_dir "${binary_dir}")

ExternalProject_Get_Property(mummy install_dir)
set(mummy_dir "${install_dir}/share/mummy-${mummy_version}")


##############################################################################
# VTKData

ExternalProject_Add(vtkdata
  GIT_REPOSITORY "git://vtk.org/VTKData.git"
  GIT_TAG "${vtkdata_git_tag}"
  UPDATE_COMMAND "" # update unnecessary, because it's a fixed static tag
  CONFIGURE_COMMAND ""
  BUILD_COMMAND ""
  INSTALL_COMMAND ""
)

ExternalProject_Get_Property(vtkdata source_dir)
set(vtkdata_dir "${source_dir}")


##############################################################################
# VTK

ExternalProject_Add(vtksource
  GIT_REPOSITORY "git://vtk.org/VTK.git"
  GIT_TAG "${vtk_git_tag}"
  UPDATE_COMMAND "" # update unnecessary, because it's a fixed static tag
  CONFIGURE_COMMAND ""
  BUILD_COMMAND ""
  INSTALL_COMMAND ""
  DEPENDS
    vtkdata
)

ExternalProject_Get_Property(vtksource source_dir)
set(vtksource_dir "${source_dir}")

function(build_vtk suffix generator)
  ExternalProject_Add(vtk${suffix}
    SOURCE_DIR "${vtksource_dir}"
    DOWNLOAD_COMMAND ""
    UPDATE_COMMAND ""
    CMAKE_ARGS
      -DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS}
      -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
      -DVTK_DATA_ROOT:PATH=${vtkdata_dir}
      -DVTK_DEBUG_LEAKS:BOOL=OFF
      -DVTK_USE_PARALLEL:BOOL=ON
    CMAKE_GENERATOR ${generator}
    INSTALL_COMMAND ""
    DEPENDS
      vtksource
  )
endfunction()

build_vtk("" "${CMAKE_GENERATOR}")

if(AVSB_build_x64_targets)
  build_vtk("_x64" "${CMAKE_GENERATOR} Win64")
endif()


##############################################################################
# avdn

get_filename_component(dir "${CMAKE_CURRENT_LIST_FILE}" PATH)
get_filename_component(avdn_source_dir "${dir}" PATH)
message(STATUS "avdn_source_dir='${avdn_source_dir}'")

set(avdn_keyfile_args "")
if(AVSB_SNKEYFILE)
  set(avdn_keyfile_args "-DAVDN_SNKEYFILE:FILEPATH=${AVSB_SNKEYFILE}")
endif()

function(build_avdn suffix generator)
  ExternalProject_Get_Property(vtk${suffix} binary_dir)
  set(vtk_dir "${binary_dir}")

  ExternalProject_Add(avdn${suffix}
    DOWNLOAD_COMMAND ""
    UPDATE_COMMAND ""
    SOURCE_DIR "${avdn_source_dir}"
    CMAKE_ARGS
      -DAVDN_INSTALL_PREFIX:PATH=<INSTALL_DIR>
      ${avdn_keyfile_args}
      ${avdn_redist_args}
      -Dgccxml_EXECUTABLE:FILEPATH=${gccxml_exe}
      -DMummy_DIR:PATH=${mummy_dir}
      -DVTK_DIR:PATH=${vtk_dir}
    CMAKE_GENERATOR ${generator}
    INSTALL_COMMAND ""
    DEPENDS
      mummy
      vtk${suffix}
  )
endfunction()

build_avdn("" "${CMAKE_GENERATOR}")

if(AVSB_build_x64_targets)
  build_avdn("_x64" "${CMAKE_GENERATOR} Win64")
endif()


##############################################################################
# Installers

function(build_installer proj)
  ExternalProject_Get_Property(${proj} binary_dir)
  set(proj_dir "${binary_dir}")

  ExternalProject_Add(${proj}-installer
    BINARY_DIR "${proj_dir}"
    DOWNLOAD_COMMAND ""
    UPDATE_COMMAND ""
    CONFIGURE_COMMAND ""
    BUILD_COMMAND ${CMAKE_COMMAND}
      --build ${proj_dir} --config ${CMAKE_CFG_INTDIR} --target package
    INSTALL_COMMAND ${CMAKE_COMMAND} -E echo
      "The '${proj}' installer is now available in '${proj_dir}'"
    DEPENDS
      ${proj}
  )
endfunction()

build_installer(gccxml)
build_installer(mummy)

build_installer(avdn)

if(AVSB_build_x64_targets)
  build_installer(avdn_x64)
endif()


##############################################################################
# Tests

include(ProcessorCount)
ProcessorCount(num_procs)

function(add_test_suite proj)
  ExternalProject_Get_Property(${proj} binary_dir)
  set(dir "${binary_dir}")

  add_test(NAME ${proj}-tests
    COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> -j ${num_procs}
      -D ExperimentalTest --output-on-failure
    WORKING_DIRECTORY ${dir}
  )

  # Since we're using all processors to run the target test suite in "full
  # parallel," run this "test" (which is actually a full suite of tests for
  # the named target) by itself:

  set_property(TEST ${proj}-tests PROPERTY RUN_SERIAL ON)
endfunction()

add_test_suite(gccxml)
add_test_suite(mummy)
add_test_suite(vtk)
add_test_suite(avdn)

if(AVSB_build_x64_targets)
  add_test_suite(vtk_x64)
  add_test_suite(avdn_x64)
endif()


##############################################################################
# Log all variable values:

#message(STATUS "========== VARIABLES ==========")
#get_cmake_property(vs VARIABLES)
#foreach(v ${vs})
#  message(STATUS "${v}='${${v}}'")
#endforeach()