Commit f97d9146 authored by T.J. Corona's avatar T.J. Corona

Add smtk as a dependency.

parent 50bf345a
......@@ -170,6 +170,64 @@ if(TARGET 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 ()
......
......@@ -51,6 +51,10 @@
#include "pqMainWindowEventManager.h"
#endif
#ifdef DIRECTLY_LINK_TO_SMTK
#include "smtk/plugin/InitializeDefaultPlugins.h"
#endif
class mbMainWindow::pqInternals : public Ui::pqClientMainWindow
{
};
......@@ -156,6 +160,11 @@ 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:
this->setDockNestingEnabled(true);
......
......@@ -27,10 +27,6 @@ set(xml_tests_with_baselines
set(test_images ${cmb_SOURCE_DIR}/data/baselines/modelbuilder)
if (cmb_data_dir)
find_package(smtk REQUIRED COMPONENTS smtkPQComponentsPlugin)
get_filename_component(smtk_plugin_path $<TARGET_FILE:smtkPQComponentsPlugin> DIRECTORY)
foreach(test ${xml_tests_with_baselines})
#get_image_threshold_arg(THRESHOLD_CMD ${test})
set(tname "${test}")
......@@ -45,7 +41,15 @@ if (cmb_data_dir)
)
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()
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