mirror of
https://github.com/cosinekitty/astronomy.git
synced 2025-12-23 23:58:15 -05:00
This reverts commit a7e747c100.
This broke the GitHub Actions automated tests, because they
are using gcc 11 (which does not support level 3 fortification),
and they already predefine another fortification level.
I realize this would also hinder other contributors who
are not using gcc 12. At least I tried it once on my own
system and didn't find any problems, which is nice.
37 lines
1.2 KiB
Bash
Executable File
37 lines
1.2 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
Fail()
|
|
{
|
|
echo "ERROR($0): $1"
|
|
exit 1
|
|
}
|
|
|
|
[[ -z "${CC}" ]] && CC=gcc
|
|
echo "$0: C compiler = ${CC}"
|
|
|
|
if [[ "$1" == "debug" ]]; then
|
|
BUILDOPT='-g -Og'
|
|
elif [[ "$1" == "opt" ]]; then
|
|
BUILDOPT="$2"
|
|
echo "Using custom build options: ${BUILDOPT}"
|
|
elif [[ -z "$1" ]]; then
|
|
# On Arch Linux running gcc 9.3.0 on aarch64 (Rasbperry Pi 3),
|
|
# started to get some numeric discrepancies in 'ctest check' output
|
|
# until I turned off "fp contract" optimizations.
|
|
# Some processors (including 64-bit ARM) have the ability to evaluate floating point
|
|
# expressions like "a*b + c" with a single instruction, and to
|
|
# do so without rounding the intermediate multiplication result.
|
|
# Although this is *more* accurate, it produces results that are
|
|
# different from other processors, which is counterproductive for
|
|
# unit tests. Therefore, I turn it off here. Users of the C
|
|
# version of Astronomy Engine can safely build other code with '-O3' by itself.
|
|
BUILDOPT='-O3 -ffp-contract=off'
|
|
else
|
|
Fail "unrecognized command line option"
|
|
fi
|
|
|
|
${CC} ${BUILDOPT} -Wall -Werror -o ctest -I ../source/c/ ../source/c/astronomy.c ctest.c -lm || Fail "Error building ctest"
|
|
|
|
echo "$0: Built 'ctest' program."
|
|
exit 0
|