# -*- shell-script -*-
cd src
# Need C++14, so remove our flags that force C++11
export CXX="$(echo "$CXX" | sed 's/-std=[a-z0-9+]*//g') -std=gnu++14"
mkdir build
cd build
BUILD_OPTIONS=
if [ -n "$SAGE_GMP_PREFIX" ]; then
    BUILD_OPTIONS="$BUILD_OPTIONS -DGMP_DIR=$SAGE_GMP_PREFIX"
    export GMP_DIR="$SAGE_GMP_PREFIX"
fi
sdh_cmake -GNinja -DGENERATORS=on -DCMAKE_SYSTEM_PREFIX_PATH="$SAGE_LOCAL" -DCMAKE_BUILD_RPATH="${SAGE_LOCAL}/lib" -DCMAKE_INSTALL_RPATH="${SAGE_LOCAL}/lib" -DHAVE_FLAG_SEARCH_PATHS_FIRST=0 -DSHARED=on $BUILD_OPTIONS ..
cmake --build .
DESTDIR=$SAGE_DESTDIR cmake --install .

sdh_generate_windows_lib_files cmr
