Commit ab7a623e authored by jcfr's avatar jcfr

COMP: If a Logic directory exists in a modules directory, the directory will...

COMP: If a Logic directory exists in a modules directory, the directory will be automatically added.

The process allowing to build the 'Logic' library of a module had been factorized out.
That way the dedicated libray is build and both the QTModule and the regular Module can link against it.

There is not need to add Win32 header file or any configure header.

Using the macro Slicer3_build_module_logic automatically configure a file
of the form ${PROJECT_NAME}Export.h.
For example vtkSlicerTractographyModuleLogicExport.h where
name of the project is 'vtkSlicerTractographyModuleLogic'

Note also that the Logic sub-directory should *NOT* be included in the module
main CMakeLists.txt

As a convention, the module logic library should composed as described below:
  vtkSlicer[MODULE_NAME]ModuleLogic

git-svn-id: http://svn.slicer.org/Slicer4/trunk@11905 3bd1e089-480b-0410-8dfb-8563597acbee
parent 8d2f92a9
......@@ -3,6 +3,7 @@ PROJECT(Slicer3)
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
IF(COMMAND CMAKE_POLICY)
CMAKE_POLICY(SET CMP0003 NEW)
CMAKE_POLICY(SET CMP0012 NEW)
ENDIF(COMMAND CMAKE_POLICY)
MARK_AS_ADVANCED(CMAKE_BACKWARDS_COMPATIBILITY)
......@@ -177,8 +178,10 @@ option(Slicer3_USE_KWWIDGETS "Build Slicer3 with KWWidgets." ON)
#-----------------------------------------------------------------------------
# Since modules are KWWidgets based, unset there variables
IF (NOT Slicer3_USE_KWWIDGETS)
UNSET(Slicer3_INSTALL_MODULES_BIN_DIR)
UNSET(Slicer3_INSTALL_MODULES_LIB_DIR)
# Since the module Logic is shared between QTModules and regular Modules,
# the associated BIN and LIB directory shouldn't be unset
#UNSET(Slicer3_INSTALL_MODULES_BIN_DIR)
#UNSET(Slicer3_INSTALL_MODULES_LIB_DIR)
UNSET(Slicer3_INSTALL_MODULES_INCLUDE_DIR)
UNSET(Slicer3_INSTALL_MODULES_SHARE_DIR)
ENDIF (NOT Slicer3_USE_KWWIDGETS)
......@@ -486,6 +489,21 @@ slicer3_get_persistent_property(Slicer3_Base_LIBRARIES Slicer3_Base_LIBRARIES)
slicer3_get_persistent_property(Slicer3_Libs_INCLUDE_DIRS Slicer3_Libs_INCLUDE_DIRS)
slicer3_get_persistent_property(Slicer3_Base_INCLUDE_DIRS Slicer3_Base_INCLUDE_DIRS)
#-----------------------------------------------------------------------------
# Module Logic
INCLUDE("${Slicer3_CMAKE_DIR}/Slicer3ModuleLogicMacros.cmake")
INCLUDE("${Slicer3_CMAKE_DIR}/Slicer3ListSubDirectoriesMacro.cmake")
# Loop through Modules subdirectory and try to include Logic subdirectory if it exists
FILE(GLOB modules_subdirs RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} Modules/*)
FOREACH(subdir ${modules_subdirs})
IF(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${subdir}/Logic)
ADD_SUBDIRECTORY(${subdir}/Logic)
ENDIF()
ENDFOREACH()
#-----------------------------------------------------------------------------
# Modules and CLI
#
......
......@@ -16,8 +16,10 @@ if(NOT Slicer3_SOURCE_DIR)
endif(NOT Slicer3_SOURCE_DIR)
# --------------------------------------------------------------------------
# Warning - Do not include Logic subdirectory - This has been done in Slicer3/CMakeLists.txt
SET(Tractography_libs
Logic
Seeding
Settings
Display
......
......@@ -24,8 +24,8 @@ include_directories(
${CMAKE_CURRENT_BINARY_DIR}
${Slicer3_Libs_INCLUDE_DIRS}
${Slicer3_Base_INCLUDE_DIRS}
${SlicerTractographyLogic_SOURCE_DIR}
${SlicerTractographyLogic_BINARY_DIR}
${vtkSlicerTractographyModuleLogic_SOURCE_DIR}
${vtkSlicerTractographyModuleLogic_BINARY_DIR}
)
configure_file(
......@@ -75,7 +75,7 @@ target_link_libraries(${lib_name}
${Slicer3_Base_LIBRARIES}
${KWWidgets_LIBRARIES}
${ITK_LIBRARIES}
SlicerTractographyLogic
vtkSlicerTractographyModuleLogic
)
# Apply user-defined properties to the library target.
......
project(SlicerTractographyLogic)
project(vtkSlicerTractographyModuleLogic)
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
IF(COMMAND CMAKE_POLICY)
CMAKE_POLICY(SET CMP0003 NEW)
ENDIF(COMMAND CMAKE_POLICY)
MARK_AS_ADVANCED(CMAKE_BACKWARDS_COMPATIBILITY)
#
# See CMake/Slicer3ModuleLogicMacros.cmake for details
#
# --------------------------------------------------------------------------
# Find Slicer3
SET(module_logic_name "${PROJECT_NAME}")
if(NOT Slicer3_SOURCE_DIR)
find_package(Slicer3 REQUIRED)
include(${Slicer3_USE_FILE})
slicer3_set_default_install_prefix_for_external_projects()
endif(NOT Slicer3_SOURCE_DIR)
# The header '${PROJECT_NAME}Export.h' will be automatically configured.
SET(module_logic_export_directive "VTK_SLICER_TRACTOGRAPHY_MODULE_LOGIC_EXPORT")
# --------------------------------------------------------------------------
# Include dirs
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
${Slicer3_Libs_INCLUDE_DIRS}
${Slicer3_Base_INCLUDE_DIRS}
)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/vtkSlicerTractographyLogicConfigure.h.in
${CMAKE_CURRENT_BINARY_DIR}/vtkSlicerTractographyLogicConfigure.h
# Additional directories to include
SET(module_logic_include_directories
)
file(GLOB headers "${CMAKE_CURRENT_SOURCE_DIR}/*.h")
install(FILES
${headers}
"${CMAKE_CURRENT_BINARY_DIR}/vtkSlicerTractographyLogicConfigure.h"
DESTINATION ${Slicer3_INSTALL_MODULES_INCLUDE_DIR}/${PROJECT_NAME} COMPONENT Development
)
# --------------------------------------------------------------------------
# Sources
set(SlicerTractographyLogic_SRCS
# Source files
SET(module_logic_SRCS
vtkSlicerTractographyFiducialSeedingLogic.cxx
vtkMRMLTractographyFiducialSeedingNode.cxx
)
# --------------------------------------------------------------------------
# Wrapping
include("${VTK_CMAKE_DIR}/vtkWrapTcl.cmake")
vtk_wrap_tcl3(SlicerTractographyFiducialSeeding
SlicerTractographyLogic_TCL_SRCS
"${SlicerTractographyLogic_SRCS}" "")
# --------------------------------------------------------------------------
# Build and install the library
set(lib_name SlicerTractographyLogic)
add_library(${lib_name}
${SlicerTractographyLogic_SRCS}
${SlicerTractographyLogic_TCL_SRCS}
)
slicer3_set_modules_output_path(${lib_name})
target_link_libraries(${lib_name}
${Slicer3_Libs_LIBRARIES}
${Slicer3_Base_LIBRARIES}
# Additional Target libraries
SET(module_logic_target_libraries
${ITK_LIBRARIES}
)
# Apply user-defined properties to the library target.
IF(Slicer3_LIBRARY_PROPERTIES)
SET_TARGET_PROPERTIES(${lib_name} PROPERTIES
${Slicer3_LIBRARY_PROPERTIES}
Slicer3_build_module_logic(
NAME ${module_logic_name}
EXPORT_DIRECTIVE ${module_logic_export_directive}
INCLUDE_DIRECTORIES ${module_logic_include_directories}
SRCS ${module_logic_SRCS}
TARGET_LIBRARIES ${module_logic_target_libraries}
)
ENDIF(Slicer3_LIBRARY_PROPERTIES)
slicer3_install_modules(${lib_name})
# project(SlicerTractographyLogic)
#
# CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
# IF(COMMAND CMAKE_POLICY)
# CMAKE_POLICY(SET CMP0003 NEW)
# ENDIF(COMMAND CMAKE_POLICY)
# MARK_AS_ADVANCED(CMAKE_BACKWARDS_COMPATIBILITY)
#
#
# # --------------------------------------------------------------------------
# # Find Slicer3
#
# if(NOT Slicer3_SOURCE_DIR)
# find_package(Slicer3 REQUIRED)
# include(${Slicer3_USE_FILE})
# slicer3_set_default_install_prefix_for_external_projects()
# endif(NOT Slicer3_SOURCE_DIR)
#
# # --------------------------------------------------------------------------
# # Include dirs
#
# include_directories(
# ${CMAKE_CURRENT_SOURCE_DIR}
# ${CMAKE_CURRENT_BINARY_DIR}
# ${Slicer3_Libs_INCLUDE_DIRS}
# ${Slicer3_Base_INCLUDE_DIRS}
# )
#
# configure_file(
# ${CMAKE_CURRENT_SOURCE_DIR}/vtkSlicerTractographyLogicConfigure.h.in
# ${CMAKE_CURRENT_BINARY_DIR}/vtkSlicerTractographyLogicConfigure.h
# )
#
# file(GLOB headers "${CMAKE_CURRENT_SOURCE_DIR}/*.h")
# install(FILES
# ${headers}
# "${CMAKE_CURRENT_BINARY_DIR}/vtkSlicerTractographyLogicConfigure.h"
# DESTINATION ${Slicer3_INSTALL_MODULES_INCLUDE_DIR}/${PROJECT_NAME} COMPONENT Development
# )
#
# # --------------------------------------------------------------------------
# # Sources
#
# set(SlicerTractographyLogic_SRCS
# vtkSlicerTractographyFiducialSeedingLogic.cxx
# vtkMRMLTractographyFiducialSeedingNode.cxx
# )
#
# # --------------------------------------------------------------------------
# # Wrapping
#
# include("${VTK_CMAKE_DIR}/vtkWrapTcl.cmake")
# vtk_wrap_tcl3(SlicerTractographyFiducialSeeding
# SlicerTractographyLogic_TCL_SRCS
# "${SlicerTractographyLogic_SRCS}" "")
#
# # --------------------------------------------------------------------------
# # Build and install the library
#
# set(lib_name SlicerTractographyLogic)
# add_library(${lib_name}
# ${SlicerTractographyLogic_SRCS}
# ${SlicerTractographyLogic_TCL_SRCS}
# )
# slicer3_set_modules_output_path(${lib_name})
#
# target_link_libraries(${lib_name}
# ${Slicer3_Libs_LIBRARIES}
# ${Slicer3_Base_LIBRARIES}
# ${ITK_LIBRARIES}
# )
#
# # Apply user-defined properties to the library target.
# IF(Slicer3_LIBRARY_PROPERTIES)
# SET_TARGET_PROPERTIES(${lib_name} PROPERTIES
# ${Slicer3_LIBRARY_PROPERTIES}
# )
# ENDIF(Slicer3_LIBRARY_PROPERTIES)
#
# slicer3_install_modules(${lib_name})
#
......@@ -22,11 +22,13 @@
#include "vtkTransform.h"
#include "vtkImageData.h"
#include "vtkSlicerTractographyLogic.h"
//#include "vtkSlicerTractographyLogic.h"
#include "vtkSlicerTractographyModuleLogicExport.h"
class vtkImageData;
class VTK_TRCACTOGRAPHYLOGIC_EXPORT vtkMRMLTractographyFiducialSeedingNode : public vtkMRMLNode
class VTK_SLICER_TRACTOGRAPHY_MODULE_LOGIC_EXPORT vtkMRMLTractographyFiducialSeedingNode :
public vtkMRMLNode
{
public:
static vtkMRMLTractographyFiducialSeedingNode *New();
......
......@@ -26,7 +26,8 @@
#include "vtkSlicerModuleLogic.h"
#include "vtkSlicerTractographyLogic.h"
//#include "vtkSlicerTractographyLogic.h"
#include "vtkSlicerTractographyModuleLogicExport.h"
class vtkMRMLDiffusionTensorVolumeNode;
class vtkMRMLFiducialListNode;
......@@ -34,7 +35,8 @@ class vtkMRMLFiberBundleNode;
class vtkMRMLTransformableNode;
class vtkMaskPoints;
class VTK_TRCACTOGRAPHYLOGIC_EXPORT vtkSlicerTractographyFiducialSeedingLogic : public vtkSlicerModuleLogic
class VTK_SLICER_TRACTOGRAPHY_MODULE_LOGIC_EXPORT vtkSlicerTractographyFiducialSeedingLogic :
public vtkSlicerModuleLogic
{
public:
......
/*=auto=========================================================================
Portions (c) Copyright 2005 Brigham and Women's Hospital (BWH) All Rights Reserved.
See Doc/copyright/copyright.txt
or http://www.slicer.org/copyright/copyright.txt for details.
Program: 3D Slicer
Module: $RCSfile: vtkGradientAnisotropicDiffusionFilter.h,v $
Date: $Date: 2006/01/06 17:56:51 $
Version: $Revision: 1.6 $
=========================================================================auto=*/
/*
* This is needed for loading slicer code as module.
* Added here to isolate the changes to the main files in case
* further mods are needed.
* - sp 2002-04-19
*/
//
// use an ifdef on Slicer3_VTK5 to flag code that won't
// compile on vtk4.4 and before
//
#if ( (VTK_MAJOR_VERSION >= 5) || ( VTK_MAJOR_VERSION == 4 && VTK_MINOR_VERSION >= 5 ) )
#define Slicer3_VTK5
#endif
#include "vtkSlicerTractographyLogicWin32Header.h"
/*
* Here is where system computed values get stored.
* These values should only change when the target compile platform changes.
*/
#include "vtkSlicerConfigure.h"
#cmakedefine BUILD_SHARED_LIBS
#ifndef BUILD_SHARED_LIBS
#define VTKSLICER_STATIC
#endif
/*=auto=========================================================================
Portions (c) Copyright 2005 Brigham and Women's Hospital (BWH) All Rights Reserved.
See Doc/copyright/copyright.txt
or http://www.slicer.org/copyright/copyright.txt for details.
Program: 3D Slicer
Module: $RCSfile: vtkFiducilaSeedingWin32Header.h,v $
Date: $Date: 2006/01/06 17:56:51 $
Version: $Revision: 1.4 $
=========================================================================auto=*/
// .NAME vtkFiducilaSeedingWin32Header - manage Windows system differences
// .SECTION Description
// The vtkFiducilaSeedingWin32Header captures some system differences between Unix
// and Windows operating systems.
#ifndef __vtkSlicerTractographyLogicWin32Header_h
#define __vtkSlicerTractographyLogicWin32Header_h
#include <vtkSlicerTractographyLogicConfigure.h>
#if defined(WIN32) && !defined(VTKSLICER_STATIC)
#if defined(SlicerTractographyLogic_EXPORTS)
#define VTK_TRCACTOGRAPHYLOGIC_EXPORT __declspec( dllexport )
#else
#define VTK_TRCACTOGRAPHYLOGIC_EXPORT __declspec( dllimport )
#endif
#else
#define VTK_TRCACTOGRAPHYLOGIC_EXPORT
#endif
#endif
......@@ -3,13 +3,10 @@ SET(qt_module_name "TractographyFiducialSeeding")
SET(qt_module_export_directive "Q_SLICER_QTMODULES_TRACTOGRAPHYFIDUCIALSEEDING_EXPORT")
# Additional includes (Current_{source,binary} and Slicer3_{Libs,Base} already included)
SET(qt_module_include_directories
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
${Slicer3_Libs_INCLUDE_DIRS}
${Slicer3_Base_INCLUDE_DIRS}
${SlicerTractographyLogic_SOURCE_DIR}
${SlicerTractographyLogic_BINARY_DIR}
${vtkSlicerTractographyModuleLogic_SOURCE_DIR}
${vtkSlicerTractographyModuleLogic_BINARY_DIR}
)
# Source files
......@@ -32,10 +29,7 @@ SET(qt_module_UI_SRCS
# Additional Target libraries
SET(qt_module_target_libraries
#${KWWidgets_LIBRARIES}
#${ITK_LIBRARIES}
#CommandLineModule
SlicerTractographyLogic
vtkSlicerTractographyModuleLogic
)
# Resources
......
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