## == Build different parts ==
## ===========================
-#SUBDIRS(appli cmake lib plugins)
-SUBDIRS(appli lib plugins)
+SUBDIRS(appli cmake lib plugins)
## eof - $RCSfile$
#define cpPlugins_CONFIG_DIFFUSIONTENSORS "@cpPlugins_CONFIG_DIFFUSIONTENSORS@"
#define cpPlugins_CONFIG_MATRICES "@cpPlugins_CONFIG_MATRICES@"
#define cpPlugins_ALL_CONFIGS "@cpPlugins_ALL_CONFIGS@"
+#define cpPlugins_CONFIG_NUMBER_OF_FILES @cpPlugins_CONFIG_NUMBER_OF_FILES@
// -------------------------------------------------------------------------
#define cpPlugins_bash_OS_@CMAKE_SYSTEM_NAME@
int main( int argc, char* argv[] )
{
// Get inputs
- if( argc < 5 )
+ if( argc < 4 )
{
std::cerr
<< "Usage: " << argv[ 0 ]
- << " definitons_file library_name output_path number_of_sources"
+ << " definitons_file library_name output_prefix"
<< std::endl;
return( 1 );
} // fi
std::string definitions_filename = argv[ 1 ];
std::string library_name = argv[ 2 ];
- std::string output_path = argv[ 3 ];
- unsigned int number_of_sources = std::atoi( argv[ 4 ] );
+ std::string output_prefix = argv[ 3 ];
+ unsigned int number_of_sources = cpPlugins_CONFIG_NUMBER_OF_FILES;
// Read inputs
std::string definitions_buffer;
// Write header
std::stringstream header_filename;
- header_filename << output_path << "/" << library_name << ".h";
+ header_filename << output_prefix << ".h";
if( !( cpPlugins_bash::Write( header.str( ), header_filename.str( ) ) ) )
{
std::cerr << "Error writing header file." << std::endl;
<< "#include <" << library_name << "_Export.h>"
<< std::endl;
source
- << "#include <" << output_path<< "/" << library_name << ".h>"
+ << "#include <" << output_prefix << ".h>"
<< std::endl << std::endl;
if( tfiles.size( ) > 0 )
{
source << std::endl << "// eof" << std::endl;
std::stringstream source_file;
source_file
- << output_path << "/" << library_name << "_" << f_id << ".cxx";
+ << output_prefix << "_" << f_id << ".cxx";
if( !( cpPlugins_bash::Write( source.str( ), source_file.str( ) ) ) )
{
std::cerr << "Error writing source code." << std::endl;
## -------------------------------------------------------------------------
FUNCTION(
PrepareSourceFiles
+ out_lib_name
out_sources_list
out_headers_list
out_headers_paths
SET(_headers_extensions .h .hpp .hxx)
SET(_qt_ui_extensions .ui)
SET(_demangler_extensions .d)
+SET(_instances_extensions .i)
## -- Configure inputs
SET(_all_files)
SET(_hdrs)
SET(_qts)
SET(_demanglers)
+SET(_instances)
FOREACH(_file ${_all_files})
GET_FILENAME_COMPONENT(_ext ${_file} EXT)
LIST(FIND _sources_extensions ${_ext} _src)
LIST(FIND _headers_extensions ${_ext} _hdr)
LIST(FIND _qt_ui_extensions ${_ext} _ui)
LIST(FIND _demangler_extensions ${_ext} _dem)
+ LIST(FIND _instances_extensions ${_ext} _ins)
IF(NOT ${_src} EQUAL -1)
LIST(APPEND _srcs ${_file})
ENDIF(NOT ${_src} EQUAL -1)
IF(NOT ${_dem} EQUAL -1)
LIST(APPEND _demanglers ${_file})
ENDIF(NOT ${_dem} EQUAL -1)
+ IF(NOT ${_ins} EQUAL -1)
+ LIST(APPEND _instances ${_file})
+ ENDIF(NOT ${_ins} EQUAL -1)
ENDFOREACH(_file)
# -- Prepare Qt4-based code
LIST(APPEND _hdrs ${_d_out})
ENDFOREACH(_d)
+## -- Create instances
+FOREACH(_i ${_instances})
+ STRING(
+ REPLACE
+ ${PROJECT_SOURCE_DIR}
+ ${PROJECT_BINARY_DIR}
+ _i_bin
+ ${_i}
+ )
+ GET_FILENAME_COMPONENT(_i_path ${_i_bin} DIRECTORY)
+ GET_FILENAME_COMPONENT(_out_name ${_i} NAME_WE)
+
+ ## -- Infere source code filenames
+ MATH(EXPR _last_range "${cpPlugins_CONFIG_NUMBER_OF_FILES}-1")
+ SET(_out_code "${_i_path}/${_out_name}.h")
+ LIST(APPEND _hdrs ${_i_path}/${_out_name}.h)
+ FOREACH(_n RANGE 0 ${_last_range})
+ LIST(APPEND _out_code ${_i_path}/${_out_name}_${_n}.cxx)
+ LIST(APPEND _srcs ${_i_path}/${_out_name}_${_n}.cxx)
+ ENDFOREACH(_n)
+
+ ## -- Command to write source code
+ ADD_CUSTOM_COMMAND(
+ OUTPUT ${_out_code}
+ DEPENDS ${cpPlugins_bash_CreateInstances_APP} ${_i}
+ COMMAND ${CMAKE_COMMAND} -E make_directory ${_i_path}
+ COMMAND ${cpPlugins_bash_CreateInstances_APP} ${_i} ${out_lib_name} ${_i_path}/${_out_name}
+ )
+ENDFOREACH(_i)
+
## -- Real compilation
SET(_hdrs_paths)
FOREACH(_hdr ${_hdrs})
lib_name
lib_type
)
-PrepareSourceFiles(_srcs _hdrs _paths ${ARGN})
+PrepareSourceFiles(${lib_name} _srcs _hdrs _paths ${ARGN})
INCLUDE_DIRECTORIES(
${_paths}
${CMAKE_CURRENT_SOURCE_DIR}
CreateLib(${lib_name} ${lib_type} ${_files} ${ARGN})
ENDFUNCTION()
-## -------------------------------------------------------------------------
-FUNCTION(
- CompileInstances
- out_lib_name
- def_file
- number_of_files
- )
-
-### -- Configure inputs to be cmake-path compatible
-SET(_src_dir ${CMAKE_CURRENT_SOURCE_DIR})
-SET(_bin_dir ${CMAKE_CURRENT_BINARY_DIR})
-SET(_def_file "${_src_dir}/${def_file}")
-
-## -- Infere source code filenames
-MATH(EXPR _last_range "${number_of_files}-1")
-SET(_out_code "${_bin_dir}/${out_lib_name}.h")
-FOREACH(_n RANGE 0 ${_last_range})
- LIST(APPEND _out_code ${_bin_dir}/${out_lib_name}_${_n}.cxx)
-ENDFOREACH(_n)
-
-## -- Command to write source code
-ADD_CUSTOM_COMMAND(
- OUTPUT ${_out_code}
- DEPENDS ${cpPlugins_bash_CreateInstances_APP} ${_def_file}
- COMMAND ${cpPlugins_bash_CreateInstances_APP} ${_def_file} ${out_lib_name} ${_bin_dir} ${number_of_files}
- )
-
-## -- Create library
-CreateLib(${out_lib_name} SHARED "${_out_code}")
-
-ENDFUNCTION()
-
## -------------------------------------------------------------------------
FUNCTION(
CreatePlugin
lib_name
lib_dir
- number_of_files
)
-
GET_FILENAME_COMPONENT(_lib_dir ${lib_dir} REALPATH)
FILE(GLOB_RECURSE _files "${_lib_dir}/*")
SET(_hdr_to_wrap)
-SET(_instances)
FOREACH(_file ${_files})
FILE(READ ${_file} _txt)
STRING(FIND "${_txt}" "cpPluginsObject" _res)
IF(NOT ${_res} EQUAL -1)
LIST(APPEND _hdr_to_wrap ${_file})
ENDIF(NOT ${_res} EQUAL -1)
- GET_FILENAME_COMPONENT(_ext ${_file} EXT)
- IF(${_ext} STREQUAL ".i")
- LIST(APPEND _instances ${_file})
- ENDIF(${_ext} STREQUAL ".i")
ENDFOREACH(_file)
-IF(_instances)
- FOREACH(_instance ${_instances})
- STRING(
- REPLACE
- ${PROJECT_SOURCE_DIR}
- ${PROJECT_BINARY_DIR}
- _out_dir
- ${_lib_dir}
- )
- MATH(EXPR _last_range "${number_of_files}-1")
- SET(_out_code "${_out_dir}/${lib_name}.h")
- FOREACH(_n RANGE 0 ${_last_range})
- LIST(APPEND _out_code ${_out_dir}/${lib_name}_${_n}.cxx)
- ENDFOREACH(_n)
-
- ADD_CUSTOM_COMMAND(
- OUTPUT ${_out_code}
- DEPENDS ${cpPlugins_bash_CreateInstances_APP} ${_instance}
- COMMAND ${CMAKE_COMMAND} -E make_directory ${_out_dir}
- COMMAND ${cpPlugins_bash_CreateInstances_APP} ${_instance} ${lib_name} ${_out_dir} ${number_of_files}
- )
- LIST(APPEND _files ${_out_code})
- ENDFOREACH(_instance)
-ENDIF(_instances)
-
IF(_hdr_to_wrap)
STRING(
REPLACE
OPTION(BUILD_${app_name} "Build ${app_name}" OFF)
IF(BUILD_${app_name})
FILE(GLOB_RECURSE _files "${app_dir}/*")
- PrepareSourceFiles(_srcs _hdrs _paths ${_files} ${ARGN})
+ PrepareSourceFiles(${app_name} _srcs _hdrs _paths ${_files} ${ARGN})
INCLUDE_DIRECTORIES(
${_paths}
${CMAKE_CURRENT_SOURCE_DIR}
## == Find include directories ==
## ==============================
-#SET(cpPlugins_All_Headers "@cpPlugins_All_Headers@" CACHE STRING "Internal")
-#MARK_AS_ADVANCED(FORCE cpPlugins_All_Headers)
-#SET(_header_paths
-# "@PROJECT_SOURCE_DIR@/lib"
-# "@PROJECT_BINARY_DIR@/lib"
-# "@PROJECT_SOURCE_DIR@/lib/Instances"
-# "@PROJECT_BINARY_DIR@/lib/Instances"
-# "@CMAKE_INSTALL_PREFIX@/include"
-# )
-#FOREACH(_h ${cpPlugins_All_Headers})
-# GET_FILENAME_COMPONENT(_h_name ${_h} NAME)
-# GET_FILENAME_COMPONENT(_h_dir ${_h} DIRECTORY)
-# FIND_PATH(
-# _loc_${_h_name} ${_h_name}
-# HINTS
-# ${_header_paths}
-# ${_h_dir}
-# )
-# IF(_loc_${_h_name})
-# LIST(APPEND _header_paths ${_loc_${_h_name}})
-# LIST(REMOVE_DUPLICATES _header_paths)
-# ELSE(_loc_${_h_name})
-# MESSAGE(FATAL_ERROR "Please configure where is ${_h_name}")
-# ENDIF(_loc_${_h_name})
-#ENDFOREACH(_h ${cpPlugins_All_Headers})
-#MESSAGE(STATUS ${_header_paths})
-
## TODO: this is not completely correct!!!
INCLUDE_DIRECTORIES(
@CMAKE_INSTALL_PREFIX@/include
TARGET_LINK_LIBRARIES(
cpBaseQtApplication
cpPlugins cpExtensions
- )
+ )
ENDIF(USE_QT4)
+CompileLibFromDir(cpPluginsExtensions SHARED cpPluginsExtensions)
+TARGET_LINK_LIBRARIES(cpPluginsExtensions cpPlugins cpExtensions)
+
+## ====================
+## == Base libraries ==
+## ====================
+
+IF(USE_QT4)
+ SET(
+ cpPlugins_BaseLibraries
+ cp_tinyxml2
+ cp_QCustomPlot
+ cpExtensions
+ cpPlugins
+ CACHE INTERNAL "All locally compiled libraries." FORCE
+ )
+ELSE(USE_QT4)
+ SET(
+ cpPlugins_BaseLibraries
+ cp_tinyxml2
+ cpExtensions
+ cpPlugins
+ CACHE INTERNAL "All locally compiled libraries." FORCE
+ )
+ENDIF(USE_QT4)
+
+## ===================================
+## == Libraries to dynamically load ==
+## ===================================
+
+SET(_pre ${CMAKE_SHARED_LIBRARY_PREFIX})
+SET(_suf ${CMAKE_SHARED_LIBRARY_SUFFIX})
+
+SET(cpPlugins_DynLibs "${CMAKE_INSTALL_PREFIX}/bin/${_pre}cpExtensions${_suf}")
+LIST(APPEND cpPlugins_DynLibs "${CMAKE_INSTALL_PREFIX}/lib/${_pre}cpExtensions${_suf}")
+LIST(APPEND cpPlugins_DynLibs "${LIBRARY_OUTPUT_PATH}/${_pre}cpExtensions${_suf}")
+FOREACH(_lib ${cpPlugins_Instances})
+ LIST(APPEND cpPlugins_DynLibs "${CMAKE_INSTALL_PREFIX}/bin/${_pre}${_lib}${_suf}")
+ LIST(APPEND cpPlugins_DynLibs "${CMAKE_INSTALL_PREFIX}/lib/${_pre}${_lib}${_suf}")
+ LIST(APPEND cpPlugins_DynLibs "${LIBRARY_OUTPUT_PATH}/${_pre}${_lib}${_suf}")
+ENDFOREACH(_lib)
+LIST(APPEND cpPlugins_DynLibs "${VTK_INSTALL_PREFIX}/bin/*vtk*${_suf}")
+LIST(APPEND cpPlugins_DynLibs "${VTK_INSTALL_PREFIX}/lib/*vtk*${_suf}")
+LIST(APPEND cpPlugins_DynLibs "${ITK_INSTALL_PREFIX}/bin/*itk*${_suf}")
+LIST(APPEND cpPlugins_DynLibs "${ITK_INSTALL_PREFIX}/lib/*itk*${_suf}")
+LIST(APPEND cpPlugins_DynLibs "${ITK_INSTALL_PREFIX}/bin/*ITK*${_suf}")
+LIST(APPEND cpPlugins_DynLibs "${ITK_INSTALL_PREFIX}/lib/*ITK*${_suf}")
+FILE(WRITE ${PROJECT_BINARY_DIR}/cpPlugins_Libraries.config "")
+FOREACH(_lib ${cpPlugins_DynLibs})
+ FILE(APPEND ${PROJECT_BINARY_DIR}/cpPlugins_Libraries.config "${_lib}\n")
+ENDFOREACH(_lib)
+
## eof - $RCSfile$
header #define ITK_MANUAL_INSTANTIATION
define arrays=Array2D;Array;#color_pixels#
-define fixed_dims=#visual_dims#;4;6;8
+define fixed_dims=#visual_dims#;1;4;6;8
tinclude itk#arrays#:h|hxx
tinclude itkFixedArray:h|hxx
SET(_all_libs)
FOREACH(_def ${_all_defs})
SET(_name ${_p}${_def})
- CompileInstances(
- ${_name}
- ${_def}.i
- ${cpPlugins_CONFIG_NUMBER_OF_FILES}
- )
+ CreateLib(${_name} SHARED ${CMAKE_CURRENT_SOURCE_DIR}/${_def}.i)
LIST(APPEND _all_libs ${_name})
ENDFOREACH(_def)
SET(
-#include <Extensions/PolyLineParametricPath.h>
+#include <cpPluginsExtensions/PolyLineParametricPath.h>
#include <cpExtensions/Visualization/PolyLineParametricPathToPolyData.h>
#include <cpExtensions/DataStructures/PolyLineParametricPath.h>
#include <cpPluginsExtensions_Export.h>
#include <cpPlugins/BaseObjects/DataObject.h>
-#include <Extensions/PolyLineParametricPath_Demanglers.h>
+#include <cpPluginsExtensions/PolyLineParametricPath_Demanglers.h>
#include <vtkSmartPointer.h>
// -------------------------------------------------------------------------
-#include <Extensions/Simple3DCurve.h>
+#include <cpPluginsExtensions/Simple3DCurve.h>
#include <cpExtensions/DataStructures/Simple3DCurve.h>
#include <cpExtensions/Visualization/Simple3DCurveToPolyData.h>
#include <cpPluginsExtensions_Export.h>
#include <cpPlugins/BaseObjects/DataObject.h>
#include <vtkSmartPointer.h>
-#include <Extensions/Simple3DCurve_Demanglers.h>
+#include <cpPluginsExtensions/Simple3DCurve_Demanglers.h>
// -------------------------------------------------------------------------
class vtkPolyDataAlgorithm;
-#include <Extensions/Skeleton.h>
+#include <cpPluginsExtensions/Skeleton.h>
#include <cpExtensions/Visualization/SkeletonToPolyData.h>
#include <cpExtensions/DataStructures/Skeleton.h>
#include <cpPluginsExtensions_Export.h>
#include <cpPlugins/BaseObjects/DataObject.h>
-#include <Extensions/Skeleton_Demanglers.h>
+#include <cpPluginsExtensions/Skeleton_Demanglers.h>
#include <vtkSmartPointer.h>
// -------------------------------------------------------------------------
SET(
_dirlist
- Extensions
AnisotropicDiffusion
GenericFilters
ImageArithmeticFilters
Widgets
)
-#IF(ParabolicMorphology_LOADED)
-# LIST(APPEND _dirlist ImageParaMorphologyFilters)
-#ENDIF(ParabolicMorphology_LOADED)
+IF(ParabolicMorphology_LOADED)
+ LIST(APPEND _dirlist ImageParaMorphologyFilters)
+ENDIF(ParabolicMorphology_LOADED)
## ===============================
## == Build each plugin library ==
${PROJECT_BINARY_DIR}/lib/Instances
)
FOREACH(_dir ${_dirlist})
- CreatePlugin(cpPlugins${_dir} ${_dir} ${cpPlugins_CONFIG_NUMBER_OF_FILES})
+ CreatePlugin(cpPlugins${_dir} ${_dir})
TARGET_LINK_LIBRARIES(
cpPlugins${_dir}
cpPlugins cpExtensions
cpPluginsIO
cpPluginsExtensions
)
-
-#TARGET_LINK_LIBRARIES(
-# cpPluginsImageDistanceMaps
-# cpPluginsImageThresholdFilters
-# )
-#TARGET_LINK_LIBRARIES(
-# cpPluginsImageSliceFilters
-# cpPluginsImageGenericFilters
-# )
-#TARGET_LINK_LIBRARIES(
-# cpPluginsImageGradientFilters
-# cpPluginsImageGenericFilters
-# )
-#IF(ParabolicMorphology_LOADED)
-# TARGET_LINK_LIBRARIES(
-# cpPluginsImageParaMorphologyFilters
-# cpPluginsImageThresholdFilters
-# )
-#ENDIF(ParabolicMorphology_LOADED)
+TARGET_LINK_LIBRARIES(
+ cpPluginsImageDistanceMaps
+ cpPluginsImageThresholdFilters
+ )
+TARGET_LINK_LIBRARIES(
+ cpPluginsGenericFilters
+ cpPluginsExtensions
+ )
+TARGET_LINK_LIBRARIES(
+ cpPluginsImageSliceFilters
+ cpPluginsImageGenericFilters
+ cpPluginsExtensions
+ )
+TARGET_LINK_LIBRARIES(
+ cpPluginsImageGradientFilters
+ cpPluginsImageGenericFilters
+ )
+IF(ParabolicMorphology_LOADED)
+ TARGET_LINK_LIBRARIES(
+ cpPluginsImageParaMorphologyFilters
+ cpPluginsImageThresholdFilters
+ )
+ENDIF(ParabolicMorphology_LOADED)
## eof - $RSCfile$
#include <GenericFilters/PolyLineParametricPathToSimple3DCurve.h>
-#include <Extensions/PolyLineParametricPath.h>
-#include <Extensions/Simple3DCurve.h>
+#include <cpPluginsExtensions/PolyLineParametricPath.h>
+#include <cpPluginsExtensions/Simple3DCurve.h>
#include <cpExtensions/DataStructures/PolyLineParametricPath.h>
#include <cpExtensions/DataStructures/Simple3DCurve.h>
#include <IO/ImageJSkeletonWriter.h>
#include <cpPlugins/QT/SaveFileDialog.h>
-#include <Extensions/Skeleton.h>
+#include <cpPluginsExtensions/Skeleton.h>
#include <cpExtensions/DataStructures/Skeleton.h>
#include <cpExtensions/Utility.h>
#include <ImageSliceFilters/CPRImageFilter.h>
#include <cpPlugins/DataObjects/Image.h>
-#include <Extensions/Simple3DCurve.h>
+#include <cpPluginsExtensions/Simple3DCurve.h>
#include <itkImage.h>
#include <cpExtensions/DataStructures/Simple3DCurve.h>