paraview.bundle.cmake 6.51 KB
Newer Older
1 2
include(paraview-appname)
set(paraview_doc_dir "${paraview_appname}/Contents/doc")
Cory Quammen's avatar
Cory Quammen committed
3
set(paraview_data_dir "${paraview_appname}/Contents/examples")
4
set(paraview_materials_dir "${paraview_appname}/Contents/materials")
5
set(paraview_plugin_path "lib/paraview-${paraview_version}/plugins")
Ben Boeckel's avatar
Ben Boeckel committed
6 7 8 9 10 11
include(paraview.bundle.common)

if (NOT paraview_has_gui)
  message(FATAL_ERROR "Creating the Apple package without the GUI is not supported.")
endif ()

Ben Boeckel's avatar
Ben Boeckel committed
12 13
set(paraview_plugin_paths)
foreach (paraview_plugin IN LISTS paraview_plugins)
Ben Boeckel's avatar
Ben Boeckel committed
14
  if (EXISTS "${superbuild_install_location}/Applications/paraview.app/Contents/Plugins/lib${paraview_plugin}.dylib")
Ben Boeckel's avatar
Ben Boeckel committed
15
    list(APPEND paraview_plugin_paths
Ben Boeckel's avatar
Ben Boeckel committed
16
      "${superbuild_install_location}/Applications/paraview.app/Contents/Plugins/lib${paraview_plugin}.dylib")
Ben Boeckel's avatar
Ben Boeckel committed
17 18 19
    continue ()
  endif ()

Ben Boeckel's avatar
Ben Boeckel committed
20
  foreach (path IN ITEMS "" "paraview-${paraview_version}" "paraview-${paraview_version}/plugins/${paraview_plugin}")
Ben Boeckel's avatar
Ben Boeckel committed
21 22 23 24
    if (EXISTS "${superbuild_install_location}/lib/${path}/lib${paraview_plugin}.dylib")
      list(APPEND paraview_plugin_paths
        "${superbuild_install_location}/lib/${path}/lib${paraview_plugin}.dylib")
      break ()
25 26 27 28
    elseif (EXISTS "${superbuild_install_location}/lib/${path}/${paraview_plugin}.so")
      list(APPEND paraview_plugin_paths
        "${superbuild_install_location}/lib/${path}/${paraview_plugin}.so")
      break ()
Ben Boeckel's avatar
Ben Boeckel committed
29 30 31 32
    endif ()
  endforeach ()
endforeach ()

33 34 35 36 37 38 39
set(include_regexes)
if (fortran_enabled)
  list(APPEND include_regexes
    ".*/libgfortran"
    ".*/libquadmath")
endif ()

Ben Boeckel's avatar
Ben Boeckel committed
40 41 42 43 44 45
set(additional_libraries)
if (ospray_enabled)
  list(APPEND additional_libraries
    "${superbuild_install_location}/lib/libospray_module_ispc.dylib")
endif ()

Ben Boeckel's avatar
Ben Boeckel committed
46 47
superbuild_apple_create_app(
  "\${CMAKE_INSTALL_PREFIX}"
48
  "${paraview_appname}"
Ben Boeckel's avatar
Ben Boeckel committed
49 50
  "${superbuild_install_location}/Applications/paraview.app/Contents/MacOS/paraview"
  CLEAN
Ben Boeckel's avatar
Ben Boeckel committed
51
  PLUGINS ${paraview_plugin_paths}
52
  SEARCH_DIRECTORIES "${superbuild_install_location}/lib"
Ben Boeckel's avatar
Ben Boeckel committed
53
  ADDITIONAL_LIBRARIES ${additional_libraries}
54
  INCLUDE_REGEXES     ${include_regexes})
Ben Boeckel's avatar
Ben Boeckel committed
55

Ben Boeckel's avatar
Ben Boeckel committed
56
set(plugins_file "${CMAKE_CURRENT_BINARY_DIR}/paraview.plugins")
57
paraview_add_plugin("${plugins_file}" ${paraview_plugins})
Ben Boeckel's avatar
Ben Boeckel committed
58 59 60

install(
  FILES       "${plugins_file}"
61
  DESTINATION "${paraview_appname}/Contents/Plugins"
Ben Boeckel's avatar
Ben Boeckel committed
62 63 64
  COMPONENT   superbuild
  RENAME      ".plugins")

Ben Boeckel's avatar
Ben Boeckel committed
65 66
install(
  FILES       "${superbuild_install_location}/Applications/paraview.app/Contents/Resources/pvIcon.icns"
67
  DESTINATION "${paraview_appname}/Contents/Resources"
Ben Boeckel's avatar
Ben Boeckel committed
68 69 70
  COMPONENT   superbuild)
install(
  FILES       "${superbuild_install_location}/Applications/paraview.app/Contents/Info.plist"
71
  DESTINATION "${paraview_appname}/Contents"
Ben Boeckel's avatar
Ben Boeckel committed
72 73 74 75 76 77 78 79 80
  COMPONENT   superbuild)

# Remove "paraview" from the list since we just installed it above.
list(REMOVE_ITEM paraview_executables
  paraview)

foreach (executable IN LISTS paraview_executables)
  superbuild_apple_install_utility(
    "\${CMAKE_INSTALL_PREFIX}"
81
    "${paraview_appname}"
82
    "${superbuild_install_location}/bin/${executable}"
83 84
    SEARCH_DIRECTORIES "${superbuild_install_location}/lib"
    INCLUDE_REGEXES     ${include_regexes})
Ben Boeckel's avatar
Ben Boeckel committed
85 86
endforeach ()

Ben Boeckel's avatar
Ben Boeckel committed
87
if (qt5_enabled)
88
  file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/qt.conf" "[Paths]\nPlugins = Plugins\n")
89 90
  install(
    FILES       "${CMAKE_CURRENT_BINARY_DIR}/qt.conf"
91
    DESTINATION "${paraview_appname}/Contents/Resources"
92 93
    COMPONENT   superbuild)
endif ()
Ben Boeckel's avatar
Ben Boeckel committed
94 95

if (python_enabled)
96
  file(GLOB egg_dirs
97
    "${superbuild_install_location}/lib/python${superbuild_python_version}/site-packages/*.egg/")
Ben Boeckel's avatar
Ben Boeckel committed
98 99
  superbuild_apple_install_python(
    "\${CMAKE_INSTALL_PREFIX}"
100
    "${paraview_appname}"
Ben Boeckel's avatar
Ben Boeckel committed
101 102
    MODULES paraview
            vtk
103
            vtkmodules
Ben Boeckel's avatar
Ben Boeckel committed
104 105 106
            ${python_modules}
    MODULE_DIRECTORIES
            "${superbuild_install_location}/Applications/paraview.app/Contents/Python"
107
            "${superbuild_install_location}/lib/python${superbuild_python_version}/site-packages"
108
            ${egg_dirs}
Ben Boeckel's avatar
Ben Boeckel committed
109
    SEARCH_DIRECTORIES
110 111
            "${superbuild_install_location}/Applications/paraview.app/Contents/Libraries"
            "${superbuild_install_location}/lib")
Ben Boeckel's avatar
Ben Boeckel committed
112 113 114

  if (matplotlib_enabled)
    install(
115
      DIRECTORY   "${superbuild_install_location}/lib/python${superbuild_python_version}/site-packages/matplotlib/mpl-data/"
116
      DESTINATION "${paraview_appname}/Contents/Python/matplotlib/mpl-data"
Ben Boeckel's avatar
Ben Boeckel committed
117 118 119 120
      COMPONENT   superbuild)
  endif ()
endif ()

121
if (mpi_built_by_superbuild)
Ben Boeckel's avatar
Ben Boeckel committed
122 123 124 125 126 127 128
  set(mpi_executables
    hydra_pmi_proxy
    mpiexec.hydra)

  foreach (mpi_executable IN LISTS mpi_executables)
    superbuild_apple_install_utility(
      "\${CMAKE_INSTALL_PREFIX}"
129
      "${paraview_appname}"
Ben Boeckel's avatar
Ben Boeckel committed
130
      "${superbuild_install_location}/bin/${mpi_executable}"
131 132
      SEARCH_DIRECTORIES "${superbuild_install_location}/lib"
      INCLUDE_REGEXES     ${include_regexes})
Ben Boeckel's avatar
Ben Boeckel committed
133 134
  endforeach ()

Ben Boeckel's avatar
Ben Boeckel committed
135
  install(CODE
Ben Boeckel's avatar
Ben Boeckel committed
136 137 138 139 140 141 142 143 144 145
    "foreach (mpi_executable IN ITEMS ${mpi_executables})
      configure_file(
        \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${paraview_appname}/Contents/bin/\${mpi_executable}\"
        \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${paraview_appname}/Contents/MacOS/\${mpi_executable}\"
        COPYONLY)
    endforeach ()
    file(RENAME
      \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${paraview_appname}/Contents/MacOS/mpiexec.hydra\"
      \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${paraview_appname}/Contents/MacOS/mpiexec\")
    file(RENAME
146 147
      \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${paraview_appname}/Contents/bin/mpiexec.hydra\"
      \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${paraview_appname}/Contents/bin/mpiexec\")"
Ben Boeckel's avatar
Ben Boeckel committed
148
    COMPONENT superbuild)
Ben Boeckel's avatar
Ben Boeckel committed
149 150
endif ()

151
# Configure ParaViewDMGSetup.scpt to replace the app name in the script.
152
configure_file(
153 154
  "${CMAKE_CURRENT_LIST_DIR}/files/ParaViewDMGSetup.scpt.in"
  "${CMAKE_CURRENT_BINARY_DIR}/ParaViewDMGSetup.scpt"
155 156
  @ONLY)

157
set(CPACK_DMG_BACKGROUND_IMAGE "${CMAKE_CURRENT_LIST_DIR}/files/ParaViewDMGBackground.tif")
158
set(CPACK_DMG_DS_STORE_SETUP_SCRIPT "${CMAKE_CURRENT_BINARY_DIR}/ParaViewDMGSetup.scpt")
159

Scott Wittenburg's avatar
Scott Wittenburg committed
160 161 162 163 164 165 166
if (paraviewweb_enabled)
  install(
    DIRECTORY   "${superbuild_install_location}/share/paraview/web"
    DESTINATION "${paraview_appname}/Contents/Resources"
    COMPONENT   "superbuild")
endif ()

Ben Boeckel's avatar
Ben Boeckel committed
167 168 169 170 171 172 173 174 175 176 177 178
foreach (qt5_plugin_path IN LISTS qt5_plugin_paths)
  get_filename_component(qt5_plugin_group "${qt5_plugin_path}" DIRECTORY)
  get_filename_component(qt5_plugin_group "${qt5_plugin_group}" NAME)

  superbuild_apple_install_module(
    "\${CMAKE_INSTALL_PREFIX}"
    "${paraview_appname}"
    "${qt5_plugin_path}"
    "Contents/Plugins/${qt5_plugin_group}"
    SEARCH_DIRECTORIES  "${library_paths}")
endforeach ()

179
paraview_install_extra_data()