Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ concurrency:
jobs:
# The CI test job
test:
name: ${{ matrix.gap-version }} ${{ matrix.os }}
name: ${{ matrix.gap-version }} ${{ matrix.os }}${{ matrix.system-libnormaliz && ' libnormaliz' || '' }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
Expand All @@ -31,15 +31,19 @@ jobs:
- '4.13'
- '4.12'
os: [ubuntu-latest]
system-libnormaliz: [true,false]
include:
- gap-version: master
- gap-version: 'devel'
os: macos-latest
system-libnormaliz: false

steps:
- uses: actions/checkout@v6
- uses: Chocobo1/setup-ccache-action@v1
with:
update_packager_index: false
- name: "Install and use system libnormaliz"
if: ${{ matrix.system-libnormaliz }}
run: |
rm prerequisites.sh # prevent build-pkg from building Normaliz
sudo apt install libnormaliz-dev # install system libnormaliz
- uses: gap-actions/setup-gap@v3
with:
gap-version: ${{ matrix.gap-version }}
Expand Down
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,24 @@ Not specifying GAPDIR is equivalent to passing `../..` as GAPDIR. If
more than one argument is specified, then any arguments beyond the
first are passed on to the Normaliz `configure` script.

Once the script completed successfully, you can build NormalizInterface
like this:
If you already have a suitable Normaliz installation in a standard
location such as `/opt/homebrew`, `/usr/local`, `/opt/local`, `/usr`,
or `/opt`, then `configure` will try to detect and use it
automatically. Otherwise, or if you want to override the detected
location, you can still use `prerequisites.sh` to build a local copy
or pass `--with-normaliz=PATH` explicitly.

Once the script completed successfully, or if you rely on an installed
Normaliz found by `configure`, you can build NormalizInterface like
this:

./configure --with-gaproot=GAPDIR
make

The ` --with-gaproot=GAPDIR` parameter is actually optional, and if omitted,
the package will search for GAP in `../..`.
Likewise, `--with-normaliz=PATH` is optional and only needed if
automatic detection does not pick the desired installation.


## Documentation and tests
Expand Down
56 changes: 49 additions & 7 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -68,20 +68,62 @@ dnl ## Locate Normaliz
dnl ##

NORMALIZ_RPATH_EXTRA=""
NORMALIZ_LIBDIR=""

AC_ARG_WITH([normaliz],
[AS_HELP_STRING([--with-normaliz=<path>], [specify root of Normaliz installation])],
[NORMALIZ="$with_normaliz"],
[NORMALIZ="$PWD/NormalizInstallDir"
# The following is a hack to ensure compatibility with versions of gac that
# don't use GNU libtool anymore, and thus don't set a run path pointing to
# the specific version of libnormaliz we requested. Without this, when GAP
# loads NormalizInterface.so it may not find the libnormaliz shared library.
NORMALIZ_RPATH_EXTRA="-Wl,-rpath,$NORMALIZ/lib"
[NORMALIZ=""
NORMALIZ_DIRS=${NORMALIZ_DIRS:-"/opt/homebrew /usr/local /opt/local /usr /opt"}
AC_MSG_CHECKING([for an installed Normaliz])
for normaliz_dir in $NORMALIZ_DIRS; do
if test -f "$normaliz_dir/include/libnormaliz/cone.h"; then
if test -d "$normaliz_dir/lib64"; then
normaliz_libdir="$normaliz_dir/lib64"
elif test -d "$normaliz_dir/lib"; then
normaliz_libdir="$normaliz_dir/lib"
else
continue
fi

old_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS -I$normaliz_dir/include $GMP_CPPFLAGS"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include "libnormaliz/cone.h"]],
[[#if !defined(NMZ_RELEASE) || NMZ_RELEASE < 30504
#error Normaliz too old
#endif
return 0;]])],
[NORMALIZ="$normaliz_dir"
NORMALIZ_LIBDIR="$normaliz_libdir"
break],
[])
CPPFLAGS="$old_CPPFLAGS"
fi
done

if test "x$NORMALIZ" != "x"; then
AC_MSG_RESULT([$NORMALIZ])
else
NORMALIZ="$PWD/NormalizInstallDir"
NORMALIZ_LIBDIR="$NORMALIZ/lib"
AC_MSG_RESULT([not found, falling back to $NORMALIZ])
# The following is a hack to ensure compatibility with versions of gac that
# don't use GNU libtool anymore, and thus don't set a run path pointing to
# the specific version of libnormaliz we requested. Without this, when GAP
# loads NormalizInterface.so it may not find the libnormaliz shared library.
NORMALIZ_RPATH_EXTRA="-Wl,-rpath,$NORMALIZ_LIBDIR"
fi
]
)
if test "x$NORMALIZ_LIBDIR" = "x"; then
if test -d "$NORMALIZ/lib64"; then
NORMALIZ_LIBDIR="$NORMALIZ/lib64"
else
NORMALIZ_LIBDIR="$NORMALIZ/lib"
fi
fi
NORMALIZ_CPPFLAGS="-I$NORMALIZ/include"
NORMALIZ_LDFLAGS="$NORMALIZ_RPATH_EXTRA -L$NORMALIZ/lib"
NORMALIZ_LDFLAGS="$NORMALIZ_RPATH_EXTRA -L$NORMALIZ_LIBDIR"
AC_SUBST(NORMALIZ_LDFLAGS)
AC_SUBST(NORMALIZ_CPPFLAGS)

Expand Down
10 changes: 5 additions & 5 deletions examples/docs.g
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ NmzHasConeProperty(cone, "ExtremeRays");
#! @EndChunk

#! @BeginChunk NmzKnownConeProperties_example
#! @BeginExample
NmzKnownConeProperties(cone);
#! @BeginLogSession
#! NmzKnownConeProperties(cone);
#! [ ]
#! @EndExample
#! @EndLogSession
#! @EndChunk

#! @BeginChunk NmzCompute_example
#! @BeginExample
NmzKnownConeProperties(cone);
#! [ ]
NmzHasConeProperty(cone, "SupportHyperplanes");
#! false
NmzCompute(cone, ["SupportHyperplanes", "IsPointed"]);
#! true
NmzKnownConeProperties(cone);
Expand Down
8 changes: 2 additions & 6 deletions tst/normalizinterface01.tst
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,9 @@ gap> cone := NmzCone(["integral_closure",[[2,1],[1,3]]]);
gap> NmzHasConeProperty(cone, "ExtremeRays");
false

# doc/_Chunks.xml:123-126
gap> NmzKnownConeProperties(cone);
[ ]

# doc/_Chunks.xml:131-148
gap> NmzKnownConeProperties(cone);
[ ]
gap> NmzHasConeProperty(cone, "SupportHyperplanes");
false
gap> NmzCompute(cone, ["SupportHyperplanes", "IsPointed"]);
true
gap> NmzKnownConeProperties(cone);
Expand Down