-
Notifications
You must be signed in to change notification settings - Fork 695
/
configure_new
executable file
·84 lines (74 loc) · 2.06 KB
/
configure_new
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
#!/bin/sh
help()
{
echo "./configure_new [options] [-- <CMake configuration options>]"
echo " -p Preselect a stanza configuration with matching description"
echo " -x Skip CMake options prompt, meant to be used in conjunction with direct pass-in options"
echo " -d directory Use as alternate build directory"
echo " -i directory Use as alternate install directory"
echo " -- <CMake options> Directly pass CMake options to configuration, equivalent to cmake <source dir> <CMake Options>"
echo " -h Print this message"
}
preselect=
skipCMake=false
while getopts p:xd:i:h opt; do
case $opt in
p)
preselect=$OPTARG
;;
x)
skipCMake=true
;;
d)
buildDirectory=$OPTARG
;;
i)
installDirectory=$OPTARG
;;
h) help; exit 0 ;;
*) help; exit 1 ;;
:) help; exit 1 ;;
\?) help; exit 1 ;;
esac
done
shift "$((OPTIND - 1))"
extraOps=
if [ $skipCMake = true ]; then
extraOps="-x"
else
extraOps="-s CMakeLists.txt"
fi
if [ -z "$buildDirectory" ]; then
buildDirectory=_build
echo "Using default build directory : $buildDirectory"
fi
if [ -z "$installDirectory" ]; then
installDirectory=$PWD/install
echo "Using default install directory : $installDirectory"
fi
mkdir -p $buildDirectory
if [ ! -z "$preselect" ]; then
echo "Using preselected config ${preselect}"
# Meant to be run at the top level
./arch/configure_reader.py \
-c arch/configure.defaults \
-t cmake/template/arch_config.cmake \
-o $buildDirectory/wrf_config.cmake \
${extraOps} -p "${preselect}"
else
# Meant to be run at the top level
./arch/configure_reader.py \
-c arch/configure.defaults \
-t cmake/template/arch_config.cmake \
-o $buildDirectory/wrf_config.cmake \
${extraOps}
fi
configureStanza=$?
if [ $configureStanza -eq 0 ]; then
# Now run cmake
cd $buildDirectory
cmake .. -DCMAKE_INSTALL_PREFIX=$installDirectory -DCMAKE_TOOLCHAIN_FILE=$buildDirectory/wrf_config.cmake $*
exit $?
else
exit $configureStanza
fi