diff --git a/.github/workflows/common-workflow.yml b/.github/workflows/common-workflow.yml index 6b34accf9..beae3d25b 100644 --- a/.github/workflows/common-workflow.yml +++ b/.github/workflows/common-workflow.yml @@ -128,6 +128,17 @@ jobs: working-directory: ${{ env.ISSM_DIR }} shell: 'bash' + - name: Check pkg-config + run: | + export PKG_CONFIG_PATH=${{ env.ISSM_DIR }}/lib/pkgconfig + incflags=$(pkg-config --print-errors --cflags-only-I ISSM) + echo $incflags + incdir=$(echo $incflags | awk '{ match($0, /-I(.*)/, m); print m[1]; }') + if [ -f "$incdir/classes/FemModel.h" ]; then + echo "ISSM pkg-config and headers found." + else + echo "ISSM pkg-config and headers not found." + fi - name: Get MATLAB if: ${{ inputs.interface == 'matlab' }} id: setup-matlab diff --git a/.github/workflows/ubuntu-basic.yml b/.github/workflows/ubuntu-basic.yml index b56e35d5c..d6fb2505f 100644 --- a/.github/workflows/ubuntu-basic.yml +++ b/.github/workflows/ubuntu-basic.yml @@ -22,6 +22,7 @@ jobs: --disable-static \ --enable-development \ --enable-debugging \ + --enable-install-headers \ --with-numthreads=4 \ --with-matlab-dir=$MATLAB_ROOT \ --with-fortran-lib="-L/usr/lib/x86_64-linux-gnu -lgfortran" \ diff --git a/.github/workflows/ubuntu-codipack.yml b/.github/workflows/ubuntu-codipack.yml index 3f1923598..b67e4750a 100644 --- a/.github/workflows/ubuntu-codipack.yml +++ b/.github/workflows/ubuntu-codipack.yml @@ -22,6 +22,7 @@ jobs: --enable-tape-alloc \ --enable-development \ --enable-debugging \ + --enable-install-headers \ --with-numthreads=4 \ --without-kriging \ --without-kml \ diff --git a/.github/workflows/ubuntu-python.yml b/.github/workflows/ubuntu-python.yml index b2133a778..8e886991b 100644 --- a/.github/workflows/ubuntu-python.yml +++ b/.github/workflows/ubuntu-python.yml @@ -25,6 +25,7 @@ jobs: --disable-static \ --enable-development \ --enable-debugging \ + --enable-install-headers \ --with-numthreads=4 \ --with-python-version=3.12 \ --with-python-dir=$PYTHON_ROOT \ diff --git a/ISSM.pc.in b/ISSM.pc.in new file mode 100644 index 000000000..f62b4c19c --- /dev/null +++ b/ISSM.pc.in @@ -0,0 +1,11 @@ +prefix=@prefix@ +exec_prefix=${prefix} +libdir=${exec_prefix}/lib +includedir=${prefix}/include + +Name: ISSM +Description: The Ice-Sheet and Sea-level System Model (ISSM) +Version: @VERSION@ +Url: @PACKAGE_URL@ +Libs: -L${libdir} -lISSMCore -lISSMModules -lISSMOverload +Cflags: -I${includedir} -DHAVE_CONFIG_H diff --git a/Makefile.am b/Makefile.am index 4a3dbf78b..5fe36a20f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -2,3 +2,28 @@ EXTRA_DIST = reconf scripts test m4 examples etc doc packages SUBDIRS = src ACLOCAL_AMFLAGS = -I m4 + +if INSTALL_HEADERS +# install configured headers +issmconfigdir = $(includedir) +issmconfig_HEADERS = \ + ./config.h + +# install configured pkg-config file +issmpcdir = $(libdir)/pkgconfig +issmpc_DATA = \ + ./ISSM.pc + +# install all normal ISSM headers +install-all-issm-headers: + { \ + cd $(abs_srcdir)/src/c; \ + hlist=$$(find -name '*.h'); \ + for h in $$hlist; do \ + $(MKDIR_P) $(DESTDIR)$(includedir)/$$(dirname $$h); \ + $(INSTALL_HEADER) $$h $(DESTDIR)$(includedir)/$$h; \ + done; \ + } +.PHONY: install-all-issm-headers +install-data-local: install-all-issm-headers +endif diff --git a/configure.ac b/configure.ac index 6b7aaba0c..88ae9bf56 100644 --- a/configure.ac +++ b/configure.ac @@ -44,5 +44,12 @@ AC_CONFIG_FILES([ src/m/Makefile ]) +# pkg-config file +AM_COND_IF([INSTALL_HEADERS], [ + AC_CONFIG_FILES([ + ISSM.pc + ]) +]) + #End of configure.ac AC_OUTPUT diff --git a/m4/issm_options.m4 b/m4/issm_options.m4 index 38fbb78ff..defcf1ad2 100644 --- a/m4/issm_options.m4 +++ b/m4/issm_options.m4 @@ -180,6 +180,17 @@ AC_DEFUN([ISSM_OPTIONS],[ ISSMEXT=".exe" AC_SUBST([ISSMEXT]) dnl }}} + dnl Install Headers {{{ + AC_MSG_CHECKING(for installing headers) + AC_ARG_ENABLE( + [install-headers], + AS_HELP_STRING([--enable-install-headers], [install headers and auiliary files to use ISSM as a library]), + [INSTALL_HEADERS_VALUE=${enableval}], + [INSTALL_HEADERS_VALUE=no] + ) + AM_CONDITIONAL([INSTALL_HEADERS], [test "x${INSTALL_HEADERS_VALUE}" == "xyes"]) + AC_MSG_RESULT([$INSTALL_HEADERS_VALUE]) + dnl }}} dnl OS{{{ IS_MAC=no