From: Leonardo Flórez-Valencia Date: Thu, 19 Oct 2017 15:01:28 +0000 (-0500) Subject: ... X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=aa8643e027dc5dc063d759296c8c4f50b9a2c9da;p=cpPlugins.git ... --- diff --git a/CMakeLists.txt b/CMakeLists.txt index a9a846f..d602eb4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/appli/bash/CMakeLists.txt b/appli/bash/CMakeLists.txt index 54e9e6f..3a244af 100644 --- a/appli/bash/CMakeLists.txt +++ b/appli/bash/CMakeLists.txt @@ -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}) diff --git a/appli/bash/CreateWin32Installer.cxx b/appli/bash/CreateWin32Installer.cxx index 898bf64..4f6ac37 100644 --- a/appli/bash/CreateWin32Installer.cxx +++ b/appli/bash/CreateWin32Installer.cxx @@ -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 index 0000000..4d40462 --- /dev/null +++ b/config/install_cpPlugins.sh @@ -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$ diff --git a/config/install_ivq.sh b/config/install_ivq.sh index 6e37f04..e177331 100755 --- a/config/install_ivq.sh +++ b/config/install_ivq.sh @@ -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