cd src

if [ "$SAGE_FAT_BINARY" = yes ]; then
    EXTRA_OPTS="-DWITH_POPCNT=OFF"
fi

echo "Configuring primesieve."
sdh_cmake -GNinja \
          -DCMAKE_VERBOSE_MAKEFILE=ON \
          -DBUILD_STATIC_LIBS=OFF \
          -DBUILD_SHARED_LIBS=ON \
          -DBUILD_TESTS=ON \
          ${EXTRA_OPTS} \
          .

cmake --build .
DESTDIR=$SAGE_DESTDIR cmake --install .

sdh_generate_windows_lib_files primesieve
