From: Leonardo Flórez-Valencia Date: Tue, 26 Sep 2017 21:22:49 +0000 (-0500) Subject: ... X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=b4059b76232207db78905ed83fa96115c7fe41c3;p=FrontAlgorithms.git ... --- diff --git a/CMakeLists.txt b/CMakeLists.txt index b11c77c..260cb37 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 index 0000000..46fb5cf --- /dev/null +++ b/cmake/Definitions.cmake @@ -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 index 0000000..8ca0f15 --- /dev/null +++ b/cmake/Functions.cmake @@ -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 index 0000000..97500ae --- /dev/null +++ b/cmake/InstallCommands.cmake @@ -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$ diff --git a/tests/CMakeLists.txt b/examples/CMakeLists.txt similarity index 72% rename from tests/CMakeLists.txt rename to examples/CMakeLists.txt index d769819..10250f0 100644 --- a/tests/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -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) diff --git a/tests/image/CMakeLists.txt b/examples/image/CMakeLists.txt similarity index 75% rename from tests/image/CMakeLists.txt rename to examples/image/CMakeLists.txt index 712d537..6b62d75 100644 --- a/tests/image/CMakeLists.txt +++ b/examples/image/CMakeLists.txt @@ -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) diff --git a/tests/image/Dijkstra/CMakeLists.txt b/examples/image/Dijkstra/CMakeLists.txt similarity index 75% rename from tests/image/Dijkstra/CMakeLists.txt rename to examples/image/Dijkstra/CMakeLists.txt index 47c3bfa..3fa27a0 100644 --- a/tests/image/Dijkstra/CMakeLists.txt +++ b/examples/image/Dijkstra/CMakeLists.txt @@ -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) diff --git a/tests/image/Dijkstra/ExtractAxis.cxx b/examples/image/Dijkstra/ExtractAxis.cxx similarity index 100% rename from tests/image/Dijkstra/ExtractAxis.cxx rename to examples/image/Dijkstra/ExtractAxis.cxx diff --git a/tests/image/Dijkstra/ExtractSkeleton.cxx b/examples/image/Dijkstra/ExtractSkeleton.cxx similarity index 100% rename from tests/image/Dijkstra/ExtractSkeleton.cxx rename to examples/image/Dijkstra/ExtractSkeleton.cxx diff --git a/tests/image/Dijkstra/Gaussian.cxx b/examples/image/Dijkstra/Gaussian.cxx similarity index 100% rename from tests/image/Dijkstra/Gaussian.cxx rename to examples/image/Dijkstra/Gaussian.cxx diff --git a/tests/image/Dijkstra/Identity.cxx b/examples/image/Dijkstra/Identity.cxx similarity index 100% rename from tests/image/Dijkstra/Identity.cxx rename to examples/image/Dijkstra/Identity.cxx diff --git a/tests/image/Dijkstra/Invert.cxx b/examples/image/Dijkstra/Invert.cxx similarity index 100% rename from tests/image/Dijkstra/Invert.cxx rename to examples/image/Dijkstra/Invert.cxx diff --git a/tests/image/RandomWalker/CMakeLists.txt b/examples/image/RandomWalker/CMakeLists.txt similarity index 58% rename from tests/image/RandomWalker/CMakeLists.txt rename to examples/image/RandomWalker/CMakeLists.txt index e0aef14..90fd7f7 100644 --- a/tests/image/RandomWalker/CMakeLists.txt +++ b/examples/image/RandomWalker/CMakeLists.txt @@ -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) diff --git a/tests/image/RandomWalker/CompareRandomWalkers.cxx b/examples/image/RandomWalker/CompareRandomWalkers.cxx similarity index 100% rename from tests/image/RandomWalker/CompareRandomWalkers.cxx rename to examples/image/RandomWalker/CompareRandomWalkers.cxx diff --git a/tests/image/RandomWalker/Gaussian.cxx b/examples/image/RandomWalker/Gaussian.cxx similarity index 100% rename from tests/image/RandomWalker/Gaussian.cxx rename to examples/image/RandomWalker/Gaussian.cxx diff --git a/tests/image/RandomWalker/Original.cxx b/examples/image/RandomWalker/Original.cxx similarity index 100% rename from tests/image/RandomWalker/Original.cxx rename to examples/image/RandomWalker/Original.cxx diff --git a/tests/image/RegionGrow/BinaryThreshold.cxx b/examples/image/RegionGrow/BinaryThreshold.cxx similarity index 100% rename from tests/image/RegionGrow/BinaryThreshold.cxx rename to examples/image/RegionGrow/BinaryThreshold.cxx diff --git a/tests/image/RegionGrow/CMakeLists.txt b/examples/image/RegionGrow/CMakeLists.txt similarity index 73% rename from tests/image/RegionGrow/CMakeLists.txt rename to examples/image/RegionGrow/CMakeLists.txt index e5c55b5..f77acc5 100644 --- a/tests/image/RegionGrow/CMakeLists.txt +++ b/examples/image/RegionGrow/CMakeLists.txt @@ -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) diff --git a/tests/image/RegionGrow/Mori.cxx b/examples/image/RegionGrow/Mori.cxx similarity index 100% rename from tests/image/RegionGrow/Mori.cxx rename to examples/image/RegionGrow/Mori.cxx diff --git a/tests/image/RegionGrow/Tautology.cxx b/examples/image/RegionGrow/Tautology.cxx similarity index 100% rename from tests/image/RegionGrow/Tautology.cxx rename to examples/image/RegionGrow/Tautology.cxx diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index d7d1948..aa486ab 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -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} diff --git a/lib/fpa/CMakeLists.txt b/lib/fpa/CMakeLists.txt index 1ac13cd..7f9cb9f 100644 --- a/lib/fpa/CMakeLists.txt +++ b/lib/fpa/CMakeLists.txt @@ -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$ diff --git a/lib/fpa/Config.h.in b/lib/fpa/Config.h.in index 831fb72..d00ed7f 100644 --- a/lib/fpa/Config.h.in +++ b/lib/fpa/Config.h.in @@ -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 #include +#if @Eigen3_FOUND@ == 1 +# define USE_Eigen3 +#endif // @Eigen3_FOUND@ == 1 + // ------------------------------------------------------------------------- #define fpaTraitsMacro( __t__ ) \ typedef __t__::TInternalTraits::TInputValue TInputValue; \