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)
## == 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})
// -------------------------------------------------------------------------
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 );
}
// -------------------------------------------------------------------------
--- /dev/null
+#!/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$
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