MakeFramework.cmake.in 1.54 KB
Newer Older
1 2 3 4 5 6 7 8
#
# Before calling this, ensure that the following variables are set:
#
# VTK_DEVICE_LIBS - a path containing a wildcard suitable for globbing
# VTK_SIMULATOR_LIBS - a path containing a wildcard suitable for globbing
# VTK_INSTALLED_HEADERS - the path containing all headers for the framework
# CMAKE_FRAMEWORK_INSTALL_PREFIX - the path in which to make vtk.framework
#
9 10

# Make sure VTK is installed.
11
if (NOT EXISTS "@VTK_INSTALLED_HEADERS@")
12 13 14 15
  message(FATAL_ERROR
          "VTK not installed. Build the source then build the 'install' target.")
endif()

16
# Ensure a framework path is set
17
if (NOT EXISTS "@CMAKE_FRAMEWORK_INSTALL_PREFIX@")
18 19 20 21 22 23 24 25 26 27 28 29 30
  message(FATAL_ERROR
          "Please specifiy a CMAKE_FRAMEWORK_INSTALL_PREFIX.")
endif()

# Glob all input libs
file(GLOB VTK_LIB_GLOB
  "@VTK_DEVICE_LIBS@"
  "@VTK_SIMULATOR_LIBS@"
)

# Set framework output path
set(FRAMEWORK_PATH "@CMAKE_FRAMEWORK_INSTALL_PREFIX@/vtk.framework")

31 32 33
# Do these individually, as we don't want them piped
execute_process(COMMAND mkdir -p "${FRAMEWORK_PATH}")
execute_process(COMMAND mkdir -p "${FRAMEWORK_PATH}/Headers")
34
execute_process(COMMAND cp -r "@VTK_INSTALLED_HEADERS@/"
35 36
                              "${FRAMEWORK_PATH}/Headers/.")
execute_process(COMMAND libtool -static -o
37 38 39
                      "${FRAMEWORK_PATH}/vtk_lib"
                      ${VTK_LIB_GLOB})
execute_process(COMMAND lipo -create "${FRAMEWORK_PATH}/vtk_lib"
40
                             -output "${FRAMEWORK_PATH}/vtk")
41
execute_process(COMMAND rm "${FRAMEWORK_PATH}/vtk_lib")
42

43
message(STATUS "Created ${FRAMEWORK_PATH}")