/
build.sh
executable file
·58 lines (45 loc) · 1.26 KB
/
build.sh
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
#!/bin/bash
set -x
config=Debug
if [[ "${1,,}" == "release" ]]; then
config=Release
elif [[ "${1,,}" == "debug" ]]; then
config=Debug
elif [[ $# -gt 0 ]]; then
echo "Error: unrecognized cmd arg \"$1\""
exit -1
fi
## Uncomment to tell cmake to use ifort instead of gfortran (untested)
#export SYNTRAN_INTEL=true
unameOut="$(uname -s)"
case "${unameOut}" in
Linux*) machine=Linux;;
Darwin*) machine=Mac;;
CYGWIN*) machine=Cygwin;;
MINGW*) machine=MinGw;;
*) machine="UNKNOWN:${unameOut}"
esac
echo "machine = ${machine}"
generator=""
if [[ "$machine" == "MinGw" ]]; then
generator=(-G 'MSYS Makefiles')
fi
if [[ "$machine" == "Mac" ]]; then
# If you don't have it: brew install gcc@12
#
# The gfortran included with gcc 13.2.0 seems to have a bug on macos. Might
# be worth trying a later 13 version when it's available
#which gcc
#which gfortran
which gfortran-12
## CMake doesn't like this hack, renamed gfortran won't pass its tests
#mkdir ~/bin/
#cp $(which gfortran-12) /usr/local/bin/gfortran
#export PATH=$PATH:~/bin/
#which gfortran
export FC=$(which gfortran-12)
echo "FC = $FC"
fi
build=build
cmake -S . -B "$build" "${generator[@]}" -DCMAKE_BUILD_TYPE=$config
cmake --build "$build" --config $config