Commit 1769e6b4 authored by T.J. Corona's avatar T.J. Corona Committed by Kitware Robot

Merge topic 'remove-smtk-submodule'

2e9ceb59 Add documentation for building CMB
f97d9146 Add smtk as a dependency.
50bf345a Remove SMTK as a submodule
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Acked-by: David Thompson's avatarDavid Thompson <david.thompson@kitware.com>
Merge-request: !666
parents 562ec4c3 2e9ceb59
Pipeline #129581 running with stage
[submodule "thirdparty/smtk"]
path = thirdparty/smtk
url = https://gitlab.kitware.com/cmb/smtk.git
......@@ -171,7 +171,7 @@ to provide support.
[download instructions]: doc/dev/download.md#clone
[developer setup script]: Utilities/SetupForDevelopment.sh
[Setup]: doc/dev/develop.md#Setup
[Build CMB]: https://gitlab.kitware.com/cmb/cmb-superbuild/
[Build CMB]: doc/dev/build.md
[Create a Topic]: doc/dev/develop.md#create-a-topic
[Share a Topic]: doc/dev/develop.md#share-a-topic
[Create a Merge Request]: doc/dev/develop.md#create-a-merge-request
......
......@@ -21,16 +21,7 @@ if (cmb_enable_testing)
set(cmb_data_dir "${CMAKE_CURRENT_SOURCE_DIR}/data")
endif ()
unset(smtk_data_dir CACHE)
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/smtk/data/smtk-data" sdata)
if (NOT sdata STREQUAL "\n")
message(WARNING
"Testing is enabled, but SMTK's data is not available. Use git-lfs in order "
"to obtain the testing data.")
set(smtk_data_dir)
else ()
set(smtk_data_dir "${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/smtk/data")
endif ()
set(smtk_data_dir)
#add the first test which is for checking the copyright
add_test(NAME cmb-copyright-check
......
Building ModelBuilder
=====================
This page describes how to build and install ModelBuilder. It covers building for development, on both Unix-type systems (Linux, HP-UX, Solaris, Mac), and Windows.
At its core, ModelBuilder is a modified version of ParaView designed for extensibility using ParaView's plugin mechanism. As such, the ModelBuilder application only requires ParaView to be *built*, but requires the plugins from the [Simulation and Modeling Toolkit (SMTK)](https://www.computationalmodelbuilder.org/smtk/) to be useful.
Prerequisites
=============
* The ModelBuilder build process requires [CMake](http://www.cmake.org/) version 3.9 or higher and a working compiler. On Unix-like operating systems, it also requires Make or Ninja, while on Windows it requires Visual Studio and Ninja build.
* Building ModelBuilder also requires a build of [ParaView](https://www.paraview.org) >= v5.6 (not a packaged binary). We are working on providing an installable SDK for ParaView; until this is available, we use ParaView's build directory for this purpose.
* For Windows builds, unix-like environments such as Cygwin, or MinGW are not supported.
Download And Install CMake
--------------------------
CMake is a tool that makes cross-platform building simple. On several systems it will probably be already installed. If it is not, please use the following instructions to install it.
There are several precompiled binaries available at the [CMake download page](https://cmake.org/download/).
Add CMake to your PATH environment variable if you downloaded an archive and not an installer.
Download and Build ParaView
---------------------------
Follow the instructions outlined on the [Paraview wiki](http://www.paraview.org/Wiki/ParaView:Build_And_Install) to build ParaView. Version 5.6 is currently supported, though earlier versions of ParaView may also work.
(Recommended) Download and Build SMTK
-------------------------------------
The SMTK project contains plugins that imbue ModelBuilder with the ability to create, manipulate, mesh and annotate models, and to construct and execute simulation workflows. While it is not strictly a required dependency to build ModelBuilder, a version of SMTK provided during ModelBuilder's configuration will automatically make the SMTK plugins available in the built ModelBuilder instance. Follow the instructions outlined in [SMTK's documentation](https://smtk.readthedocs.io/en/latest/index.html) to build SMTK >= v3.0.
Retrieve the Source
-------------------
* [Install Git](git/README.md) -
Git 1.7.2 or greater is required for development
* [Develop CMB](git/develop.md) - Create a fork and checkout the source code.
- A useful directory structure is cmb/src for the git source tree, cmb/build for the build tree, and if needed, cmb/install for the install directory.
- Please follow the instructions in [git/develop.md] for creating a fork and setting up the repository for contributing to CMB.
Run CMake
---------
* `cd cmb/build`
* `cmake-gui ../src` or `ccmake ../src`
* Generator: choose `ninja` for the ninja build system.
Build
-----
* `cd cmb/build`
* `ninja`
ModelBuilder will be in `bin/modelbuilder.exe`
......@@ -115,7 +115,7 @@ set(title "modelbuilder ${cmb_version} ${cmb_build_architecture}-bit")
build_paraview_client(modelbuilder
APPLICATION_NAME "modelbuilder"
TITLE "${title}"
ORGANIZATION "modelbuilder"
ORGANIZATION "Kitware Inc."
VERSION_MAJOR ${cmb_version_major}
VERSION_MINOR ${cmb_version_minor}
VERSION_PATCH ${cmb_version_patch}
......@@ -133,19 +133,10 @@ build_paraview_client(modelbuilder
# SPLASH_IMAGE "${CMAKE_CURRENT_SOURCE_DIR}/resource/splash.png"
)
set(cumulus_libs)
if (ENABLE_Cumulus)
set(cumulus_libs smtkCumulusExt smtkPQCumulusJobsPlugin)
endif()
target_link_libraries(modelbuilder
LINK_PRIVATE
${qt_targets}
vtkPVServerManagerDefault
# TODO: we should not be linking against smtk directly.
smtkCore
smtkDefaultPlugins
${cumulus_libs}
)
target_include_directories(modelbuilder
PUBLIC
......@@ -169,13 +160,74 @@ if (PARAVIEW_ENABLE_PYTHON)
)
endif()
if(NOT BUILD_SHARED_LIBS)
# If ParaView was built statically, then vtkPVStaticPluginsInit was also
# created. We can branch off of the existence of this target to determine if we
# also need to support static plugins.
if(TARGET vtkPVStaticPluginsInit)
target_link_libraries(modelbuilder
LINK_PRIVATE
vtkPVStaticPluginsInit
)
endif()
# Plugins can be directly linked into ParaView-based applications, or they can
# be identified and loaded at runtime. We would prefer to defer the plugin
# selection process to runtime, but we have found the former option to be more
# reliable.
set(MODELBUILDER_DIRECTLY_LINK_TO_SMTK ON CACHE BOOL "Directly link SMTK plugins into ModelBuilder")
if (MODELBUILDER_DIRECTLY_LINK_TO_SMTK)
# If we are directly linking to SMTK, then SMTK is a required dependency.
find_package(smtk REQUIRED)
# There is also a bit of code that must be present in ModelBuilder to load
# SMTK's plugins. We enable it here.
set_property(SOURCE mbMainWindow.cxx APPEND PROPERTY COMPILE_DEFINITIONS "DIRECTLY_LINK_TO_SMTK")
# Finally, we must link our application against smtkDefaultPlugins, which
# brings in all of the plugins created by the SMTK we are using.
target_link_libraries(modelbuilder
LINK_PRIVATE
smtkCore
smtkDefaultPlugins
)
else()
# We are not directly linking to SMTK, so SMTK is no longer a required
# dependency. If we find it, we will generate a custom .plugins file for
# ModelBuilder to use during testing and for installation.
find_package(smtk)
if (smtk_FOUND)
# Create a custom .plugins xml file that contains all of the plugins made by
# the associated smtk. This file will be used to load plugins during testing.
if (WIN32)
set(plugins_file ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/plugins/.plugins)
else()
set(plugins_file ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/modelbuilder-${cmb_version}/plugins/.plugins)
endif()
set(contents "<?xml version=\"1.0\"?>\n<Plugins>\n</Plugins>\n")
foreach (plugin IN LISTS SMTK_PLUGINS)
get_property(${plugin}_location TARGET ${plugin} PROPERTY LOCATION)
set(plugin_directive
" <Plugin name=\"${plugin}\" filename=\"${${plugin}_location}\" auto_load=\"1\" />\n")
string(REPLACE "</Plugins>" "${plugin_directive}</Plugins>" contents "${contents}")
endforeach ()
file(WRITE "${plugins_file}" "${contents}")
set(plugin_dir ${CMAKE_INSTALL_PREFIX}/${PARAVIEW_INSTALL_PLUGINS_DIR})
if (APPLE AND NOT PARAVIEW_DO_UNIX_STYLE_INSTALLS)
set(plugin_dir "${MACOSX_APP_INSTALL_PREFIX}/modelbuilder.app/Contents/Plugins")
endif ()
install(
FILES "${plugins_file}"
DESTINATION "${plugin_dir}"
RENAME ".plugins")
endif()
endif()
if (cmb_enable_testing)
add_subdirectory(testing)
endif ()
......
......@@ -41,8 +41,6 @@
#include "pqRepresentationToolbar.h"
#include "pqSetName.h"
#include "thirdparty/smtk/smtk/plugin/InitializeDefaultPlugins.h"
// A feature that exposes ParaView's main window events (show, close, drag,
// etc.) was introduced just after the tagging of 5.6.0. These signals allow us
// to prompt the user to save modified resources prior to closing the
......@@ -53,6 +51,10 @@
#include "pqMainWindowEventManager.h"
#endif
#ifdef DIRECTLY_LINK_TO_SMTK
#include "smtk/plugin/InitializeDefaultPlugins.h"
#endif
class mbMainWindow::pqInternals : public Ui::pqClientMainWindow
{
};
......@@ -158,8 +160,10 @@ mbMainWindow::mbMainWindow()
this->Internals = new pqInternals();
this->Internals->setupUi(this);
#ifdef DIRECTLY_LINK_TO_SMTK
smtk::extension::paraview::initializeDefaultPlugins();
smtk::extension::paraview::loadDefaultPlugins();
#endif
// Allow multiple panels to dock side-by-side, which is
// handy for the attribute and resource-tree panels:
......
......@@ -37,12 +37,19 @@ if (cmb_data_dir)
--test-script=${CMAKE_CURRENT_SOURCE_DIR}/${test}.xml
--test-directory=${cmb_test_dir}
--test-baseline=${test_images}/${test}.png
--test-plugin-path=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
--exit
)
set(tlabels cmb modelbuilder ${${test}-labels})
set_tests_properties(${tname}
PROPERTIES LABELS "${tlabels}"
PROPERTIES
LABELS "${tlabels}"
)
# if a plugins file was created, use it
if (${plugins_file})
set_tests_properties(${tname}
PROPERTIES
ENVIRONMENT "PV_PLUGIN_CONFIG_FILE=${plugins_file}"
)
endif()
endforeach()
endif()
option(cmb_use_system_smtk "Use a system SMTK install" OFF)
mark_as_advanced(cmb_use_system_smtk)
if (cmb_use_system_smtk)
find_package(SMTK REQUIRED)
else ()
# We include CMBInstallRules before we include the SMTK subdirectory. This
# way, we prevent SMTK's CMAKE_INSTALL_DIR from changing in between configure
# and install.
include(CMBInstallRules)
set(SMTK_ENABLE_TESTING ${BUILD_TESTING})
set(smtk_options
SMTK_ENABLE_PYTHON_WRAPPING
SMTK_ENABLE_QT_SUPPORT
SMTK_ENABLE_VTK_SUPPORT
SMTK_ENABLE_DISCRETE_SESSION
SMTK_ENABLE_EXODUS_SESSION
SMTK_ENABLE_REMUS_SUPPORT
SMTK_ENABLE_REMOTE_SESSION
SMTK_ENABLE_PARAVIEW_SUPPORT)
foreach (smtk_option IN LISTS smtk_options)
# These must be set as INTERNAL cache variables so that SMTK cannot
# override them other than with local variables. Setting a local variable
# is not sufficient due to ${unfortunate_historical_reasons} in CMake.
set("${smtk_option}" ON CACHE INTERNAL "Forced by CMB")
endforeach ()
add_subdirectory(smtk)
if (APPLE AND NOT SMTK_USE_SYSTEM_MOAB)
# If we are building MOAB, then we also package it with CMB. We therefore
# modify its INSTALL_NAME_DIR so it is in agreement with its eventual
# installation location.
set_target_properties(MOAB
PROPERTIES INSTALL_NAME_DIR "@executable_path/../Libraries")
endif ()
set(SMTK_DIR "${CMAKE_CURRENT_BINARY_DIR}/smtk"
CACHE INTERNAL "Path to SMTKConfig.cmake")
mark_as_advanced(SMTK_DIR)
endif ()
# CMB-specific thirdparty applications may go here
Subproject commit 05ef6585a492f362b99a94f0b821aacf284299f3
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment