Vous avez reçu un message "Your GitLab account has been locked ..." ? Pas d'inquiétude : lisez cet article https://docs.gricad-pages.univ-grenoble-alpes.fr/help/unlock/

Commit 888f8676 authored by promayon's avatar promayon
Browse files

NEW ComponentExtension has now a save method. Replace all exportTo*() methods,...

NEW ComponentExtension has now a save method. Replace all exportTo*() methods, simpler/cleaner export process (mimics the open process, with the difference that the save method is not a static method in the Component class, but is a virtual method in the ComponentExtension)
NEW Action can be generic action. A generic action does not need any specific component to run (e.g., action that synthetize data). To trigger a generic action, clear the current selection and go to the Action menu (in imp) or look in the ActionViewer. generic actions can be called from scratch to generate/synthetize data or initialize resources
NEW action, component and application macro support NEED_XSD flag (look for xerces-c and xsdcxx executable)
FIXED interface for ComponentExtension (no more static method, moved to ExtensionsManager)
FIXED bug in preference dialog (could not modify the edited object in first tab), regression from r58
FIXED "Fancy Demo" dirty tricks in ImageComponent/SingleComponent
FIXED only CAMITK_VERSION and CAMITK_INSTALL_DIR are shown in the first cmake run (ROOT_DIR_GUESS had no reason to be visible)
FIXED MainWindow / ImpMainWindow settings reorganization (some settings are now managed by core class MainWindow)
FIXED quitting/exiting algorithm code cleaning
FIXED Wizard now adds a Q_OBJECT line for all Components (needed for introspection/Action detetection)  
FIXED Wizard for new ComponentExtension/Component interface
FIXED CMake specific modules are now installed in share not in lib (makes more sens)
FIXED FindCamiTK.cmake is now a proper module used and exported by the wizard and satellite projects (restricted and tutorials)
FIXED remove findCamiTK.tmp from wizard (now using the "official" FindCamiTK.cmake from cmake/modules dir)
FIXED remove getExportExtension() in ComponentExtension (not needed anymore, always use getFileExtension(), if the export
is not possible, a dialog will appear)
FIXED removed error/getError in Component class (not needed anymore, yet another API simplification)
FIXED setModified can now take a boolean as parameter to reset the mofication flag (e.g., once a component has been saved, it is tryely unmodified, there was no need to reset the flag in the previous API)
FIXED getRepresentation was checking wrong representation every call (probably a CamiTK 1.0 bug that here since ages)
FIXED getModified() was not declared virtual (probably a CamiTK 1.0 bug that was here since ages)
FIXED MainWindow saveAs now suggest a indexed file (add an index / increment an already existing index at the end of the filename)
FIXED delete all Actions just before quitting
FIXED RigidTransform action: cancel button is now close button
FIXED VtkMeshComponentExtension reset modification flag after saving
FIXED Component method update was a bit confusing compared to method refresh. update is now renamed refreshInterfaceNode() which is more descriptive and probably less confusing! Note: this method should probably be replaced by something better (or suppress for a better mechanism)
FIXED a lot of not-so-good use of lastIndexOf(".") to deduce either basename or extension (suffix) are now using QFileInfo (safer)
FIXED ObjectController now interacts with all properties, even the inherited ones
FIXED ImageProperties now directly included in ImageComponent (no need for the getPropertyObject() method) => fix problems with inherited extensions
FIXED findCamiTK now only displays CamiTK version and CamiTK install dir (not the root guess dir)
FIXED FancyMainWindow updated to CamiTK2.1 code cleaning (<250 lines), no dial jumps


git-svn-id: svn+ssh://scm.forge.imag.fr/var/lib/gforge/chroot/scmrepos/svn/camitk/trunk/camitk@103 ec899d31-69d1-42ba-9299-647d76f65fb3
parent 996e2ede
......@@ -84,7 +84,7 @@ void RigidTransform::init() {
connect(myUI.sY, SIGNAL(valueChanged()), SLOT(update()));
connect(myUI.sZ, SIGNAL(valueChanged()), SLOT(update()));
connect(myUI.okButton, SIGNAL(clicked()), SLOT(applyTransform()));
connect(myUI.cancelButton, SIGNAL(clicked()), SLOT(cancel()));
connect(myUI.closeButton, SIGNAL(clicked()), SLOT(close()));
connect(myUI.resetButton, SIGNAL(clicked()), SLOT(reset()));
connect(myUI.previewButton, SIGNAL(clicked()), SLOT(preview()));
connect(myUI.uniformScaling, SIGNAL(clicked()), SLOT(update()));
......@@ -106,7 +106,7 @@ QWidget * RigidTransform::getWidget() {
init();
// disconnect and reset previous state
cancel();
close();
reset();
//-- connect the custom pipeline to the selected Component
......@@ -215,15 +215,17 @@ void RigidTransform::applyTransform() {
i++;
}
// disconnect everyone
cancel();
close();
}
//--------------- cancel ------------
void RigidTransform::cancel() {
//--------------- close ------------
void RigidTransform::close() {
//--disconnect the selected Component
foreach(Component *comp, targetComponents) {
comp->setDataConnection(NULL);
}
// hide the dialog
dialog->hide();
// Refresh all the used viewers
Application::getMainWindow()->refreshViewers();
}
......
......@@ -73,7 +73,7 @@ private slots:
void applyTransform();
/// Slot called when the button Cancel is clicked, reset the transformation to identity (don't transform)
void cancel();
void close();
/** Slot called when the slider is moved, update the transformation of the selected Component (just for visualization).
* @param forceUpdate force the visualization of the current transformation (default is false)
......
......@@ -203,9 +203,9 @@
</widget>
</item>
<item>
<widget class="QPushButton" name="cancelButton">
<widget class="QPushButton" name="closeButton">
<property name="text">
<string>&amp;Cancel</string>
<string>Close</string>
</property>
<property name="autoDefault">
<bool>false</bool>
......
......@@ -64,13 +64,9 @@ ImpMainWindow::ImpMainWindow() : MainWindow( "imp - " + tr ( Core::version )) {
initMenuBar();
initToolBar();
// init the application settings
initSettings();
// initialize architecture
updateActionStates();
updateDataDirectoryMenu();
updateRecentDocumentsMenu();
// now add the different viewers
setCentralViewer(new MedicalImageViewer());
......@@ -88,6 +84,10 @@ ImpMainWindow::~ImpMainWindow() {
// ------------- aboutToShow -----------------
void ImpMainWindow::aboutToShow() {
MainWindow::aboutToShow(); // calls init settings
// now that initSettings was called, populate the recent document menu
updateRecentDocumentsMenu();
// check autoload for files and load if needed
if ( autoloadLastOpened && recentDocuments.size() > 0 )
......@@ -361,6 +361,7 @@ void ImpMainWindow::updateActionStates() {
actionMenu->clear();
actionMenu->setEnabled ( false );
if ( nrOfSelectedItems > 0 ) {
// use the selection to populate the menu
Component * comp = ComponentManager::getSelectedComponents().last();
if (comp) {
QMenu *compActionsMenu = comp->getActionAndPopupMenu();
......@@ -370,6 +371,14 @@ void ImpMainWindow::updateActionStates() {
}
}
}
else {
// add all generic actions
ActionList allActions = ActionManager::getActions(NULL);
foreach (Action* action, allActions) {
actionMenu->addAction(action->getQAction());
actionMenu->setEnabled ( true );
}
}
// update the application window title
if ( nrOfSelectedItems > 0 )
......@@ -545,34 +554,15 @@ void ImpMainWindow::slotEditSettings() {
// ------------------------------ initSettings -------------------------------
void ImpMainWindow::initSettings() {
// TODO transfer some settings in mainwindow ?
QSettings & settings = Application::getSettings();
settings.beginGroup ( "MainWindow" );
// init the core application settings
MainWindow::initSettings();
// the recent documents
QStringList recentDoc = settings.value ( "recentDocuments" ).toStringList();
recentDocuments.clear();
foreach ( QString fileName, recentDoc ) {
recentDocuments.append ( fileName );
}
// the last opened directory
QDir defaultDir ( Core::getTestDataDir() );
lastOpenedDirectory = settings.value ( "lastOpenedDirectory", defaultDir.absolutePath() ).toString();
// resize and move considering last exit state, default to XGA 1024x768
QPoint pos = settings.value ( "pos", QPoint ( 0, 0 ) ).toPoint();
QSize size = settings.value ( "size", QSize ( 1024, 768 ) ).toSize();
resize ( size );
move ( pos );
settings.endGroup();
QSettings & settings = Application::getSettings();
settings.beginGroup ( "ImpMainWindow" );
// the autoload option
autoloadLastOpened = settings.value ( "autoloadLastOpened", false ).toBool(); // default false
settings.endGroup();
}
......@@ -583,6 +573,13 @@ void ImpMainWindow::redirectToConsole ( bool visible ) {
}
// ------------------------------ slotRecentDocuments -------------------------------
void ImpMainWindow::slotRecentDocuments() {
QAction *action = qobject_cast<QAction *> ( sender() );
if ( action )
open ( action->data().toString() );
}
// ------------------------------ updateRecentDocumentsMenu -------------------------------
void ImpMainWindow::updateRecentDocumentsMenu() {
int firstOpened = recentDocuments.size() - MAX_RECENT_DOCUMENTS;
......
......@@ -37,7 +37,7 @@ class QTextEdit;
class QProgressBar;
/**
* This Class describes the "historical" imp application.
* This Class describes the "historical" imp application.
* It is a classical desktop application, with menubar, toolbar and statusbar.
*/
class ImpMainWindow : public MainWindow {
......@@ -52,10 +52,10 @@ public:
/// overriden from MainWindow to automatically load last opened document if needed
void aboutToShow();
/// destructor
virtual ~ImpMainWindow();
/// @name open a top-level component
///@{
/** Overidden to update rencent file menu
......@@ -84,11 +84,11 @@ public slots:
/// @name viewers' slot
///@{
/// this slot is connected to all the viewers selectionChanged() signal, this will call the refresh method of all viewers but whoIsAsking
virtual void refresh();
/// this slot is connected to all the viewers selectionChanged() signal, this will call the refresh method of all viewers but whoIsAsking
virtual void refresh();
///@}
/** @name View menu slots
* \TODO everything that is linked to the InteractiveViewer has to be managed by the view (in case there is more than one InteractiveViewer)
*/
......@@ -99,7 +99,7 @@ public slots:
/// show or hide the menu bar
void showMenuBar(bool);
/// show or hide the status bar
void slotShowStatusBar(bool);
......@@ -109,7 +109,7 @@ public slots:
///@{
/// shows an "about" dialog
void slotHelpAbout();
void slotHelpAbout();
/// show the console output window
void slotHelpShowConsole();
......@@ -121,9 +121,9 @@ public slots:
void slotEditSettings();
/** clear the current selection*/
void slotEditClearSelection();
void slotEditClearSelection();
///@}
protected:
/// update the viewer's menu
void updateViewMenu();
......@@ -132,21 +132,21 @@ protected:
///@{
/// update the data directory menu depending on registered plugins
void updateDataDirectoryMenu();
/// update the recent document menu
void updateRecentDocumentsMenu();
///@}
/** @name initialization/update methods */
///@{
/// set the current QAction enable state depending on the current selection
void updateActionStates();
///@}
/** initializes all QActions of the application */
void initActions();
/** Close a Component: if it has been changed, propose to save it; then remove it from
/** Close a Component: if it has been changed, propose to save it; then remove it from
* view and document, and delete it.
* @param topLevelComponent the Component to close.
* @return true if the closing was made, false if the user cancelled the operation
......@@ -156,6 +156,9 @@ protected:
/// the main toolbar
QToolBar *mainToolbar;
/// init ImpMainWindow specific settings (e.g. autoloadLastOpened)
virtual void initSettings();
private:
/** @name initialization/update methods */
......@@ -185,11 +188,6 @@ private:
QAction *fileSaveAll;
QAction *fileQuit;
/// init ImpMainWindow settings (maxRecent and recentDocuments)
void initSettings();
/** @name View menu attributes and action */
///@{
/** view_menu contains all items of the menubar entry "View" */
......@@ -197,8 +195,8 @@ private:
QAction *viewMenuBar;
QAction *viewStatusBar;
///@}
/** @name Edit menu action methods */
/** @name Edit menu action methods */
///@{
QAction *editCut;
QAction *editPaste;
......@@ -232,6 +230,8 @@ private:
/// @name File management attributes
///@{
/// is the last opened document re-opened at startup?
bool autoloadLastOpened;
/// list of all the possible recent documents actions
QAction* recentDocumentActions[MAX_RECENT_DOCUMENTS];
......@@ -240,6 +240,11 @@ private:
QAction *recentDocumentSeparator;
///@}
private slots:
/// open a given recent document
void slotRecentDocuments();
};
#endif //IMP_MAINWINDOW_H
......
......@@ -31,7 +31,24 @@ if(APPLICATION_WIZARD)
target_link_libraries(application-wizard ${QT_LIBRARIES})
#Add xercesc dependency
target_link_libraries(application-wizard libxerces-c.so)
# build-time FindCamiTK.cmake install
# check directory
set(FIND_CAMITK_BUILD_TIME_DIR ${CAMITK_BUILD_DIR}/share/cmake)
if (NOT EXISTS ${FIND_CAMITK_BUILD_TIME_DIR})
add_custom_command( TARGET application-wizard
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory ${FIND_CAMITK_BUILD_TIME_DIR}
COMMENT "Creating build-time group include dir ${FIND_CAMITK_BUILD_TIME_DIR}"
VERBATIM
)
endif()
# copy after build, only if there was a change
add_custom_command( TARGET application-wizard
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different ../../cmake/modules/FindCamiTK.cmake ${FIND_CAMITK_BUILD_TIME_DIR}/
COMMENT "Installing build-time FindCamiTK.cmake"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
VERBATIM
)
endif()
\ No newline at end of file
This diff is collapsed.
......@@ -26,6 +26,8 @@ protected:
virtual void createElement() throw (QString);
/// add QOBJECT line (now all Components should be Q_OBJECT so they can be used/recognized in Actions)
virtual void writeDeclareQObject();
virtual void writeDeclareConstructor();
virtual void writeDeclareSpecificMethods();
......
......@@ -126,7 +126,9 @@ void ElementGenerator::writeElementHFile() {
(*out) << endl;
(*out) << "class " << elementClassName << " : public " << parentClass <<" {" << endl;
(*out) << endl;
writeDeclareQObject();
(*out) << endl;
(*out) << "public: " << endl;
......
......@@ -23,6 +23,8 @@ protected:
virtual void writeElementHFile();
virtual void writeElementCFile();
/// this method adds a Q_OBJECT line or not (default), depending on the element, see derived classes
virtual void writeDeclareQObject() {};
virtual void writeDeclareDestructor();
virtual void writeDeclareConstructor() = 0;
......
This diff is collapsed.
std::string FIND_CAMITK_STRING = "# - Try to find CamiTK\n# Once done, this will define\n#\n# CAMITK_FOUND - system has CamiTK\n# CAMITK_INSTALL_ROOT - root installation for CamiTK\n# CAMITK_INCLUDE_DIRECTORIES - the CamiTK include directories\n# CAMITK_LIBRARIES - link these to use CamiTK\n# ... \n# and all the other goodies\n#\n# Once found it is then easy to just use the CamiTK macros\n# to build your extensions\n\n# This the my extension version, should be the same as the CamiTK version you are looking for\n# TODO integrate this as parameters of the find camitk package\nset(CAMITK_VER_MAJ \"2\")\nset(CAMITK_VER_MIN \"1\")\n\n# CamiTK short version name we are looking for\nset(CAMITK_SHORT_VERSION_STRING \"camitk-${CAMITK_VER_MAJ}.${CAMITK_VER_MIN}\")\n\nif (NOT CAMITK_INSTALL_ROOT) \n # name of the camitk core lib (as defined in CamiTKVariables)\n set(CAMITK_CORE_LIB_TEMP \"camitkcore\")\n\n # directory structure from install dir to look for CamiTKAPI.h\n set(CAMITK_INCLUDE_DIR_SUFFIX_TEMP \"include/${CAMITK_SHORT_VERSION_STRING}/${CAMITK_CORE_LIB_TEMP}\")\n\n # find the caracteristic header using a (reasonably) long good list for the guess\n find_path(CAMITK_ROOT_DIR_GUESS\n NAMES CamiTKAPI.h\n PATHS \"/usr\"\n \"/usr/local\"\n \"C:/Programs\"\n \"C:/Programs/camitk\"\n \"C:/Dev\"\n \"C:/Dev/camitk\"\n $ENV{CAMITK_DIR}\n \"${CMAKE_CURRENT_SOURCE_DIR}/..\"\n \"${CMAKE_CURRENT_SOURCE_DIR}/../camitk\"\n \"${CMAKE_CURRENT_SOURCE_DIR}/../camitktimc\"\n \"${CMAKE_CURRENT_SOURCE_DIR}/../camitk-timc\"\n PATH_SUFFIXES \"${CAMITK_INCLUDE_DIR_SUFFIX_TEMP}\"\n )\n\n mark_as_advanced(CAMITK_ROOT_DIR_GUESS)\n\n set(CAMITK_VERSION \"${CAMITK_VER_MAJ}.${CAMITK_VER_MIN}\" CACHE STRING \"The CamiTK version to find\")\n\n # if guess is alright\n if (CAMITK_ROOT_DIR_GUESS) \n string(REGEX REPLACE \"${CAMITK_INCLUDE_DIR_SUFFIX_TEMP}\" \"\" CAMITK_INSTALL_ROOT_TEMP ${CAMITK_ROOT_DIR_GUESS})\n set(CAMITK_INSTALL_ROOT ${CAMITK_INSTALL_ROOT_TEMP} CACHE PATH \"${CAMITK_SHORT_VERSION_STRING} install root\" FORCE)\n else()\n set(CAMITK_INSTALL_ROOT "" CACHE PATH \"${CAMITK_SHORT_VERSION_STRING} install root\")\n endif()\nendif()\n\nif(NOT ${CAMITK_INSTALL_ROOT} EQUAL \"\")\n\n # advertise the success\n message(STATUS \"Found ${CAMITK_SHORT_VERSION_STRING}: ${CAMITK_INSTALL_ROOT}\")\n set(CAMITK_FOUND TRUE)\n\n # Check dependencies\n find_package(Qt4 REQUIRED)\n include(${QT_USE_FILE})\n set (QT_USE_QT3SUPPORT OFF)\n\n # Find VTK\n find_package(VTK REQUIRED)\n include(${VTK_USE_FILE})\n\n # set CamiTK build variables\n set (CAMITK_BIN_DIR ${CAMITK_INSTALL_ROOT}/bin CACHE PATH \"CamiTK bin dir.\" FORCE)\n set (CAMITK_LIB_DIR ${CAMITK_INSTALL_ROOT}/lib/${CAMITK_SHORT_VERSION_STRING} CACHE PATH \"CamiTK lib dir.\" FORCE)\n set (CAMITK_INCLUDE_DIR ${CAMITK_INSTALL_ROOT}/include/${CAMITK_SHORT_VERSION_STRING} CACHE PATH \"CamiTK include dir.\" FORCE)\n set (CAMITK_TESTDATA_DIR ${CAMITK_INSTALL_ROOT}/share/${CAMITK_SHORT_VERSION_STRING}/testdata CACHE PATH \"CamiTK share dir. for test data\" FORCE)\n mark_as_advanced(CAMITK_BIN_DIR CAMITK_LIB_DIR CAMITK_INCLUDE_DIR CAMITK_TESTDATA_DIR)\n\n # Needed due to installation reason\n link_directories(${CAMITK_INSTALL_ROOT}/lib)\n \n # update module path\n set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CAMITK_LIB_DIR}/cmake)\n\n # include useful modules\n include(CamiTKVariables)\n include(CamiTKMacros)\n\n # set install path\n set (CMAKE_INSTALL_PREFIX ${CAMITK_INSTALL_ROOT} CACHE PATH \"Path to install dir (deduced from CAMITK_INSTALL_ROOT)\" FORCE)\n\n # check the following to define the proper output variables for an external extension\n # during compilation, set where everything (lib, exe, shared) goes\n set (EXTENSION_BUILD_DIR ${CMAKE_BINARY_DIR})\n set (EXTENSION_BIN_DIR ${EXTENSION_BUILD_DIR}/bin CACHE PATH \"CamiTK extension bin dir.\" FORCE)\n set (EXTENSION_LIB_DIR ${EXTENSION_BUILD_DIR}/lib CACHE PATH \"CamiTK extension lib dir.\" FORCE)\n set (EXTENSION_INCLUDE_DIR ${EXTENSION_BUILD_DIR}/include CACHE PATH \"CamiTK extension include dir.\" FORCE)\n set (EXTENSION_TESTDATA_DIR ${EXTENSION_BUILD_DIR}/share/testdata CACHE PATH \"CamiTK share dir. for test data\" FORCE)\n # the \"normal\" user does not need to see this\n mark_as_advanced(EXTENSION_BUILD_DIR EXTENSION_BIN_DIR EXTENSION_LIB_DIR EXTENSION_INCLUDE_DIR EXTENSION_TESTDATA_DIR)\n\n # Setup CMake Variable\n set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${EXTENSION_BIN_DIR} CACHE PATH \"Single directory for all runtimes.\" FORCE)\n set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${EXTENSION_BIN_DIR} CACHE PATH \"Single directory for all dynamic/shared libs.\" FORCE)\n set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${EXTENSION_LIB_DIR} CACHE PATH \"Single directory for all archives.\" FORCE)\n\n # no need to see this\n mark_as_advanced ( CMAKE_RUNTIME_OUTPUT_DIRECTORY CMAKE_LIBRARY_OUTPUT_DIRECTORY CMAKE_ARCHIVE_OUTPUT_DIRECTORY)\n\nelse()\n message(FATAL_ERROR \"Cannot find CamiTK core, please set the CAMITK_INSTALL_ROOT variable\")\nendif()\n";
......@@ -8,10 +8,12 @@ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/../CamiTKBuildSettings.cmake"
# install the cmake files
file(GLOB CAMITK_CMAKE_FILES "modules/*.cmake")
install(FILES ${CAMITK_CMAKE_FILES}
DESTINATION lib/${CAMITK_SHORT_VERSION_STRING}/cmake
DESTINATION share/${CAMITK_SHORT_VERSION_STRING}/cmake
COMPONENT cmake-modules)
file(GLOB CAMITK_CMAKE_FILES "modules/launcher-templates/*.in")
install(FILES ${CAMITK_CMAKE_FILES}
DESTINATION lib/${CAMITK_SHORT_VERSION_STRING}/cmake/launcher-templates
COMPONENT cmake-modules)
\ No newline at end of file
DESTINATION share/${CAMITK_SHORT_VERSION_STRING}/cmake/launcher-templates
COMPONENT cmake-modules)
......@@ -11,14 +11,19 @@ set(CAMITK_INSTALL_ROOT_TEST "$ENV{CAMITK_INSTALL_ROOT}")
if (NOT CAMITK_INSTALL_ROOT_TEST)
set(CAMITK_INSTALL_ROOT_TEST ${CAMITK_INSTALL_ROOT})
if (NOT CAMITK_INSTALL_ROOT_TEST)
set (CAMITK_INSTALL_ROOT ${CAMITK_SOURCE_DIR}/.. CACHE PATH "CamiTK installation root dir" FORCE)
if (CAMITK_SOURCE_DIR)
set(CAMITK_INSTALL_ROOT ${CAMITK_SOURCE_DIR}/.. CACHE PATH "CamiTK installation root dir" FORCE)
# else()
# set(CAMITK_INSTALL_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/.. CACHE PATH "CamiTK installation root dir" FORCE)
endif()
endif()
set (CMAKE_INSTALL_PREFIX ${CAMITK_INSTALL_ROOT} CACHE PATH "CamiTK installation root dir" FORCE)
else()
set (CMAKE_INSTALL_PREFIX $ENV{CAMITK_INSTALL_ROOT} CACHE PATH "CamiTK installation root dir" FORCE)
endif()
message(STATUS "Installation directory: ${CMAKE_INSTALL_PREFIX}")
message(STATUS "CamiTK Installation Directory: ${CMAKE_INSTALL_PREFIX}")
# during compilation, set where everything (lib, exe, shared) goes
set (CAMITK_BUILD_DIR ${CMAKE_BINARY_DIR})
......
......@@ -139,8 +139,8 @@ endmacro()
# component_extension([DEFAULT]
# [NEEDS_ITK]
# [NEEDS_LIBXML2]
# [NEEDS_OPENCV]
# [NEEDS_IGSTK]
# [NEEDS_OPENCV]
# [NEEDS_IGSTK]
# [NEEDS_TOOL tool1 tool2 ...]
# [NEEDS_COMPONENT_EXTENSION component1 component2 ...]
# [INCLUDE_DIRECTORIES dir1 dir2 ...]
......@@ -158,8 +158,9 @@ endmacro()
# NEEDS_ITK = add this if your component needs itk.
# Do not forget to add the needed list of itk libraries in the LIBRARIES parameter
# NEEDS_LIBXML2 = add this if your component needs libxml2
# NEEDS_XSD = add this if your action needs Codesynthesis xsd cxx (xml schema compiler)
# NEEDS_OPENCV = add this if your component needs OpenCV
# NEEDS_IGSTK = add this if your component needs IgsTK
# NEEDS_IGSTK = add this if your component needs IgsTK
# NEEDS_TOOL = list of needed camitk tools
# NEEDS_COMPONENT_EXTENSION = list of needed component extensions
# INCLUDE_DIRECTORIES = additional include directories
......@@ -181,7 +182,7 @@ macro(component_extension)
parse_arguments(${COMPONENT_NAME_CMAKE}
"NEEDS_TOOL;NEEDS_COMPONENT_EXTENSION;INCLUDE_DIRECTORIES;LIBRARIES;HEADERS_TO_INSTALL;DEFINES;EXTERNAL_SOURCES" # possible lists
"DEFAULT;NEEDS_ITK;NEEDS_LIBXML2;NEEDS_OPENCV;NEEDS_IGSTK;INSTALL_ALL_HEADERS" # possible options
"DEFAULT;NEEDS_ITK;NEEDS_LIBXML2;NEEDS_XSD;NEEDS_OPENCV;NEEDS_IGSTK;INSTALL_ALL_HEADERS" # possible options
${ARGN}
)
......@@ -255,6 +256,19 @@ macro(component_extension)
endif()
endif()
# Looking for codesynthesis XSD CXX
if(${EXTENSION_NAME_CMAKE}_NEEDS_XSD)
# XercesC is required
find_package(XercesC REQUIRED)
if (XERCESC_FOUND)
include_directories(${XERCESC_INCLUDE_DIR})
find_package(XSD REQUIRED)
else()
# most probably win32 or crosscompiling
message(STATUS "${EXTENSION_NAME}: xerces-c required because of XSD cxx, please set XERCESC_INCLUDE_DIR")
endif()
endif()
set(OpenCV_LIBRARIES "")
if(${COMPONENT_NAME_CMAKE}_NEEDS_OPENCV)
# OpenCV is required
......@@ -309,11 +323,11 @@ macro(component_extension)
# one need to do this just before the add_library so that all defines, include directories and link directories
# are set properly (gather_headers_and_sources include the call to Qt moc and uic)
gather_headers_and_sources(${COMPONENT_NAME_CMAKE})
# check for external sources
if(${COMPONENT_NAME_CMAKE}_EXTERNAL_SOURCES)
set(${COMPONENT_NAME_CMAKE}_SOURCES ${${COMPONENT_NAME_CMAKE}_SOURCES} ${${COMPONENT_NAME_CMAKE}_EXTERNAL_SOURCES})
endif()
# check for external sources
if(${COMPONENT_NAME_CMAKE}_EXTERNAL_SOURCES)
set(${COMPONENT_NAME_CMAKE}_SOURCES ${${COMPONENT_NAME_CMAKE}_SOURCES} ${${COMPONENT_NAME_CMAKE}_EXTERNAL_SOURCES})
endif()
# build the component extension module (library)
add_library(${COMPONENT_TARGET_NAME} SHARED ${${COMPONENT_NAME_CMAKE}_SOURCES})
......@@ -437,9 +451,10 @@ endmacro()
# DEFAULT = means this is a default action to be compiled automatically
# NEEDS_ITK = add this if your action needs itk.
# Do not forget to add the needed list of itk libraries in the LIBRARIES parameter
# NEEDS_LIBXML2 = add this if your action needs libxml2
# NEEDS_LIBXML2 = add this if your action needs libxml2
# NEEDS_XSD = add this if your action needs Codesynthesis xsd cxx (xml schema compiler)
# NEEDS_OPENCV = add this if your action needs OpenCV
# NEEDS_IGSTK = add this if your action needs IgsTK
# NEEDS_IGSTK = add this if your action needs IgsTK
# NEEDS_TOOL = list of needed camitk tools
# NEEDS_COMPONENT_EXTENSION = list of needed component extensions
# INCLUDE_DIRECTORIES = additional include directories
......@@ -460,7 +475,7 @@ macro(action_extension)
parse_arguments(${ACTION_NAME_CMAKE}
"NEEDS_TOOL;NEEDS_COMPONENT_EXTENSION;INCLUDE_DIRECTORIES;LIBRARIES;HEADERS_TO_INSTALL;DEFINES;EXTERNAL_SOURCES" # possible lists
"DEFAULT;NEEDS_ITK;NEEDS_LIBXML2;NEEDS_OPENCV;NEEDS_IGSTK;INSTALL_ALL_HEADERS" # possible options
"DEFAULT;NEEDS_ITK;NEEDS_LIBXML2;NEEDS_XSD;NEEDS_OPENCV;NEEDS_IGSTK;INSTALL_ALL_HEADERS" # possible options
${ARGN}
)
......@@ -562,15 +577,15 @@ macro(action_extension)
endif()
# Looking for codesynthesis XSD CXX
set(XSD_LIBRARIES)
if(${ACTION_NAME_CMAKE}_NEEDS_XSD)
# XercesC is required
find_package(XercesC REQUIRED)
if (XERCESC_FOUND)
include_directories(${XSD_INCLUDE_DIR})
include_directories(${XERCESC_INCLUDE_DIR})
find_package(XSD REQUIRED)
else()
# most probably win32 or crosscompiling
message(STATUS "${ACTION_NAME}: xerces-c required")
message(STATUS "${ACTION_NAME}: xerces-c required because of XSD cxx, please set XERCESC_INCLUDE_DIR")
endif()
endif()
......@@ -607,10 +622,10 @@ macro(action_extension)
# are set properly (gather_headers_and_sources include the call to Qt moc and uic)
gather_headers_and_sources(${ACTION_NAME_CMAKE})
# check for external sources
if(${ACTION_NAME_CMAKE}_EXTERNAL_SOURCES)
set(${ACTION_NAME_CMAKE}_SOURCES ${${ACTION_NAME_CMAKE}_SOURCES} ${${ACTION_NAME_CMAKE}_EXTERNAL_SOURCES})
endif()
# check for external sources
if(${ACTION_NAME_CMAKE}_EXTERNAL_SOURCES)
set(${ACTION_NAME_CMAKE}_SOURCES ${${ACTION_NAME_CMAKE}_SOURCES} ${${ACTION_NAME_CMAKE}_EXTERNAL_SOURCES})
endif()
# build the action extension module (library)
add_library(${ACTION_TARGET_NAME} SHARED ${${ACTION_NAME_CMAKE}_SOURCES})
......@@ -737,15 +752,15 @@ macro(application_extension)
endif()
# Looking for codesynthesis XSD CXX
set(XSD_LIBRARIES)
if(${APPLICATION_NAME_CMAKE}_NEEDS_XSD)
# XercesC is required
find_package(XercesC REQUIRED)
if (XERCESC_FOUND)
include_directories(${XSD_INCLUDE_DIR})
include_directories(${XERCESC_INCLUDE_DIR})
find_package(XSD REQUIRED)
else()
# most probably win32 or crosscompiling
message(STATUS "${APPLICATION_NAME}: xerces-c required")
message(STATUS "${APPLICATION_NAME}: xerces-c required because of XSD cxx, please set XERCESC_INCLUDE_DIR")
endif()
endif()
......
# - Try to find CamiTK
# This module can be used to find CamiTK.
# CamiTK can be either installed (CAMITK_IS_INSTALLED will be set to true) or
# not installed. In the latter this module will use the build directory
#
# Prior to calling find(CamiTK), you can set which version you like to use
# set(CAMITK_VER_MAJ "2")
# set(CAMITK_VER_MIN "1")
#
# Once this module has run, the following variables will be properly defined
# CAMITK_FOUND - system has CamiTK
# CAMITK_INSTALL_ROOT - root installation for CamiTK
# CAMITK_INCLUDE_DIRECTORIES - the CamiTK include directories
# CAMITK_LIBRARIES - link these to use CamiTK
# ...
# and all the other goodies
#
# Once found it is then easy to just use the CamiTK macros
# to build your extensions
# we need at least version 2.1
if(NOT CAMITK_VER_MAJ)
set(CAMITK_VER_MAJ "2")
set(CAMITK_VER_MIN "1")
endif()
# CamiTK short version name we are looking for
set(CAMITK_SHORT_VERSION_STRING "camitk-${CAMITK_VER_MAJ}.${CAMITK_VER_MIN}")
# first check if we can use the build version directly
find_path(CAMITK_ROOT_DIR_GUESS
NAMES CamiTKAPI.h
PATHS ${CMAKE_CURRENT_SOURCE_DIR}/../camitk/core
)
if (CAMITK_ROOT_DIR_GUESS)
set(CAMITK_IS_INSTALLED FALSE)
set(CAMITK_INSTALL_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/..) # default install dir
else()
set(CAMITK_IS_INSTALLED TRUE)
endif()
if (NOT CAMITK_INSTALL_ROOT)
# name of the camitk core lib (as defined in CamiTKVariables)
set(CAMITK_CORE_LIB_TEMP "camitkcore")
# directory structure from install dir to look for CamiTKAPI.h
set(CAMITK_INCLUDE_DIR_SUFFIX_TEMP "include/${CAMITK_SHORT_VERSION_STRING}/${CAMITK_CORE_LIB_TEMP}")
# find the caracteristic header using a (reasonably) long good list for the guess
find_path(CAMITK_ROOT_DIR_GUESS
NAMES CamiTKAPI.h
PATHS "/usr"
"/usr/local"
"C:/Programs"
"C:/Programs/camitk"
"C:/Dev"
"C:/Dev/camitk"
$ENV{CAMITK_DIR}
"${CMAKE_CURRENT_SOURCE_DIR}/.."
"${CMAKE_CURRENT_SOURCE_DIR}/../camitk"
"${CMAKE_CURRENT_SOURCE_DIR}/../camitktimc"
"${CMAKE_CURRENT_SOURCE_DIR}/../camitk-timc"
PATH_SUFFIXES "${CAMITK_INCLUDE_DIR_SUFFIX_TEMP}"
)
mark_as_advanced(CAMITK_ROOT_DIR_GUESS)
set(CAMITK_VERSION "${CAMITK_VER_MAJ}.${