cmb.bundle.apple.cmake 5.58 KB
Newer Older
Ben Boeckel's avatar
Ben Boeckel committed
1
foreach(program IN LISTS cmb_programs_to_install)
2
  set(additional_libraries)
3
  set(plugins)
4
  set(plugin_paths)
5 6

  if (program STREQUAL "modelbuilder")
7 8 9 10 11
    # Install additional libraries in modelbuilder app
    foreach(library IN LISTS cmb_additional_libraries)
      list(APPEND additional_libraries "${superbuild_install_location}/lib/lib${library}.dylib")
    endforeach()

12 13 14 15 16 17
    # Install CMB plugins in modelbuilder app
    foreach(plugin IN LISTS cmb_plugins_cmb)
      list(APPEND plugin_paths "${superbuild_install_location}/Applications/modelbuilder.app/Contents/Plugins/lib${plugin}.dylib")
    endforeach()
    list(APPEND plugins ${cmb_plugins_cmb})

18 19
    # Install CMB plugins in modelbuilder app
    foreach(plugin IN LISTS cmb_plugins_standalone)
20
      list(APPEND plugin_paths "${superbuild_install_location}/lib/lib${plugin}.dylib")
21 22 23
    endforeach()
    list(APPEND plugins ${cmb_plugins_standalone})

24 25 26 27 28 29
    # Install paraview plugins in modelbuilder app
    foreach (plugin IN LISTS cmb_plugins_paraview)
      list(APPEND plugin_paths "${superbuild_install_location}/Applications/paraview.app/Contents/Plugins/lib${plugin}.dylib")
    endforeach()
    list(APPEND plugins ${cmb_plugins_paraview})
  endif()
30

Ben Boeckel's avatar
Ben Boeckel committed
31 32 33 34 35
  superbuild_apple_create_app(
    "\${CMAKE_INSTALL_PREFIX}/${cmb_package}"
    "${program}.app"
    "${superbuild_install_location}/Applications/${program}.app/Contents/MacOS/${program}"
    CLEAN
36
    PLUGINS ${plugin_paths}
37
    ADDITIONAL_LIBRARIES ${additional_libraries}
Ben Boeckel's avatar
Ben Boeckel committed
38 39
    SEARCH_DIRECTORIES
            "${superbuild_install_location}/lib")
40 41 42 43 44 45 46 47
  foreach (icon_filename MacIcon.icns pvIcon.icns)
    set(icon_path "${superbuild_install_location}/Applications/${program}.app/Contents/Resources/${icon_filename}")
    if (EXISTS "${icon_path}")
      install(
        FILES       "${icon_path}"
        DESTINATION "${cmb_package}/${program}.app/Contents/Resources"
        COMPONENT   superbuild)
    endif ()
Ben Boeckel's avatar
Ben Boeckel committed
48
  endforeach ()
49 50 51 52
  install(
    FILES       "${superbuild_install_location}/Applications/${program}.app/Contents/Info.plist"
    DESTINATION "${cmb_package}/${program}.app/Contents"
    COMPONENT   superbuild)
Ben Boeckel's avatar
Ben Boeckel committed
53

54 55 56 57 58 59 60 61 62
  foreach (executable IN LISTS paraview_executables)
    superbuild_apple_install_utility(
      "\${CMAKE_INSTALL_PREFIX}/${cmb_package}"
      "${program}.app"
      "${superbuild_install_location}/Applications/paraview.app/Contents/bin/${executable}"
      SEARCH_DIRECTORIES
              "${superbuild_install_location}/lib")
  endforeach ()

Ben Boeckel's avatar
Ben Boeckel committed
63 64 65 66 67
  install(CODE
    "file(MAKE_DIRECTORY \"\${CMAKE_INSTALL_PREFIX}/${cmb_package}/${program}.app/Contents/Resources\")
    file(WRITE \"\${CMAKE_INSTALL_PREFIX}/${cmb_package}/${program}.app/Contents/Resources/qt.conf\" \"\")"
    COMPONENT superbuild)

68 69 70
  set(plugins_file "${CMAKE_CURRENT_BINARY_DIR}/${program}.plugins")
  cmb_add_plugin("${plugins_file}" ${plugins})

Ben Boeckel's avatar
Ben Boeckel committed
71
  install(
72
    FILES       "${plugins_file}"
Ben Boeckel's avatar
Ben Boeckel committed
73
    DESTINATION "${cmb_package}/${program}.app/Contents/Plugins"
74 75
    COMPONENT   superbuild
    RENAME      ".plugins")
Ben Boeckel's avatar
Ben Boeckel committed
76 77 78 79

  superbuild_apple_install_python(
    "\${CMAKE_INSTALL_PREFIX}/${cmb_package}"
    "${program}.app"
80
    MODULES ${cmb_python_modules}
Ben Boeckel's avatar
Ben Boeckel committed
81 82 83 84
    MODULE_DIRECTORIES
            "${superbuild_install_location}/lib/python2.7/site-packages"
            "${superbuild_install_location}/Applications/paraview.app/Contents/Python"
    SEARCH_DIRECTORIES
85
            "${superbuild_install_location}/lib"
Ben Boeckel's avatar
Ben Boeckel committed
86
            "${superbuild_install_location}/Applications/paraview.app/Contents/Libraries")
87

88 89 90 91 92 93 94
  if (matplotlib_enabled)
    install(
      DIRECTORY   "${superbuild_install_location}/lib/python2.7/site-packages/matplotlib/mpl-data/"
      DESTINATION "${cmb_package}/${program}.app/Contents/Python/matplotlib/mpl-data"
      COMPONENT   superbuild)
  endif ()

95 96 97 98 99 100
  if (pythonrequests_enabled)
    install(
      FILES       "${superbuild_install_location}/lib/python2.7/site-packages/requests/cacert.pem"
      DESTINATION "${cmb_package}/${program}.app/Contents/Python/requests"
      COMPONENT   superbuild)
  endif ()
101 102 103 104

  if (paraviewweb_enabled)
    install(
      FILES       "${superbuild_install_location}/Applications/paraview.app/Contents/Python/paraview/web/defaultProxies.json"
105
      DESTINATION "${cmb_package}/${program}.app/Contents/Python/paraview/web"
106 107 108
      COMPONENT   "superbuild")
    install(
      DIRECTORY   "${superbuild_install_location}/share/paraview/web"
109
      DESTINATION "${cmb_package}/${program}.app/Contents/Resources"
110 111
      COMPONENT   "superbuild")
  endif ()
Ben Boeckel's avatar
Ben Boeckel committed
112 113 114 115 116 117 118 119 120 121 122 123

  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}/${cmb_package}"
      "${program}.app"
      "${qt5_plugin_path}"
      "Contents/Plugins/${qt5_plugin_group}"
      SEARCH_DIRECTORIES  "${library_paths}")
  endforeach ()
124

125 126 127 128 129 130
  if (cmb_doc_base_dir)
    set(cmb_doc_dir "${cmb_package}/${program}.app/${cmb_doc_base_dir}")
  endif ()

  # Install PDF guides.
  cmb_install_extra_data()
Ben Boeckel's avatar
Ben Boeckel committed
131 132 133 134 135 136 137
endforeach ()

# FIXME: Install inside of each application?
install(
  DIRECTORY   "${superbuild_install_location}/share/cmb/workflows/"
  DESTINATION "Workflows"
  COMPONENT   superbuild)
138 139 140 141 142 143 144 145 146 147 148 149

if (meshkit_enabled)
  foreach (meshkit_exe IN ITEMS coregen assygen)
    superbuild_apple_install_utility(
      "\${CMAKE_INSTALL_PREFIX}/${cmb_package}"
      "modelbuilder.app"
      "${superbuild_install_location}/bin/${meshkit_exe}"
      SEARCH_DIRECTORIES  "${library_paths}"
      FRAMEWORK_DEST      "Frameworks/meshkit"
      LIBRARY_DEST        "Libraries/meshkit")
  endforeach ()
endif ()