From: Leonardo Flórez-Valencia Date: Thu, 5 Oct 2017 21:21:26 +0000 (-0500) Subject: ... X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=f1bbf8a1d136416ced6c727d3ec983ca909dcfda;p=cpPlugins.git ... --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 9c11937..c343188 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -57,7 +57,20 @@ if(cpPlugins_BUILD) endif(cpPlugins_BUILD) +## == Installation commands +include(cmake/cpPlgInstallCommands.cmake) + ## == CMake scripts subdirs(cmake) +## == Uninstall target +configure_file( + "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in" + "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" + IMMEDIATE @ONLY + ) +add_custom_target( + uninstall + COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake) + ## eof - $RCSfile$ diff --git a/appli/bash/CMakeLists.txt b/appli/bash/CMakeLists.txt index 1eb9ad5..54e9e6f 100644 --- a/appli/bash/CMakeLists.txt +++ b/appli/bash/CMakeLists.txt @@ -5,6 +5,7 @@ ## == List bash applications set(_pfx cpPlugins_bash_) set(_apps + ConvertImage CreateWin32Installer ) @@ -14,6 +15,7 @@ foreach(_a ${_apps}) ${_pfx}${_a} INSTALL SOURCE ${_a}.cxx + LINKS ${ITK_LIBRARIES} ) endforeach(_a) diff --git a/appli/bash/ConvertImage.cxx b/appli/bash/ConvertImage.cxx new file mode 100644 index 0000000..5da50ed --- /dev/null +++ b/appli/bash/ConvertImage.cxx @@ -0,0 +1,45 @@ +/* ========================================================================= + * @author Leonardo Florez-Valencia (florez-l@javeriana.edu.co) + * ========================================================================= + */ +#include +#include +#include + +// ------------------------------------------------------------------------- +const unsigned int Dim = 2; +typedef unsigned char TPixel; +typedef itk::Image< TPixel, Dim > TImage; + +// ------------------------------------------------------------------------- +int main( int argc, char* argv[] ) +{ + if( argc < 3 ) + { + std::cerr << "Usage: " << argv[ 0 ] << " input output" << std::endl; + return( 1 ); + + } // fi + + typedef itk::ImageFileReader< TImage > TReader; + TReader::Pointer reader = TReader::New( ); + reader->SetFileName( argv[ 1 ] ); + + typedef itk::ImageFileWriter< TImage > TWriter; + TWriter::Pointer writer = TWriter::New( ); + writer->SetInput( reader->GetOutput( ) ); + writer->SetFileName( argv[ 2 ] ); + try + { + writer->Update( ); + } + catch( std::exception& err ) + { + std::cerr << "Error caught: " << err.what( ) << std::endl; + return( 1 ); + + } // fi + return( 0 ); +} + +// eof - $RCSfile$ diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index bb36430..18169ce 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -2,11 +2,17 @@ ## @author Leonardo Florez-Valencia (florez-l@javeriana.edu.co) ## ========================================================================= -include(cpPlgInstallCommands.cmake) - -#INSTALL: cpPlgDefinitions.cmake -#INSTALL: cpPlgFunctions.cmake -#INSTALL: cpPlgInstallCommands.cmake +set( + _scripts + cpPlgDefinitions.cmake + cpPlgFunctions.cmake + cpPlgInstallCommands.cmake + ) +foreach(_s ${_scripts}) + install( + FILES "${_s}" + DESTINATION "lib/cmake/${PROJECT_NAME}" + ) +endforeach(_s) ## eof - $RCSfile$ - diff --git a/cmake/cpPlgInstallCommands.cmake b/cmake/cpPlgInstallCommands.cmake index cbfc91c..fe30b48 100644 --- a/cmake/cpPlgInstallCommands.cmake +++ b/cmake/cpPlgInstallCommands.cmake @@ -23,10 +23,14 @@ write_basic_package_version_file( "${version_config}" COMPATIBILITY SameMajorVersion ) configure_package_config_file( - "${PROJECT_NAME}Config.cmake.in" + "cmake/${PROJECT_NAME}Config.cmake.in" "${project_config}" INSTALL_DESTINATION "${config_install_dir}" ) +install( + FILES "${project_config}" + DESTINATION "${config_install_dir}" + ) if(${PROJECT_NAME}_BUILD) install( EXPORT "${targets_export_name}" @@ -34,9 +38,5 @@ if(${PROJECT_NAME}_BUILD) DESTINATION "${config_install_dir}" ) endif(${PROJECT_NAME}_BUILD) -install( - FILES "${project_config}" - DESTINATION "${config_install_dir}" - ) ## eof - $RCSfile$ diff --git a/cmake/cpPluginsConfig.cmake.in b/cmake/cpPluginsConfig.cmake.in index 58d75fa..e2ecf1a 100644 --- a/cmake/cpPluginsConfig.cmake.in +++ b/cmake/cpPluginsConfig.cmake.in @@ -1,12 +1,19 @@ ## == Some general configuration include(@CMAKE_INSTALL_PREFIX@/lib/cmake/@PROJECT_NAME@/cpPlgDefinitions.cmake) include(@CMAKE_INSTALL_PREFIX@/lib/cmake/@PROJECT_NAME@/cpPlgFunctions.cmake) - +set( + cpPlugins_INSTALL_FILE + @CMAKE_INSTALL_PREFIX@/lib/cmake/@PROJECT_NAME@/cpPlgInstallCommands.cmake + ) ## == Automatically generated commands @PACKAGE_INIT@ -include("${CMAKE_CURRENT_LIST_DIR}/@targets_export_name@.cmake") -check_required_components("@PROJECT_NAME@") +## == Include targets file +set(_targets "${CMAKE_CURRENT_LIST_DIR}/@targets_export_name@.cmake") +if(EXISTS "${_targets}") + include("${_targets}") + check_required_components("@PROJECT_NAME@") +endif(EXISTS "${_targets}") ## ====================================== ## == Needed packages and dependencies == diff --git a/cmake_uninstall.cmake.in b/cmake_uninstall.cmake.in new file mode 100644 index 0000000..34c9330 --- /dev/null +++ b/cmake_uninstall.cmake.in @@ -0,0 +1,27 @@ +## ========================================================================= +## @author Leonardo Florez-Valencia (florez-l@javeriana.edu.co) +## ========================================================================= + +if(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") + message(FATAL_ERROR "Cannot find install manifest: @CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") +endif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") + +file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) +string(REGEX REPLACE "\n" ";" files "${files}") +foreach(file ${files}) + message(STATUS "Uninstalling $ENV{DESTDIR}${file}") + if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") + exec_program( + "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" + OUTPUT_VARIABLE rm_out + RETURN_VALUE rm_retval + ) + if(NOT "${rm_retval}" STREQUAL 0) + message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}") + endif(NOT "${rm_retval}" STREQUAL 0) + else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") + message(STATUS "File $ENV{DESTDIR}${file} does not exist.") + endif(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") +endforeach(file) + +## eof - $RCSfile$ diff --git a/lib/ivq/CMakeLists.txt b/lib/ivq/CMakeLists.txt index 8d4a985..ef64f3b 100644 --- a/lib/ivq/CMakeLists.txt +++ b/lib/ivq/CMakeLists.txt @@ -2,8 +2,8 @@ ## @author Leonardo Florez-Valencia (florez-l@javeriana.edu.co) ## ========================================================================= -option(BUILD_ivq "Build ITK/VTK/Qt extensions." OFF) -if(BUILD_ivq) +option(cpPlugins_BUILD_ivq "Build ITK/VTK/Qt extensions." OFF) +if(cpPlugins_BUILD_ivq) ## -- Set directories set(_dirs . ITK) @@ -23,6 +23,6 @@ if(BUILD_ivq) LINKS ${ITK_LIBRARIES} ${VTK_LIBRARIES} ) -endif(BUILD_ivq) +endif(cpPlugins_BUILD_ivq) ## eof - $RCSfile$