cmb.bundle.common.cmake 5.95 KB
Newer Older
Ben Boeckel's avatar
Ben Boeckel committed
1
2
# Consolidates platform independent stub for cmb.bundle.cmake files.

3
4
5
6
################################################################################
# Version information
################################################################################

Ben Boeckel's avatar
Ben Boeckel committed
7
8
include(cmb-version)
include(paraview-version)
9
include(smtk-version)
Ben Boeckel's avatar
Ben Boeckel committed
10

11
12
13
14
if (NOT DEFINED package_version_name)
  set(package_version_name cmb)
endif ()

15
16
17
18
################################################################################
# Package metadata
################################################################################

19
20
21
22
if (NOT DEFINED package_suffix)
  set(package_suffix "${CMB_PACKAGE_SUFFIX}")
endif ()

Ben Boeckel's avatar
Ben Boeckel committed
23
set(CPACK_PACKAGE_VENDOR "Kitware, Inc.")
24
25
26
set(CPACK_PACKAGE_VERSION_MAJOR ${${package_version_name}_version_major})
set(CPACK_PACKAGE_VERSION_MINOR ${${package_version_name}_version_minor})
set(CPACK_PACKAGE_VERSION_PATCH ${${package_version_name}_version_patch}${${package_version_name}_version_suffix})
27
28
if (package_suffix)
  set(CPACK_PACKAGE_VERSION_PATCH ${CPACK_PACKAGE_VERSION_PATCH}-${package_suffix})
29
endif ()
Ben Boeckel's avatar
Ben Boeckel committed
30

31
32
33
if (NOT DEFINED package_filename)
  set(package_filename "${CMB_PACKAGE_FILE_NAME}")
endif ()
Ben Boeckel's avatar
Ben Boeckel committed
34

35
36
37
if (package_filename)
  set(CPACK_PACKAGE_FILE_NAME "${package_filename}")
else ()
Ben Boeckel's avatar
Ben Boeckel committed
38
  set(CPACK_PACKAGE_FILE_NAME
39
    "${cmb_package_name}-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
40
41
42
43
endif ()

# Set the license file.
set(CPACK_RESOURCE_FILE_LICENSE
44
  "${superbuild_source_directory}/License.txt")
Ben Boeckel's avatar
Ben Boeckel committed
45

46
47
48
49
################################################################################
# Program selection
################################################################################

Ben Boeckel's avatar
Ben Boeckel committed
50
51
52
list(SORT cmb_programs_to_install)
list(REMOVE_DUPLICATES cmb_programs_to_install)

53
54
55
56
57
58
59
60
61
62
63
64
set(paraview_executables)
if (cmb_install_paraview_server)
  list(APPEND paraview_executables
    pvserver
    pvdataserver
    pvrenderserver)
endif ()
if (cmb_install_paraview_python)
  list(APPEND paraview_executables
    pvbatch
    pvpython)
endif ()
65

66
67
68
69
################################################################################
# Plugin file detection
################################################################################

70
71
72
73
74
75
76
77
78
79
80
81
82
83
function (extract_plugin_list varname pluginxml)
  file(STRINGS "${pluginxml}"
    plugin_lines
    REGEX "name=\"[A-Za-z0-9]+\"")
  set(plugin_names)
  foreach (plugin_line IN LISTS plugin_lines)
    string(REGEX REPLACE ".*name=\"\([A-Za-z0-9]+\)\".*" "\\1" plugin_name "${plugin_line}")
    list(APPEND plugin_names
      "${plugin_name}")
  endforeach ()
  set("${varname}"
    ${plugin_names}
    PARENT_SCOPE)
endfunction ()
84

85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
foreach (project IN LISTS projects_with_plugins)
  set(found_files)
  foreach (plugin_file IN LISTS "${project}_plugin_files")
    file(GLOB_RECURSE files
      RELATIVE ${superbuild_install_location}
      "${superbuild_install_location}/${plugin_dir}/*/${plugin_file}")
    if (files)
      message(STATUS "Found: ${files}")
      list(APPEND found_files ${files})
    else ()
      message(SEND_ERROR "Could not file ParaView XML ${plugin_file} ${files}")
    endif ()
  endforeach ()
  set("${project}_plugin_files" ${found_files})
endforeach ()
Ben Boeckel's avatar
Ben Boeckel committed
100

101
102
103
104
105
set(all_plugin_files)
foreach (project IN LISTS projects_with_plugins)
  if (NOT ${project}_enabled)
    continue ()
  endif ()
Ben Boeckel's avatar
Ben Boeckel committed
106

107
108
109
110
111
112
113
114
115
116
  foreach (plugin_file IN LISTS "${project}_plugin_files")
    list(APPEND all_plugin_files "${plugin_file}")
    extract_plugin_list("plugins_${plugin_file}" "${superbuild_install_location}/${plugin_file}")

    if (DEFINED "${project}_plugin_omit")
      list(REMOVE_ITEM "plugins_${plugin_file}"
        ${${project}_plugin_omit})
    endif ()
  endforeach ()
endforeach ()
117

118
119
120
121
122
set(cmb_additional_libraries)
foreach (boost_lib IN LISTS BOOST_ADDITIONAL_LIBRARIES)
  list(APPEND cmb_additional_libraries boost_${boost_lib})
endforeach ()

123
124
125
126
################################################################################
# Qt5 plugins
################################################################################

Ben Boeckel's avatar
Ben Boeckel committed
127
128
129
130
131
132
133
134
if (qt5_enabled)
  include(qt5.functions)

  set(qt5_plugin_prefix)
  if (NOT WIN32)
    set(qt5_plugin_prefix "lib")
  endif ()

135
  # Add SVG support, so cmb can use paraview SVG icons.
Ben Boeckel's avatar
Ben Boeckel committed
136
  set(qt5_plugins
137
138
    iconengines/${qt5_plugin_prefix}qsvgicon
    imageformats/${qt5_plugin_prefix}qsvg
Ben Boeckel's avatar
Ben Boeckel committed
139
140
141
142
143
    sqldrivers/${qt5_plugin_prefix}qsqlite)

  if (WIN32)
    list(APPEND qt5_plugins
      platforms/qwindows)
144
145
146

    if (NOT qt5_version VERSION_LESS "5.10")
      list(APPEND qt5_plugins
147
        styles/qwindowsvistastyle)
148
    endif ()
Ben Boeckel's avatar
Ben Boeckel committed
149
150
151
152
  elseif (APPLE)
    list(APPEND qt5_plugins
      platforms/libqcocoa
      printsupport/libcocoaprintersupport)
153
154
155
156
157

    if (NOT qt5_version VERSION_LESS "5.10")
      list(APPEND qt5_plugins
        styles/libqmacstyle)
    endif ()
Ben Boeckel's avatar
Ben Boeckel committed
158
159
160
161
162
163
164
165
166
167
168
169
  elseif (UNIX)
    list(APPEND qt5_plugins
      platforms/libqxcb
      platforminputcontexts/libcomposeplatforminputcontextplugin
      xcbglintegrations/libqxcb-glx-integration)
  endif ()

  superbuild_install_qt5_plugin_paths(qt5_plugin_paths ${qt5_plugins})
else ()
  set(qt5_plugin_paths)
endif ()

170
171
172
173
################################################################################
# Data files
################################################################################

174
175
176
177
178
179
180
181
182
function (cmb_install_pdf project filename)
  if (${project}_enabled)
    install(
      FILES       "${superbuild_install_location}/doc/${filename}"
      DESTINATION "${cmb_doc_dir}"
      COMPONENT   superbuild)
  endif ()
endfunction ()

183
184
185
186
187
188
189
190
191
function (cmb_install_data project filename)
  if (${project}_enabled)
    install(
      FILES       "${superbuild_install_location}/examples/${filename}"
      DESTINATION "${cmb_example_dir}"
      COMPONENT   superbuild)
  endif ()
endfunction ()

192
193
194
195
196
function (cmb_install_extra_data)
  if (cmb_doc_dir)
    cmb_install_pdf(cmbusersguide "CMBUsersGuide.pdf")
    cmb_install_pdf(smtkusersguide "SMTKUsersGuide.pdf")
  endif ()
197
198
199
  if (cmb_example_dir)
    cmb_install_data(aevaexampledata "aeva-example.zip")
  endif()
200
endfunction ()