]> Creatis software - cpPlugins.git/commitdiff
...
authorLeonardo Flórez-Valencia <florez-l@javeriana.edu.co>
Thu, 5 Oct 2017 21:21:26 +0000 (16:21 -0500)
committerLeonardo Flórez-Valencia <florez-l@javeriana.edu.co>
Thu, 5 Oct 2017 21:21:26 +0000 (16:21 -0500)
CMakeLists.txt
appli/bash/CMakeLists.txt
appli/bash/ConvertImage.cxx [new file with mode: 0644]
cmake/CMakeLists.txt
cmake/cpPlgInstallCommands.cmake
cmake/cpPluginsConfig.cmake.in
cmake_uninstall.cmake.in [new file with mode: 0644]
lib/ivq/CMakeLists.txt

index 9c1193760dacd0be14cf5a7fd5068726bef9e165..c3431881383059eae5e5ce49e47a9cb3f9ed6f74 100644 (file)
@@ -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$
index 1eb9ad5c8e6c4f72e686d2221cc0d3f6341285b2..54e9e6faa11dce1eff13e1fb8675bdf0eae9daf8 100644 (file)
@@ -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 (file)
index 0000000..5da50ed
--- /dev/null
@@ -0,0 +1,45 @@
+/* =========================================================================
+ * @author Leonardo Florez-Valencia (florez-l@javeriana.edu.co)
+ * =========================================================================
+ */
+#include <itkImage.h>
+#include <itkImageFileReader.h>
+#include <itkImageFileWriter.h>
+
+// -------------------------------------------------------------------------
+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$
index bb36430ff43910635657678dd61263cff412a73a..18169ce7faf0f86755b35ae8c3b47a032c286bb3 100644 (file)
@@ -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$
-
index cbfc91c1707b12f62cd52798219365ac872f9989..fe30b484338eb168099cb7db921fe5cc4e5f6fe6 100644 (file)
@@ -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$
index 58d75fad5fde626aa16f36a009b25dd3f21e63a1..e2ecf1a33f794897401ab48afd496da1c1c8b152 100644 (file)
@@ -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 (file)
index 0000000..34c9330
--- /dev/null
@@ -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$
index 8d4a985e90d04d97eae501755043d9f8ae238491..ef64f3bf8ad21808644347584c6f8b1353036a3c 100644 (file)
@@ -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$