Commit f0dc5bdd authored by Ryan Krattiger's avatar Ryan Krattiger
Browse files

SUPERBUILD_PACKAGE_MODE=modelbuilder

Updated modelbuilder packaging to use new SuperbuildPackageMacros.
Moved cmb.*.bundle.cmake to packages/
Added modelbuilder.configure.cmake to configure packaging settings
Added bundle script generator to be used for generating
<package>.bundle.cmake files for CMB
Updated projects with ParaView plugins to declare plugin files that
should be installed with the project
parent 97e50811
# Configure the vtkonly build.
set(ENABLE_cmb "OFF" CACHE BOOL "")
set(SUPERBUILD_PACKAGE_MODE "<none>" CACHE STRING "")
# matplotlib is not necessary, but this is as good a place as any to test it
set(ENABLE_matplotlib "ON" CACHE BOOL "")
set(ENABLE_paraview "OFF" CACHE BOOL "")
......
......@@ -13,102 +13,69 @@ endif ()
list(INSERT CMAKE_MODULE_PATH 0
"${CMAKE_CURRENT_LIST_DIR}/cmake")
macro (superbuild_setup_variables)
include(SuperbuildVersionMacros)
macro(set_cmb_python_modules)
set(cmb_python_modules
smtk
paraview
cinema_python
pygments
six
vtk
vtkmodules)
if (cmb_SOURCE_SELECTION STREQUAL "git")
# Assuming master; just use the latest version, but let the user set their
# own version in case it is actually a branch from some other version.
set(CMB_VERSION_DEFAULT "<FETCH_FROM_GIT>"
CACHE STRING "The default version of CMB to use if it cannot be detected")
if (CMB_VERSION_DEFAULT STREQUAL "<FETCH_FROM_GIT>")
include(cmbVersion)
set(CMB_VERSION_DEFAULT "${cmb_version_major}.${cmb_version_minor}.${cmb_version_patch}")
if (matplotlib_enabled)
list(APPEND cmb_python_modules
matplotlib)
endif ()
mark_as_advanced(CMB_VERSION_DEFAULT)
set(cmb_default_version "${CMB_VERSION_DEFAULT}")
elseif (cmb_SOURCE_SELECTION STREQUAL "source")
# If it is a git repo, we'll get it that way. Otherwise, we will look at the
# `version.txt` in the checkout.
set(cmb_default_version "")
else ()
# The selection is the version number; use it.
set(cmb_default_version "${cmb_SOURCE_SELECTION}")
endif()
superbuild_set_version_variables(cmb "${cmb_default_version}" "cmb-version.cmake" "version.txt")
set(cmb_version "${cmb_version_major}.${cmb_version_minor}")
if (smtk_SOURCE_SELECTION STREQUAL "git")
# Assuming master; just use the latest version, but let the user set their
# own version in case it is actually a branch from some other version.
set(SMTK_VERSION_DEFAULT "<FETCH_FROM_GIT>"
CACHE STRING "The default version of SMTK to use if it cannot be detected")
if (SMTK_VERSION_DEFAULT STREQUAL "<FETCH_FROM_GIT>")
include(smtkVersion)
set(SMTK_VERSION_DEFAULT "${smtk_version_major}.${smtk_version_minor}.${smtk_version_patch}")
endif ()
mark_as_advanced(SMTK_VERSION_DEFAULT)
set(smtk_default_version "${SMTK_VERSION_DEFAULT}")
elseif (smtk_SOURCE_SELECTION STREQUAL "source")
# If it is a git repo, we'll get it that way. Otherwise, we will look at the
# `version.txt` in the checkout.
set(smtk_default_version "")
else ()
# The selection is the version number; use it.
set(smtk_default_version "${smtk_SOURCE_SELECTION}")
endif()
superbuild_set_version_variables(smtk "${smtk_default_version}" "smtk-version.cmake" "version.txt")
set(smtk_version "${smtk_version_major}.${smtk_version_minor}")
if (paraview_SOURCE_SELECTION STREQUAL "git")
include(paraviewVersion)
set(paraview_default_version "${paraview_version_major}.${paraview_version_minor}.${paraview_version_patch}")
elseif (paraview_SOURCE_SELECTION STREQUAL "master")
# Assuming master; just use the latest version, but let the user set their
# own version in case it is actually a branch from some other version.
set(PARAVIEW_VERSION_DEFAULT "<FETCH_FROM_GIT>"
CACHE STRING "The default version of ParaView to use if it cannot be detected")
if (PARAVIEW_VERSION_DEFAULT STREQUAL "<FETCH_FROM_GIT>")
include(paraviewVersion)
set(PARAVIEW_VERSION_DEFAULT "${paraview_version_major}.${paraview_version_minor}.${paraview_version_patch}")
if (numpy_enabled)
list(APPEND cmb_python_modules
numpy)
endif ()
mark_as_advanced(PARAVIEW_VERSION_DEFAULT)
set(paraview_default_version "${PARAVIEW_VERSION_DEFAULT}")
elseif (paraview_SOURCE_SELECTION STREQUAL "for-v6.3.0")
include(paraviewVersion)
set(paraview_default_version "${paraview_version_major}.${paraview_version_minor}.${paraview_version_patch}")
elseif (paraview_SOURCE_SELECTION STREQUAL "source")
# If it is a git repo, we'll get it that way. Otherwise, we will look at the
# `version.txt` in the checkout.
set(paraview_default_version "")
if (pythongirderclient_enabled)
list(APPEND cmb_python_modules
diskcache
requests
requests_toolbelt
girder_client)
endif ()
superbuild_set_version_variables(paraview "${paraview_default_version}" "paraview-version.cmake" "version.txt")
set(paraview_version "${paraview_version_major}.${paraview_version_minor}")
superbuild_set_version_variables(vtk "9.0.0" "vtk-version.cmake")
set(vtk_version "${vtk_version_major}.${vtk_version_minor}")
if (paraviewweb_enabled)
list(APPEND cmb_python_modules
autobahn
constantly
incremental
twisted
wslink
zope)
if (aeva_SOURCE_SELECTION STREQUAL "git")
# Assuming master; just use the latest version, but let the user set their
# own version in case it is actually a branch from some other version.
set(AEVA_VERSION_DEFAULT "<FETCH_FROM_GIT>"
CACHE STRING "The default version of AEVA to use if it cannot be detected")
if (AEVA_VERSION_DEFAULT STREQUAL "<FETCH_FROM_GIT>")
include(aevaVersion)
set(AEVA_VERSION_DEFAULT "${aeva_version_major}.${aeva_version_minor}.${aeva_version_patch}")
if (WIN32)
list(APPEND cmb_python_modules
adodbapi
isapi
pythoncom
win32com)
endif ()
mark_as_advanced(AEVA_VERSION_DEFAULT)
set(aeva_default_version "${AEVA_VERSION_DEFAULT}")
elseif (aeva_SOURCE_SELECTION STREQUAL "source")
# If it is a git repo, we'll get it that way. Otherwise, we will look at the
# `version.txt` in the checkout.
set(aeva_default_version "")
else ()
# The selection is the version number; use it.
set(aeva_default_version "${aeva_SOURCE_SELECTION}")
endif ()
get_property(has_extra_python_modules GLOBAL PROPERTY cmb_extra_python_modules SET)
if(has_extra_python_modules)
get_property(extra_python_modules GLOBAL PROPERTY cmb_extra_python_modules)
list(APPEND cmb_python_modules
${extra_python_modules})
endif()
superbuild_set_version_variables(aeva "${aeva_default_version}" "aeva-version.cmake" "version.txt")
set(aeva_version "${aeva_version_major}.${aeva_version_minor}")
endmacro()
macro (superbuild_setup_variables)
include(SuperbuildVersionMacros)
superbuild_configure_project_version(cmb)
superbuild_configure_project_version(smtk)
superbuild_configure_project_version(paraview "for-v6.3.0" "master")
superbuild_set_version_variables(vtk "9.0.0" "vtk-version.cmake")
set(vtk_version "${vtk_version_major}.${vtk_version_minor}")
endmacro ()
function (superbuild_find_projects var)
......@@ -204,12 +171,6 @@ function (superbuild_find_projects var)
smtkresourcemanagerstate)
endif ()
list(APPEND projects
aeva
aevasession
aevaexampledata
)
# For now it's a convenient option to control smtk documentation.
option(ENABLE_DOCUMENTATION "Enable smtk documentation" ON)
......@@ -242,14 +203,28 @@ function (superbuild_sanity_check)
message(FATAL_ERROR
"Only one of the following projects should be enabled: vtkonly, paraview.")
endif ()
if (NOT smtk_enabled AND NOT cmb_enabled AND NOT aeva_enabled)
if (NOT smtk_enabled AND NOT cmb_enabled)
message(FATAL_ERROR
"At least one of the following projects must be enabled: cmb, smtk, aeva.")
"At least one of the following projects must be enabled: cmb, or smtk.")
endif ()
if (NOT SUPERBUILD_PACKAGE_MODE STREQUAL "<none>")
get_property(not_sane GLOBAL PROPERTY ${SUPERBUILD_PACKAGE_MODE}_REQUIRED_PROJECTS SET)
get_property(package_required_projects GLOBAL PROPERTY ${SUPERBUILD_PACKAGE_MODE}_REQUIRED_PROJECTS)
foreach (project IN LISTS package_required_projects)
if (${project}_enabled)
set(not_sane FALSE)
endif ()
endforeach ()
if (not_sane)
string(REPLACE ";" ", " required_projects "${package_required_projects}")
message(FATAL_ERROR
"At least one of the following projects must be enabled: ${require_projects}.")
endif ()
endif()
endfunction ()
function (superbuild_add_packaging)
if (NOT (cmb_enabled OR aeva_enabled) OR DEVELOPER_MODE_cmb)
if (SUPERBUILD_PACKAGE_MODE STREQUAL "<none>" OR DEVELOPER_MODE_cmb)
return ()
endif ()
......@@ -264,6 +239,9 @@ function (superbuild_add_packaging)
TGZ)
endif ()
set_cmb_python_modules()
list(APPEND superbuild_export_variables cmb_python_modules)
# Force qt SVG support, so CMB/ParaView can use SVG icons
set(qt5_ENABLE_SVG ON CACHE INTERNAL "CMB/ParaView requires SVG support")
......@@ -282,50 +260,39 @@ function (superbuild_add_packaging)
list(APPEND superbuild_export_variables
BOOST_ADDITIONAL_LIBRARIES)
if (cmb_enabled)
include(cmb.suffix)
include(package.test)
get_property(PACKAGE_LABELS GLOBAL PROPERTY "${SUPERBUILD_PACKAGE_MODE}_PACKAGE_LABELS")
get_property(PACKAGE_SUFFIX GLOBAL PROPERTY "${SUPERBUILD_PACKAGE_MODE}_PACKAGE_SUFFIX")
superbuild_package_suffix(PACKAGE_SUFFIX)
list(APPEND superbuild_export_variables
CMB_PACKAGE_SUFFIX)
PACKAGE_SUFFIX)
set(CMB_PACKAGE_FILE_NAME ""
set("${SUPERBUILD_PACKAGE_MODE}_PACKAGE_FILE_NAME" ""
CACHE STRING "If set, overrides the generated filename for the package")
set(PACKAGE_FILE_NAME ${SUPERBUILD_PACKAGE_MODE}_PACKAGE_FILE_NAME)
list(APPEND superbuild_export_variables
CMB_PACKAGE_FILE_NAME)
PACKAGE_FILE_NAME)
foreach (generator IN LISTS generators)
superbuild_add_extra_package_test(modelbuilder "${generator}"
LABELS "CMB"
superbuild_add_extra_package_test(${SUPERBUILD_PACKAGE_MODE} "${generator}"
LABELS "${PACKAGE_LABELS}"
TIMEOUT 6400)
# TODO: Enable these tests in general
if (SUPERBUILD_PACKAGE_MODE STREQUAL "modelbuilder")
add_package_extract_test("${generator}"
DEPENDS "cpack-modelbuilder-${generator}"
LABELS "CMB"
DEPENDS "cpack-${SUPERBUILD_PACKAGE_MODE}-${generator}"
LABELS "${PACKAGE_LABELS}"
)
add_package_import_test("${generator}"
DEPENDS "extract-modelbuilder-${generator}"
LABELS "CMB"
DEPENDS "extract-${SUPERBUILD_PACKAGE_MODE}-${generator}"
LABELS "${PACKAGE_LABELS}"
)
endforeach ()
endif ()
if (aeva_enabled)
include(aeva.suffix)
list(APPEND superbuild_export_variables
AEVA_PACKAGE_SUFFIX)
set(AEVA_PACKAGE_FILE_NAME ""
CACHE STRING "If set, overrides the generated filename for the package")
list(APPEND superbuild_export_variables
AEVA_PACKAGE_FILE_NAME)
foreach (generator IN LISTS generators)
superbuild_add_extra_package_test(aeva "${generator}"
LABELS "AEVA"
TIMEOUT 6400)
endforeach ()
endif ()
endfunction ()
macro (superbuild_setup_tests)
......@@ -410,16 +377,30 @@ set(suppress_projects
vxl
zeromq
zlib)
# Default SMTK plugin omissions
list(APPEND smtk_plugin_omit
smtkDelaunayPlugin
smtkMeshSessionPlugin
smtkOscillatorSessionPlugin
smtkPolygonSessionPlugin)
set_property(GLOBAL PROPERTY smtk_plugin_omit ${smtk_plugin_omit})
foreach (suppress_project IN LISTS suppress_projects)
set("_superbuild_suppress_${suppress_project}_output" ON)
endforeach ()
set(_superbuild_package_default "modelbuilder")
list(APPEND superbuild_version_files
"${CMAKE_CURRENT_LIST_DIR}/versions.cmake")
list(APPEND superbuild_ctest_custom_files
"${CMAKE_CURRENT_BINARY_DIR}/CTestCustom-cmb.cmake")
list(APPEND superbuild_project_roots
"${CMAKE_CURRENT_LIST_DIR}/projects")
list(APPEND superbuild_package_roots
"${CMAKE_CURRENT_LIST_DIR}/packages")
add_subdirectory(superbuild)
if (BUILD_TESTING)
......
set(_cmb_cmake_dir "${CMAKE_CURRENT_LIST_DIR}")
include(SuperbuildPackageMacros)
function (cmb_generate_package_bundle name)
set(flag_args NO_DOC HAS_EXAMPLES HAS_WORKFLOWS)
set(value_args SUFFIX DESCRIPTION CPACK_NAME PACKAGE_VERSION PACKAGE_NAME)
set(multi_args APPLICATIONS)
cmake_parse_arguments(bundle
"${flag_args}"
"${value_args}"
"${multi_args}"
${ARGN})
# Setup the extra arguments to pass to the CMake bundler
set(cmb_configuration_variables)
if (NOT bundle_NO_DOC)
list(APPEND cmb_configuration_variables cmb_doc_dir)
if (APPLE)
list(APPEND cmb_configuration_variables cmb_doc_base_dir)
endif ()
endif ()
if (bundle_HAS_WORKFLOWS)
list(APPEND cmb_configuration_variables cmb_workflow_dir)
endif ()
if (bundle_HAS_EXAMPLES)
list(APPEND cmb_configuration_variables cmb_example_dir)
endif ()
list(APPEND cmb_configuration_variables plugin_dir)
if (NOT bundle_DESCRIPTION)
set(bundle_DESCRIPTION "CMB ${name} application")
endif ()
if (NOT bundle_PACKAGE_NAME)
set(bundle_PACKAGE_NAME "${name}")
endif ()
if (NOT bundle_CPACK_NAME)
string(TOUPPER "${bundle_PACKAGE_NAME}" bundle_CPACK_NAME)
endif ()
if (NOT bundle_APPLICATIONS)
set(bundle_APPLICATIONS "modelbuilder")
endif ()
if (NOT bundle_PACKAGE_VERSION)
set(bundle_PACKAGE_VERSION "cmb")
endif ()
if (APPLE)
set(cmb_doc_dir "share/cmb/doc")
set(cmb_doc_base_dir "doc")
set(cmb_workflow_dir "Contents/Resources/workflows")
set(cmb_example_dir "examples")
set(plugin_dir "lib")
set(cmb_platform_bundle "cmb.bundle.apple")
elseif (UNIX)
set(cmb_doc_dir "share/cmb/doc")
set(cmb_workflow_dir "share/cmb/workflows")
set(cmb_example_dir "share/examples")
set(plugin_dir "lib")
set(cmb_platform_bundle "cmb.bundle.unix")
elseif (WIN32)
set(cmb_doc_dir "doc")
set(cmb_workflow_dir "share/cmb/workflows")
set(cmb_example_dir "examples")
set(plugin_dir "bin")
set(cmb_platform_bundle "cmb.bundle.windows")
else ()
message(FATAL_ERROR "unsupported platform")
endif ()
set("${name}_PACKAGE_SUFFIX" ${bundle_SUFFIX})
superbuild_package_suffix(${name}_PACKAGE_SUFFIX)
set(bundle_SUFFIX "${${name}_PACKAGE_SUFFIX}")
set(cmb_platform_configuration_variables)
foreach (variable IN LISTS cmb_configuration_variables)
set(cmb_platform_configuration_variables "${cmb_platform_configuration_variables}set(\"${variable}\" \"${${variable}}\")\n")
endforeach ()
configure_file("${_cmb_cmake_dir}/package.bundle.cmake.in"
"${CMAKE_BINARY_DIR}/cpack/${name}/cmake/${name}.bundle.cmake"
@ONLY)
list(PREPEND CMAKE_MODULE_PATH "${CMAKE_BINARY_DIR}/cpack/${name}/cmake")
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} PARENT_SCOPE)
endfunction()
message(STATUS "Packaging @name@")
@cmb_platform_configuration_variables@
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "@bundle_DESCRIPTION@")
set(CPACK_PACKAGE_NAME "@bundle_CPACK_NAME@")
set(cmb_package_name "@bundle_PACKAGE_NAME@")
set(cmb_programs_to_install
@bundle_APPLICATIONS@
)
set(cmb_install_paraview_server FALSE)
set(cmb_install_paraview_python TRUE)
set(package_suffix "@bundle_SUFFIX@")
set(package_version_name "@bundle_PACKAGE_VERSION@")
include(@bundle_PACKAGE_VERSION@-version)
include(cmb.bundle.common)
include(@cmb_platform_bundle@)
# Install PDF guides.
cmb_install_extra_data()
......@@ -154,20 +154,20 @@ foreach(program IN LISTS cmb_programs_to_install)
endforeach ()
if (cmb_doc_base_dir)
set(cmb_doc_dir "${program}.app/${cmb_doc_base_dir}")
set(cmb_doc_dir "${program}.app/Contents/Resources/${cmb_doc_base_dir}")
endif ()
# Install PDF guides.
cmb_install_extra_data()
endforeach ()
if (cmbworkflows_enabled)
# FIXME: Install inside of each application?
# Note: Ignoring the cmb_workflow_dir for apple and treating it as a flag
if (cmb_workflow_dir)
install(
DIRECTORY "${superbuild_install_location}/share/cmb/workflows/"
DESTINATION "Workflows"
DESTINATION ${program}.app/${cmb_workflow_dir}
COMPONENT superbuild)
endif ()
endif ()
endforeach ()
if (meshkit_enabled)
foreach (meshkit_exe IN ITEMS coregen assygen)
......
......@@ -82,66 +82,21 @@ function (extract_plugin_list varname pluginxml)
PARENT_SCOPE)
endfunction ()
list(APPEND projects_with_plugins paraview)
set(paraview_plugin_dir "${plugin_dir}/paraview-${paraview_version}/plugins")
set(paraview_plugin_files
"${paraview_plugin_dir}/paraview.plugins.xml")
list(APPEND projects_with_plugins smtk)
set(smtk_plugin_dir "${plugin_dir}/smtk-${smtk_version}.${smtk_version_patch}")
set(smtk_plugin_files
"${smtk_plugin_dir}/smtk.extensions.xml"
"${smtk_plugin_dir}/smtk.paraview.xml")
list(APPEND projects_with_plugins smtkprojectmanager)
set(smtkprojectmanager_plugin_files
"${smtk_plugin_dir}/smtk.projectmanager.xml")
list(APPEND projects_with_plugins smtkresourcemanagerstate)
set(smtkresourcemanagerstate_plugin_files
"${smtk_plugin_dir}/smtk.readwriteresourcemanagerstate.xml")
list(APPEND projects_with_plugins rggsession)
set(rggsession_plugin_files
"${smtk_plugin_dir}/smtk.rggsession.xml")
list(APPEND projects_with_plugins opencascadesession)
set(opencascadesession_plugin_files
"${smtk_plugin_dir}/smtk.opencascadesession.xml")
if (modelbuilder_enabled AND "modelbuilder" IN_LIST cmb_programs_to_install)
list(APPEND projects_with_plugins cmb)
set(cmb_plugin_dir "${plugin_dir}/cmb-${cmb_version}")
list(APPEND cmb_plugin_files
"${cmb_plugin_dir}/cmb.xml")
set(cmb_plugin_omit
# This is a static plugin.
cmbPostProcessingModePlugin)
endif ()
if ("aevaCMB" IN_LIST cmb_programs_to_install)
list(APPEND smtk_plugin_omit
smtkDelaunayPlugin
smtkMeshPlugin
smtkMeshSessionPlugin
smtkOscillatorSessionPlugin
smtkPVMeshExtPlugin
smtkPolygonSessionPlugin
smtkVTKSessionPlugin)
list(APPEND projects_with_plugins aevasession)
set(aevasession_plugin_dir "${plugin_dir}/aeva-session-1.0")
set(aevasession_plugin_files
"${aevasession_plugin_dir}/aeva.session.xml")
list(APPEND projects_with_plugins aeva)
set(aeva_plugin_dir "${plugin_dir}/aeva-${aeva_version}")
set(aeva_plugin_files
"${aeva_plugin_dir}/aeva.xml")
set(aeva_plugin_omit
# This is a static plugin.
aevaPostProcessingModePlugin)
endif ()
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 ()
set(all_plugin_files)
foreach (project IN LISTS projects_with_plugins)
......@@ -165,60 +120,6 @@ foreach (boost_lib IN LISTS BOOST_ADDITIONAL_LIBRARIES)
list(APPEND cmb_additional_libraries boost_${boost_lib})
endforeach ()
################################################################################
# Python modules
################################################################################
set(cmb_python_modules
smtk
paraview
cinema_python
pygments
six
vtk
vtkmodules)
if (matplotlib_enabled)
list(APPEND cmb_python_modules
matplotlib)
endif ()
if (numpy_enabled)
list(APPEND cmb_python_modules
numpy)
endif ()
if (pythonmeshio_enabled)
list(APPEND cmb_python_modules
meshio)
endif ()
if (pythongirderclient_enabled)
list(APPEND cmb_python_modules
diskcache
requests
requests_toolbelt
girder_client)
endif ()
if (paraviewweb_enabled)
list(APPEND cmb_python_modules
autobahn
constantly
incremental
twisted
wslink
zope)
if (WIN32)
list(APPEND cmb_python_modules
adodbapi
isapi
pythoncom
win32com)
endif ()
endif ()
################################################################################
# Qt5 plugins
################################################################################
......
......@@ -132,10 +132,10 @@ foreach (program_to_install IN LISTS cmb_programs_to_install)
endif ()
endforeach ()
if (cmbworkflows_enabled)
if (cmb_workflow_dir)
install(
DIRECTORY "${superbuild_install_location}/share/cmb/workflows/"
DESTINATION "share/cmb/workflows"
DESTINATION ${cmb_workflow_dir}
COMPONENT superbuild)
endif ()
......
......@@ -154,10 +154,10 @@ if (paraviewweb_enabled)
COMPONENT "superbuild")