forked from ComputationalRadiationPhysics/picongpu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure
executable file
·99 lines (86 loc) · 2.92 KB
/
configure
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#!/bin/bash
#
# Copyright 2013 Axel Huebl, Rene Widera
#
# This file is part of PIConGPU.
#
# PIConGPU is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# PIConGPU is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with PIConGPU.
# If not, see <http://www.gnu.org/licenses/>.
#
this_dir=`dirname $0`
help()
{
echo "configure create a cmake call for picongpu \nand get fast access to selected picongpu cmake options"
echo ""
echo "usage: configure [OPTION] <parameter_DIRECTORY>"
echo "If no path_to_CMakeLists.txt is set the directory of this binary is used as source directory."
echo ""
echo "-i | --install - path were picongpu should be installed (default is <parameter_DIRECTORY>)"
echo "-a | --arch - set cuda architecture (e.g.: sm_13, sm_20, ...)"
echo "-c | --cmake - overwrite options for cmake (e.g.: -c \"-DPIC_VERBOSE=1\")"
echo "-t <presetNumber> - configure this preset from cmakeFlags"
echo "-h | --help - show this help message"
}
# options may be followed by one colon to indicate they have a required argument
OPTS=`getopt -o i:a:c:p:t:h -l install:,arch:,cmake:,params:,help -- "$@"`
if [ $? != 0 ] ; then
# something went wrong, getopt will put out an error message for us
exit 1
fi
# configure a specific preset in the cmakeFlags file
cmakeFlagsNr=0
eval set -- "$OPTS"
while true ; do
case "$1" in
-a|--arch)
cuda_arch="-DCUDA_ARCH=$2"
shift
;;
-i|--install)
install_path="-DCMAKE_INSTALL_PREFIX=$2"
shift
;;
-h|--help)
echo -e "$(help)"
exit 1
;;
-c|--cmake)
cmake_options="$2"
shift
;;
-t)
cmakeFlagsNr="$2"
shift
;;
--) shift; break;;
esac
shift
done
extension_param="$*"
if [ -z "$extension_param" ] ; then
echo "No case path is given." >&2
exit 1
fi
#check for cmakeFlags file (interprete with sh)
if [ -f "$extension_param/cmakeFlags" ] ; then
cmake_flags=`$extension_param/cmakeFlags $cmakeFlagsNr`
fi
#set default install path if no path is set by paramater
if [ -z "$install_path" ] ; then
install_path="-DCMAKE_INSTALL_PREFIX=$extension_param"
fi
extension_param="-DPIC_EXTENSION_PATH=$extension_param"
own_command="cmake $cmake_flags $install_path $extension_param $cmake_options $cuda_arch $this_dir"
echo -e "\033[32mcmake command:\033[0m $own_command"
$own_command