21 lines
930 B
Bash
21 lines
930 B
Bash
#!/usr/bin/env bash
|
|
# Lean compiler
|
|
#
|
|
# A simple wrapper around a C++ compiler. Defaults to the compiler Lean was built with,
|
|
# which can be overridden with the environment variable `LEAN_CXX`. All parameters are passed
|
|
# as-is to the wrapped compiler.
|
|
#
|
|
# Interesting options:
|
|
# * `-U LEAN_MULTI_THREAD` can be used to optimize programs not making use of multi-threading
|
|
|
|
set -e
|
|
bindir=$(dirname $0)
|
|
for cxx in $LEAN_CXX @CMAKE_CXX_COMPILER@ /usr/bin/g++; do
|
|
if [ -f $cxx ] || command -v $cxx; then
|
|
export LEAN_CXX=$cxx && break
|
|
fi
|
|
done
|
|
[ -f $LEAN_CXX ] || command -v $LEAN_CXX || error "no suitable C++ compiler found!"
|
|
# NOTE: leanstatic and leanstdlib are cyclically dependent
|
|
|
|
$LEAN_CXX -std=c++14 -D LEAN_MULTI_THREAD "-I$bindir/../src" "-I$bindir/../include" "$@" "-L$bindir" "-L$bindir/../lib" -lleanstatic -lleanstdlib -lleanstatic -lleanstdlib -lgmp @LEANC_EXTRA_FLAGS@ -Wno-unused-command-line-argument
|