]> Creatis software - FrontAlgorithms.git/commitdiff
...
authorLeonardo Flórez-Valencia <florez-l@javeriana.edu.co>
Tue, 26 Sep 2017 21:22:49 +0000 (16:22 -0500)
committerLeonardo Flórez-Valencia <florez-l@javeriana.edu.co>
Tue, 26 Sep 2017 21:22:49 +0000 (16:22 -0500)
23 files changed:
CMakeLists.txt
cmake/Definitions.cmake [new file with mode: 0644]
cmake/Functions.cmake [new file with mode: 0644]
cmake/InstallCommands.cmake [new file with mode: 0644]
examples/CMakeLists.txt [moved from tests/CMakeLists.txt with 72% similarity]
examples/image/CMakeLists.txt [moved from tests/image/CMakeLists.txt with 75% similarity]
examples/image/Dijkstra/CMakeLists.txt [moved from tests/image/Dijkstra/CMakeLists.txt with 75% similarity]
examples/image/Dijkstra/ExtractAxis.cxx [moved from tests/image/Dijkstra/ExtractAxis.cxx with 100% similarity]
examples/image/Dijkstra/ExtractSkeleton.cxx [moved from tests/image/Dijkstra/ExtractSkeleton.cxx with 100% similarity]
examples/image/Dijkstra/Gaussian.cxx [moved from tests/image/Dijkstra/Gaussian.cxx with 100% similarity]
examples/image/Dijkstra/Identity.cxx [moved from tests/image/Dijkstra/Identity.cxx with 100% similarity]
examples/image/Dijkstra/Invert.cxx [moved from tests/image/Dijkstra/Invert.cxx with 100% similarity]
examples/image/RandomWalker/CMakeLists.txt [moved from tests/image/RandomWalker/CMakeLists.txt with 58% similarity]
examples/image/RandomWalker/CompareRandomWalkers.cxx [moved from tests/image/RandomWalker/CompareRandomWalkers.cxx with 100% similarity]
examples/image/RandomWalker/Gaussian.cxx [moved from tests/image/RandomWalker/Gaussian.cxx with 100% similarity]
examples/image/RandomWalker/Original.cxx [moved from tests/image/RandomWalker/Original.cxx with 100% similarity]
examples/image/RegionGrow/BinaryThreshold.cxx [moved from tests/image/RegionGrow/BinaryThreshold.cxx with 100% similarity]
examples/image/RegionGrow/CMakeLists.txt [moved from tests/image/RegionGrow/CMakeLists.txt with 73% similarity]
examples/image/RegionGrow/Mori.cxx [moved from tests/image/RegionGrow/Mori.cxx with 100% similarity]
examples/image/RegionGrow/Tautology.cxx [moved from tests/image/RegionGrow/Tautology.cxx with 100% similarity]
lib/CMakeLists.txt
lib/fpa/CMakeLists.txt
lib/fpa/Config.h.in

index b11c77cfe0293f6002d4837e1df9d860b351d492..260cb37c04b7e3b72a997c1ab7c8c799229d4d25 100644 (file)
@@ -1,25 +1,22 @@
+#find_package(Eigen3 CONFIG REQUIRED)
+#include(${EIGEN3_USE_FILE})
+
 ## =========================================================================
-## @author Leonardo Florez Valencia
-## @email florez-l@javeriana.edu.co
+## @author Leonardo Florez-Valencia (florez-l@javeriana.edu.co)
 ## =========================================================================
 
 cmake_minimum_required(VERSION 3.0)
 
-## ========================
-## == Project definition ==
-## ========================
-
-set(prj_MAJ_VER 0)
-set(prj_MIN_VER 1)
-set(prj_REL_VER 0)
-set(prj_VER "${prj_MAJ_VER}.${prj_MIN_VER}.${prj_REL_VER}")
-set(prj_SHORT_VER "${prj_MAJ_VER}")
-project(fpa VERSION ${prj_VER})
+## == Basic project configuration
+set(prj_NAME fpa)
+set(prj_MAJ 1)
+set(prj_MIN 0)
+set(prj_REL 0)
 
-## ==========================
-## == Some useful policies ==
-## ==========================
+## == Project definition
+project(${prj_NAME} VERSION "${prj_MAJ}.${prj_MIN}.${prj_REL}")
 
+## == Project policies
 set(_policies CMP0015 CMP0020 CMP0042 CMP0053)
 foreach(_p ${_policies})
   if(POLICY ${_p})
@@ -27,125 +24,29 @@ foreach(_p ${_policies})
   endif(POLICY ${_p})
 endforeach(_p)
 
-## =========================================================
-## == If working on a MacOSX, activate the use of RPATH's ==
-## ==   Furthermore: prepare the type of executables      ==
-## =========================================================
-
-set(EXECUTABLE_TYPE "" CACHE STRING "Executable linking." FORCE)
-if(APPLE)
-  set(EXECUTABLE_TYPE "MACOSX_BUNDLE" CACHE STRING "Executable linking." FORCE)
-  set(CMAKE_MACOSX_RPATH true CACHE BOOL "Use RPATH's on MacOSX." FORCE)
-  mark_as_advanced(CMAKE_MACOSX_RPATH)
-elseif(WIN32)
-  set(EXECUTABLE_TYPE "WIN32" CACHE STRING "Executable linking." FORCE)
-endif(APPLE)
-mark_as_advanced(EXECUTABLE_TYPE)
-
-## =======================================================================
-## == Force c++11 language version                                      ==
-## == NOTE: It seems that by default on Visual Studio Compiler supports ==
-## ==       c++11, so it only need to be tested on other OS.            ==
-## =======================================================================
-
-if(NOT MSVC)
-  include(CheckCXXCompilerFlag)
-  check_cxx_compiler_flag("-std=c++11" COMPILER_SUPPORTS_CXX11)
-  if(COMPILER_SUPPORTS_CXX11)
-    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
-  else(COMPILER_SUPPORTS_CXX11)
-    check_cxx_compiler_flag("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
-    if(COMPILER_SUPPORTS_CXX0X)
-      set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
-    else(COMPILER_SUPPORTS_CXX0X)
-      message(
-        FATAL_ERROR
-        "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support."
-        )
-    endif(COMPILER_SUPPORTS_CXX0X)
-  endif(COMPILER_SUPPORTS_CXX11)
-endif(NOT MSVC)
-
-## ===================================================
-## == Prepare header generator to build shared libs ==
-## ===================================================
-
-include(GenerateExportHeader)
-
-## ==================================================
-## == Do not allow to build inside the source tree ==
-## ==================================================
-
-if(PROJECT_BINARY_DIR STREQUAL ${PROJECT_SOURCE_DIR})
-  message(FATAL_ERROR "Building in the source tree is not allowed.")
-endif(PROJECT_BINARY_DIR STREQUAL ${PROJECT_SOURCE_DIR})
-
-## =================================================
-## == Where to put targets (executables and libs) ==
-## =================================================
-
-set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR})
-set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR})
-mark_as_advanced(
-  CMAKE_BACKWARDS_COMPATIBILITY
-  EXECUTABLE_OUTPUT_PATH
-  LIBRARY_OUTPUT_PATH
-  )
-
-## ===========================================
-## == Find needed packages and dependencies ==
-## ===========================================
-
-find_package(ITK CONFIG REQUIRED)
-include(${ITK_USE_FILE})
-if(ITKVtkGlue_LOADED)
-  find_package(VTK CONFIG REQUIRED)
-  include(${VTK_USE_FILE})
-endif(ITKVtkGlue_LOADED)
-
-find_package(Eigen3 CONFIG REQUIRED)
-include(${EIGEN3_USE_FILE})
-
-## =========================
-## == Installation values ==
-## =========================
-
-set(config_install_dir "lib/cmake/${PROJECT_NAME}")
-set(include_install_dir "include")
-set(generated_dir "${CMAKE_CURRENT_BINARY_DIR}/generated")
-set(version_config "${generated_dir}/${PROJECT_NAME}ConfigVersion.cmake")
-set(project_config "${generated_dir}/${PROJECT_NAME}Config.cmake")
-set(targets_export_name "${PROJECT_NAME}Targets")
-set(namespace "${PROJECT_NAME}::")
-
-## ===========================
-## == Build different parts ==
-## ===========================
-
-subdirs(appli lib tests)
-
-## ===============================
-## == Global installation rules ==
-## ===============================
-
-include(CMakePackageConfigHelpers)
-write_basic_package_version_file(
-  "${version_config}" COMPATIBILITY SameMajorVersion
-  )
-configure_package_config_file(
-  "cmake/${PROJECT_NAME}Config.cmake.in"
-  "${project_config}"
-  INSTALL_DESTINATION "${config_install_dir}"
-  )
-install(
-  EXPORT "${targets_export_name}"
-  NAMESPACE "${namespace}"
-  DESTINATION "${config_install_dir}"
-  )
-install(
-  FILES "${project_config}"
-  DESTINATION "${config_install_dir}"
-  )
+## == Some general configuration
+include(cmake/Definitions.cmake)
+include(cmake/Functions.cmake)
+
+## == Find cpPlugins
+find_package(cpPlugins CONFIG)
+if(NOT cpPlugins_FOUND)
+  ## == Find individual ITK (for a minimal build)
+  find_package(ITK CONFIG REQUIRED)
+  include(${ITK_USE_FILE})
+endif(NOT cpPlugins_FOUND)
+
+## == Find eigen3
+find_package(Eigen3 CONFIG)
+if(Eigen3_FOUND)
+  include(${EIGEN3_USE_FILE})
+endif(Eigen3_FOUND)
+
+## == Build packages
+subdirs(lib examples)
+
+## == Installation commands
+include(cmake/InstallCommands.cmake)
 
 ## eof - $RCSfile$
 
diff --git a/cmake/Definitions.cmake b/cmake/Definitions.cmake
new file mode 100644 (file)
index 0000000..46fb5cf
--- /dev/null
@@ -0,0 +1,53 @@
+## =========================================================================
+## @author Leonardo Florez-Valencia (florez-l@javeriana.edu.co)
+## =========================================================================
+
+## == If working on a MacOSX, activate the use of RPATH's
+## == Furthermore: prepare the type of executables
+set(EXECUTABLE_TYPE "" CACHE STRING "Executable linking." FORCE)
+if(APPLE)
+  set(EXECUTABLE_TYPE "MACOSX_BUNDLE" CACHE STRING "Executable linking." FORCE)
+  set(CMAKE_MACOSX_RPATH true CACHE BOOL "Use RPATH's on MacOSX." FORCE)
+  mark_as_advanced(CMAKE_MACOSX_RPATH)
+elseif(WIN32)
+  set(EXECUTABLE_TYPE "WIN32" CACHE STRING "Executable linking." FORCE)
+endif(APPLE)
+mark_as_advanced(EXECUTABLE_TYPE)
+
+## == Force c++11
+if(NOT MSVC)
+  include(CheckCXXCompilerFlag)
+  check_cxx_compiler_flag("-std=c++11" COMPILER_SUPPORTS_CXX11)
+  if(COMPILER_SUPPORTS_CXX11)
+    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
+  else(COMPILER_SUPPORTS_CXX11)
+    check_cxx_compiler_flag("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
+    if(COMPILER_SUPPORTS_CXX0X)
+      set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
+    else(COMPILER_SUPPORTS_CXX0X)
+      message(
+        FATAL_ERROR
+        "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support."
+        )
+    endif(COMPILER_SUPPORTS_CXX0X)
+  endif(COMPILER_SUPPORTS_CXX11)
+endif(NOT MSVC)
+
+## == Prepare header generator to build shared libs
+include(GenerateExportHeader)
+
+## == Do not allow to build inside the source tree
+if(PROJECT_BINARY_DIR STREQUAL ${PROJECT_SOURCE_DIR})
+  message(FATAL_ERROR "Building in the source tree is not allowed.")
+endif(PROJECT_BINARY_DIR STREQUAL ${PROJECT_SOURCE_DIR})
+
+## == Where to put targets (executables and libs)
+set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR})
+set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR})
+mark_as_advanced(
+  CMAKE_BACKWARDS_COMPATIBILITY
+  EXECUTABLE_OUTPUT_PATH
+  LIBRARY_OUTPUT_PATH
+  )
+
+## eof - $RCSfile$
diff --git a/cmake/Functions.cmake b/cmake/Functions.cmake
new file mode 100644 (file)
index 0000000..8ca0f15
--- /dev/null
@@ -0,0 +1,141 @@
+## =========================================================================
+## @author Leonardo Florez-Valencia (florez-l@javeriana.edu.co)
+## =========================================================================
+
+## -------------------------------------------------------------------------
+function(BuildLibrary lib typ src maj min rel)
+
+## -- Get sources
+set(_files)
+foreach(_s ${src})
+
+  ## -- Canonicalize path
+  get_filename_component(_p "${_s}" ABSOLUTE)
+
+  ## -- Check type of input
+  if(IS_DIRECTORY ${_p})
+    file(GLOB _f "${_p}/*")
+    foreach(_x ${_f})
+      if(NOT IS_DIRECTORY ${_x})
+        list(APPEND _files ${_x})
+      endif(NOT IS_DIRECTORY ${_x})
+    endforeach(_x)
+  else(IS_DIRECTORY ${_p})
+    list(APPEND _files ${_p})
+  endif(IS_DIRECTORY ${_p})
+
+endforeach(_s)
+
+## -- Process sources
+set(_cpp)
+set(_hpp)
+set(_qui)
+foreach(_f ${_files})
+
+  ## -- Separate filename from extension
+  string(REGEX REPLACE "\\.[^.]*$" "" _name ${_f})
+  string(REPLACE ${_name} "" _ext ${_f})
+  set(_out_name ${_name})
+  set(_out_ext ${_ext})
+
+  ## -- Process .in files
+  string(COMPARE EQUAL "${_ext}" ".in" _in_cmp)
+  if(_in_cmp)
+    string(REPLACE ${PROJECT_SOURCE_DIR} ${PROJECT_BINARY_DIR} _out ${_name})
+    configure_file(${_f} ${_out} @ONLY)
+    string(REGEX REPLACE "\\.[^.]*$" "" _out_name ${_out})
+    string(REPLACE ${_out_name} "" _out_ext ${_out})
+  endif(_in_cmp)
+
+  ## -- Now, get real extension
+  string(SUBSTRING ${_out_ext} 0 2 _ext_cmp)
+
+  ## -- Process .c?? files
+  string(COMPARE EQUAL "${_ext_cmp}" ".c" _c_cmp)
+  if(_c_cmp)
+    list(APPEND _cpp ${_out_name}${_out_ext})
+  endif(_c_cmp)
+
+  ## -- Process .h?? files
+  string(COMPARE EQUAL "${_ext_cmp}" ".h" _h_cmp)
+  if(_h_cmp)
+    list(APPEND _hpp ${_out_name}${_out_ext})
+  endif(_h_cmp)
+
+  ## -- Process .ui files
+  string(COMPARE EQUAL "${_out_ext}" ".ui" _u_cmp)
+  if(_u_cmp)
+    list(APPEND _qui ${_out_name}${_out_ext})
+  endif(_u_cmp)
+
+endforeach(_f)
+
+## -- Process Qt ui files
+list(LENGTH _qui _qui_len)
+if(${_qui_len} GREATER 0)
+  qt5_wrap_ui(_qui_hpp ${_qui})
+endif(${_qui_len} GREATER 0)
+
+## -- Real build
+add_library(${lib} ${typ} ${_cpp} ${_hpp} ${_qui_hpp})
+
+## -- Header creation
+generate_export_header(${lib})
+set_property(TARGET ${lib} PROPERTY VERSION "${maj}.${min}.${rel}")
+set_property(TARGET ${lib} PROPERTY SOVERSION ${maj})
+set_property(TARGET ${lib} PROPERTY INTERFACE_${lib}_MAJOR_VERSION ${maj})
+set_property(TARGET ${lib} APPEND PROPERTY COMPATIBLE_INTERFACE_STRING ${maj})
+
+## -- Link library
+target_link_libraries(${lib} PUBLIC ${ARGN})
+
+## -- Installation rules
+option(${lib}_INSTALL_DEVEL "Install development files for ${lib}" OFF)
+string(COMPARE EQUAL "${type}" "SHARED" _cmp)
+if(_cmp OR ${lib}_INSTALL_DEVEL)
+  install(
+    TARGETS ${lib}
+    EXPORT "${targets_export_name}"
+    LIBRARY DESTINATION "lib"
+    ARCHIVE DESTINATION "lib"
+    RUNTIME DESTINATION "bin"
+    INCLUDES DESTINATION "${include_install_dir}"
+    )
+endif(_cmp OR ${lib}_INSTALL_DEVEL)
+if(${lib}_INSTALL_DEVEL)
+  string(TOLOWER ${lib} _lower_lib)
+  set(
+    _install_hdr
+    ${_hpp}
+    ${CMAKE_CURRENT_BINARY_DIR}/${_lower_lib}_export.h
+    )
+  set(_install_dirs)
+  foreach(_h ${_install_hdr})
+    string(REPLACE ${CMAKE_CURRENT_SOURCE_DIR} "" _h_name ${_h})
+    string(COMPARE EQUAL "${_h_name}" "${_h}" _h_cmp)
+    if(_h_cmp)
+      string(REPLACE ${CMAKE_CURRENT_BINARY_DIR} "" _h_name ${_h})
+    endif(_h_cmp)
+    set(_h_out ${include_install_dir}/${lib}${_h_name})
+    get_filename_component(_h_dir ${_h_out} DIRECTORY)
+    install(
+      FILES "${_h}"
+      DESTINATION "${_h_dir}"
+      )
+  endforeach(_h)
+endif(${lib}_INSTALL_DEVEL)
+
+endfunction()
+
+## -------------------------------------------------------------------------
+function(BuildLibraryRecursive lib typ dir maj min rel)
+
+## -- Globbing directory
+file(GLOB_RECURSE _files "${dir}/*")
+
+## -- Build library
+BuildLibrary(${lib} ${typ} "${_files}" ${maj} ${min} ${rel} ${ARGN})
+
+endfunction()
+
+## eof - $RCSfile$
diff --git a/cmake/InstallCommands.cmake b/cmake/InstallCommands.cmake
new file mode 100644 (file)
index 0000000..97500ae
--- /dev/null
@@ -0,0 +1,40 @@
+## =========================================================================
+## @author Leonardo Florez-Valencia (florez-l@javeriana.edu.co)
+## =========================================================================
+
+## =========================
+## == Installation values ==
+## =========================
+
+set(config_install_dir "lib/cmake/${PROJECT_NAME}")
+set(include_install_dir "include")
+set(generated_dir "${PROJECT_BINARY_DIR}/generated")
+set(version_config "${generated_dir}/${PROJECT_NAME}ConfigVersion.cmake")
+set(project_config "${generated_dir}/${PROJECT_NAME}Config.cmake")
+set(targets_export_name "${PROJECT_NAME}Targets")
+set(namespace "${PROJECT_NAME}::")
+
+## ===============================
+## == Global installation rules ==
+## ===============================
+
+include(CMakePackageConfigHelpers)
+write_basic_package_version_file(
+  "${version_config}" COMPATIBILITY SameMajorVersion
+  )
+configure_package_config_file(
+  "cmake/${PROJECT_NAME}Config.cmake.in"
+  "${project_config}"
+  INSTALL_DESTINATION "${config_install_dir}"
+  )
+install(
+  EXPORT "${targets_export_name}"
+  NAMESPACE "${namespace}"
+  DESTINATION "${config_install_dir}"
+  )
+install(
+  FILES "${project_config}"
+  DESTINATION "${config_install_dir}"
+  )
+
+## eof - $RCSfile$
similarity index 72%
rename from tests/CMakeLists.txt
rename to examples/CMakeLists.txt
index d769819a742543c4555620bb15853b9003a9d977..10250f0edad4df9d18fe20c7cd9c8303eca69438 100644 (file)
@@ -1,6 +1,5 @@
 ## =========================================================================
-## @author Leonardo Florez Valencia
-## @email florez-l@javeriana.edu.co
+## @author Leonardo Florez Valencia (florez-l@javeriana.edu.co)
 ## =========================================================================
 
 subdirs(image)
similarity index 75%
rename from tests/image/CMakeLists.txt
rename to examples/image/CMakeLists.txt
index 712d5373f9fcf34a7e78615472730971f2f43cf5..6b62d75f5860cccd5c8a365abc89ec0563262fc2 100644 (file)
@@ -1,6 +1,5 @@
 ## =========================================================================
-## @author Leonardo Florez Valencia
-## @email florez-l@javeriana.edu.co
+## @author Leonardo Florez Valencia (florez-l@javeriana.edu.co)
 ## =========================================================================
 
 subdirs(RegionGrow RandomWalker Dijkstra)
similarity index 75%
rename from tests/image/Dijkstra/CMakeLists.txt
rename to examples/image/Dijkstra/CMakeLists.txt
index 47c3bfa6549c2ff98bc862ee0b31025ed9698ca3..3fa27a0a4fa73fc3880682cfd420418e466a5911 100644 (file)
@@ -1,11 +1,10 @@
 ## =========================================================================
-## @author Leonardo Florez Valencia
-## @email florez-l@javeriana.edu.co
+## @author Leonardo Florez Valencia (florez-l@javeriana.edu.co)
 ## =========================================================================
 
-set(_pfx test_fpa_Image_Dijkstra_)
+set(_pfx example_fpa_Image_Dijkstra_)
 set(
-  _tests
+  _examples
   Identity
   Invert
   Gaussian
@@ -14,7 +13,7 @@ set(
   )
 include_directories(${PROJECT_SOURCE_DIR}/lib ${PROJECT_BINARY_DIR}/lib)
 
-foreach(_t ${_tests})
+foreach(_t ${_examples})
   add_executable(${_pfx}${_t} ${_t}.cxx)
   target_link_libraries(${_pfx}${_t} fpa)
 endforeach(_t)
similarity index 58%
rename from tests/image/RandomWalker/CMakeLists.txt
rename to examples/image/RandomWalker/CMakeLists.txt
index e0aef14528fa2fbaeb149c6a217f741f2a4f8ad2..90fd7f7e67476635ed7377cb4bdab50b5aacd6dc 100644 (file)
@@ -1,18 +1,23 @@
 ## =========================================================================
-## @author Leonardo Florez Valencia
-## @email florez-l@javeriana.edu.co
+## @author Leonardo Florez Valencia (florez-l@javeriana.edu.co)
 ## =========================================================================
 
-set(_pfx test_fpa_Image_RandomWalker_)
+set(_pfx example_fpa_Image_RandomWalker_)
 set(
-  _tests
+  _examples
   Gaussian
-  Original
-  CompareRandomWalkers
   )
+if(Eigen3_FOUND)
+  set(
+    _examples
+    ${_examples}
+    Original
+    CompareRandomWalkers
+    )
+endif(Eigen3_FOUND)
 include_directories(${PROJECT_SOURCE_DIR}/lib ${PROJECT_BINARY_DIR}/lib)
 
-foreach(_t ${_tests})
+foreach(_t ${_examples})
   add_executable(${_pfx}${_t} ${_t}.cxx)
   target_link_libraries(${_pfx}${_t} fpa)
 endforeach(_t)
similarity index 73%
rename from tests/image/RegionGrow/CMakeLists.txt
rename to examples/image/RegionGrow/CMakeLists.txt
index e5c55b5068974b856c6eafb84b493e16d416f661..f77acc5588114b10326ac53c19a6c07b73c0cca8 100644 (file)
@@ -1,18 +1,17 @@
 ## =========================================================================
-## @author Leonardo Florez Valencia
-## @email florez-l@javeriana.edu.co
+## @author Leonardo Florez Valencia (florez-l@javeriana.edu.co)
 ## =========================================================================
 
-set(_pfx test_fpa_Image_RegionGrow_)
+set(_pfx example_fpa_Image_RegionGrow_)
 set(
-  _tests
+  _examples
   Tautology
   BinaryThreshold
   Mori
   )
 include_directories(${PROJECT_SOURCE_DIR}/lib ${PROJECT_BINARY_DIR}/lib)
 
-foreach(_t ${_tests})
+foreach(_t ${_examples})
   add_executable(${_pfx}${_t} ${_t}.cxx)
   target_link_libraries(${_pfx}${_t} fpa)
 endforeach(_t)
index d7d1948d81c3c2669ed0d6c1d308c166f36760b7..aa486abbcbe5801fe045644ccfc7b3641ac8d0ff 100644 (file)
@@ -1,8 +1,8 @@
 ## =========================================================================
-## @author Leonardo Florez Valencia
-## @email florez-l@javeriana.edu.co
+## @author Leonardo Florez Valencia (florez-l@javeriana.edu.co)
 ## =========================================================================
 
+## -- Build libraries
 include_directories(
   ${CMAKE_CURRENT_SOURCE_DIR}
   ${CMAKE_CURRENT_BINARY_DIR}
index 1ac13cdc643039f224668c2545b52b4f9cb39593..7f9cb9f14248f45c1d7a1165b2e6c9ddea32d622 100644 (file)
@@ -3,74 +3,22 @@
 ## @email florez-l@javeriana.edu.co
 ## =========================================================================
 
-configure_file(Version.cxx.in "${CMAKE_CURRENT_BINARY_DIR}/Version.cxx" @ONLY)
-configure_file(Config.h.in "${CMAKE_CURRENT_BINARY_DIR}/Config.h" @ONLY)
-set(_dirs Common DataStructures Filters Functors)
+## -- Set directories
+set(_dirs . Common DataStructures Filters Functors)
 if(VTK_FOUND)
   list(APPEND _dirs VTK)
 endif(VTK_FOUND)
 set(_src)
-set(_hdr)
-set(_hrc)
 foreach(_d ${_dirs})
-  file(GLOB_RECURSE _s "${CMAKE_CURRENT_SOURCE_DIR}/${_d}/*.cxx")
-  file(GLOB_RECURSE _h "${CMAKE_CURRENT_SOURCE_DIR}/${_d}/*.h")
-  file(GLOB_RECURSE _t "${CMAKE_CURRENT_SOURCE_DIR}/${_d}/*.hxx")
+  file(GLOB_RECURSE _s "${CMAKE_CURRENT_SOURCE_DIR}/${_d}/*")
   list(APPEND _src ${_s})
-  list(APPEND _hdr ${_h})
-  list(APPEND _hrc ${_t})
 endforeach(_d)
 
-## =====================
-## == Compile library ==
-## =====================
-
-add_library(
-  fpa SHARED
-  "${CMAKE_CURRENT_BINARY_DIR}/Version.cxx"
-  "${CMAKE_CURRENT_BINARY_DIR}/Config.h"
-  ${_src} ${_hdr} ${_hrc}
-  )
-generate_export_header(fpa)
-set_property(TARGET fpa PROPERTY VERSION ${prj_VERSION})
-set_property(TARGET fpa PROPERTY SOVERSION ${prj_SHORT_VERSION})
-set_property(
-  TARGET fpa PROPERTY INTERFACE_fpa_MAJOR_VERSION ${prj_MAJ_VERSION}
-  )
-set_property(
-  TARGET fpa APPEND PROPERTY COMPATIBLE_INTERFACE_STRING ${prj_MAJ_VERSION}
-  )
-target_link_libraries(fpa PUBLIC ${ITK_LIBRARIES} ${VTK_LIBRARIES})
-
-## ========================
-## == Installation rules ==
-## ========================
-
-install(
-  TARGETS fpa
-  EXPORT "${targets_export_name}"
-  LIBRARY DESTINATION "lib"
-  ARCHIVE DESTINATION "lib"
-  RUNTIME DESTINATION "bin"
-  INCLUDES DESTINATION "${include_install_dir}"
-  )
-install(
-  DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
-  DESTINATION "${include_install_dir}"
-  FILES_MATCHING PATTERN "*.h"
-  )
-install(
-  DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
-  DESTINATION "${include_install_dir}"
-  FILES_MATCHING PATTERN "*.hxx"
-  )
-install(
-  FILES "${CMAKE_CURRENT_BINARY_DIR}/fpa_export.h"
-  DESTINATION "${include_install_dir}/fpa"
-  )
-install(
-  FILES "${CMAKE_CURRENT_BINARY_DIR}/Config.h"
-  DESTINATION "${include_install_dir}/fpa"
+## -- Build
+BuildLibrary(
+  fpa SHARED "${_src}"
+  ${prj_MAJ} ${prj_MIN} ${prj_REL}
+  ${ITK_LIBRARIES} ${VTK_LIBRARIES}
   )
 
 ## eof - $RCSfile$
index 831fb7217ce967e9f698fd48254deb60800ba23a..d00ed7fb4b96d8035ee26058d4d2a33b27141d65 100644 (file)
@@ -1,12 +1,16 @@
 // =========================================================================
-// @author Leonardo Florez Valencia
-// @email florez-l@javeriana.edu.co
+// @author Leonardo Florez Valencia (florez-l@javeriana.edu.co)
 // =========================================================================
 #ifndef __fpa__Config__h__
 #define __fpa__Config__h__
 
+#include <fpa/fpa_export.h>
 #include <itkMacro.h>
 
+#if @Eigen3_FOUND@ == 1
+#  define USE_Eigen3
+#endif // @Eigen3_FOUND@ == 1
+
 // -------------------------------------------------------------------------
 #define fpaTraitsMacro( __t__ )                                 \
   typedef __t__::TInternalTraits::TInputValue   TInputValue;    \