]> Creatis software - cpPlugins.git/commitdiff
...
authorLeonardo Flórez-Valencia <florez-l@javeriana.edu.co>
Thu, 19 Oct 2017 15:01:28 +0000 (10:01 -0500)
committerLeonardo Flórez-Valencia <florez-l@javeriana.edu.co>
Thu, 19 Oct 2017 15:01:28 +0000 (10:01 -0500)
CMakeLists.txt
appli/bash/CMakeLists.txt
appli/bash/CreateWin32Installer.cxx
config/install_cpPlugins.sh [new file with mode: 0755]
config/install_ivq.sh

index a9a846f8741ac8734472d117d79837bb56eea42f..d602eb46c11a4df3855786231dc0af3ade455318 100644 (file)
@@ -14,13 +14,18 @@ set(prj_REL 0)
 project(${prj_NAME} VERSION "${prj_MAJ}.${prj_MIN}.${prj_REL}")
 
 ## == Project policies
-set(_policies CMP0015 CMP0020 CMP0042 CMP0053)
-foreach(_p ${_policies})
+set(_new_policies CMP0015 CMP0020 CMP0042 CMP0053)
+set(_old_policies CMP0006)
+foreach(_p ${_new_policies})
   if(POLICY ${_p})
     cmake_policy(SET ${_p} NEW)
   endif(POLICY ${_p})
 endforeach(_p)
-cmake_policy(SET CMP0006 OLD)
+foreach(_p ${_old_policies})
+  if(POLICY ${_p})
+    cmake_policy(SET ${_p} OLD)
+  endif(POLICY ${_p})
+endforeach(_p)
 
 ## == Some general configuration
 include(cmake/cpPlgDefinitions.cmake)
index 54e9e6faa11dce1eff13e1fb8675bdf0eae9daf8..3a244afe15f61f6293b07c0707a7cfe6f1f9d08a 100644 (file)
@@ -4,10 +4,13 @@
 
 ## == List bash applications
 set(_pfx cpPlugins_bash_)
-set(_apps
+set(
+  _apps
   ConvertImage
-  CreateWin32Installer
   )
+if(UNIX)
+  list(APPEND _apps CreateWin32Installer)
+endif(UNIX)
 
 ## == Compile them
 foreach(_a ${_apps})
index 898bf64655e2885b63b67a5ab9f391e141cff246..4f6ac375cdf3dc57d719a8921aa7028ea1f8869e 100644 (file)
@@ -32,18 +32,15 @@ inline bool Exists( const std::string& name )
 // -------------------------------------------------------------------------
 std::string Exec( const std::string& cmd )
 {
-  /*
-    std::array< char, 128 > buffer;
-    std::string result;
-    std::shared_ptr< FILE > pipe( popen( cmd.c_str( ), "r" ), pclose );
-    if( !pipe )
+  std::array< char, 128 > buffer;
+  std::string result;
+  std::shared_ptr< FILE > pipe( popen( cmd.c_str( ), "r" ), pclose );
+  if( !pipe )
     throw std::runtime_error( "popen( ) failed!" );
-    while( !feof( pipe.get( ) ) )
+  while( !feof( pipe.get( ) ) )
     if( fgets( buffer.data( ), 128, pipe.get( ) ) != NULL )
-    result += buffer.data( );
-    return( result );
-  */
-  return( "" );
+      result += buffer.data( );
+  return( result );
 }
 
 // -------------------------------------------------------------------------
diff --git a/config/install_cpPlugins.sh b/config/install_cpPlugins.sh
new file mode 100755 (executable)
index 0000000..4d40462
--- /dev/null
@@ -0,0 +1,83 @@
+#!/bin/bash
+
+## -- Command line options
+while [[ "$#" -gt 1 ]]; do
+    key="$1"
+    case $key in
+        -qt5config)
+        qt5config="$2"
+        shift
+        ;;
+        -cmake)
+        cmake="$2"
+        shift
+        ;;
+        -use_vtk)
+        use_vtk="$2"
+        shift
+        ;;
+        -use_itk)
+        use_itk="$2"
+        shift
+        ;;
+        -prefix)
+        prefix="$2"
+        shift
+        ;;
+        -build_dir)
+        build_dir="$2"
+        shift
+        ;;
+        -cores)
+        cores="$2"
+        shift
+        ;;
+        -build_type)
+        build_type="$2"
+        shift
+        ;;
+        *)
+        # Do nothing
+        ;;
+    esac
+    shift
+done
+
+## -- Check command line options
+if \
+    [ -z "$qt5config" ] || \
+    [ -z "$cmake" ] || \
+    [ -z "$use_vtk" ] || \
+    [ -z "$use_itk" ] || \
+    [ -z "$prefix" ] || \
+    [ -z "$cores" ] || \
+    [ -z "$build_type" ] || \
+    [ -z "$build_dir" ] ; then
+    (>&2 echo "Usage: $0 -qt5config [file] -cmake [file] -use_vtk [file] -use_itk [file] -prefix [dir] -build_dir [dir] -build_type [Release/Debug] -cores [n]")
+    exit 1
+fi
+
+## -- Current dir
+curr_dir=`pwd`
+
+## -- Configure, build and install Qt5
+mkdir -p $build_dir/cpPlugins
+cd $build_dir/cpPlugins
+$cmake \
+    -DCMAKE_BUILD_TYPE:STRING=$build_type \
+    -DCMAKE_INSTALL_PREFIX:PATH=$prefix \
+    -DcpPlugins_BUILD:BOOL=ON \
+    -DcpPlugins_BUILD_APPLICATIONS:BOOL=ON \
+    -DcpPlugins_BUILD_ivq:BOOL=ON \
+    -DcpPlugins_BUILD_tclap:BOOL=ON \
+    -DITK_DIR:PATH=`dirname $use_itk` \
+    -DVTK_DIR:PATH=`dirname $use_vtk` \
+    -DQt5_DIR:PATH=`dirname $qt5config` \
+    $curr_dir/..
+make -s -j$cores -k
+make -s -j -k install
+
+## -- End
+cd $curr_dir
+
+## eof - $RCSfile$
index 6e37f043f719bc6903551f731a07bca24fffb794..e177331cbcfc9d656195f8987d9d35f3a4653a38 100755 (executable)
@@ -138,23 +138,6 @@ $prefix/bin/cmake \
 make -s -j$cores -k
 make -s -j -k install
 
-## -- cpPlugins
-mkdir -p $build_dir/cpPlugins
-cd $build_dir/cpPlugoms
-$prefix/bin/cmake \
-    -DCMAKE_BUILD_TYPE:STRING=Release \
-    -DCMAKE_INSTALL_PREFIX:PATH=$prefix \
-    -DcpPlugins_BUID:BOOL=ON \
-    -DcpPlugins_BUILD_APPLICATIONS:BOOL=ON \
-    -DcpPlugins_BUILD_ivq:BOOL=ON \
-    -DcpPlugins_BUILD_tclap:BOOL=ON \
-    -DITK_DIR:PATH=$prefix/lib/cmake/ITK-4.12 \
-    -DVTK_DIR:PATH=$prefix/lib/cmake/ \
-    $cpPlugins
-make -s -j$cores -k
-make -s -j -k install
-
-
 ## -- End
 cd $curr_dir