Use abs paths
[WPS.git] / configure_new
blob16c782b9e931a0cdec139feeb77ca7fa65214f7e
1 #!/bin/sh
3 help()
5 echo "./configure_new [options] [-- <CMake configuration options>]"
6 echo " -p Preselect a stanza configuration with matching description"
7 echo " -x Skip CMake options prompt, meant to be used in conjunction with direct pass-in options"
8 echo " -d directory Use as alternate build directory"
9 echo " -i directory Use as alternate install directory"
10 echo " -- <CMake options> Directly pass CMake options to configuration, equivalent to cmake <source dir> <CMake Options>"
11 echo " -h Print this message"
15 preselect=
16 skipCMake=false
17 while getopts p:xd:i:h opt; do
18 case $opt in
20 preselect=$OPTARG
23 skipCMake=true
26 buildDirectory=$OPTARG
29 installDirectory=$OPTARG
31 h) help; exit 0 ;;
32 *) help; exit 1 ;;
33 :) help; exit 1 ;;
34 \?) help; exit 1 ;;
35 esac
36 done
38 shift "$((OPTIND - 1))"
40 extraOps=
41 if [ $skipCMake = true ]; then
42 extraOps="-x"
43 else
44 extraOps="-s CMakeLists.txt"
47 if [ -z "$buildDirectory" ]; then
48 buildDirectory=_build
49 echo "Using default build directory : $buildDirectory"
51 if [ -z "$installDirectory" ]; then
52 installDirectory=$PWD/install
53 echo "Using default install directory : $installDirectory"
56 mkdir -p $buildDirectory
59 if [ ! -z "$preselect" ]; then
60 echo "Using preselected config ${preselect}"
61 # Meant to be run at the top level
62 ./arch/configure_reader.py \
63 -c arch/configure.defaults \
64 -t cmake/template/arch_config.cmake \
65 -o $buildDirectory/wps_config.cmake \
66 ${extraOps} -p "${preselect}"
67 else
68 # Meant to be run at the top level
69 ./arch/configure_reader.py \
70 -c arch/configure.defaults \
71 -t cmake/template/arch_config.cmake \
72 -o $buildDirectory/wps_config.cmake \
73 ${extraOps}
76 configureStanza=$?
78 if [ $configureStanza -eq 0 ]; then
79 # Now run cmake
80 cd $buildDirectory
81 cmake .. -DCMAKE_INSTALL_PREFIX=$installDirectory -DCMAKE_TOOLCHAIN_FILE=$buildDirectory/wps_config.cmake $*
82 exit $?
83 else
84 exit $configureStanza