Provide pkgconfig files for library

A boilerplate .pc file is provided in the lib/pkgconfig directory. Using
this location has the advantage of being in the same path relative to
the libraries as it will be in the installation. The drawback is that the
lib/ directory no longer contains just output unless one uses out-of-tree
builds.

In the root directory of the project a local .pc file is provided which
instead of the usual end-installation directory rather points to the
build and source directories. By adding the build directory to the
PKG_CONFIG_PATH environment variable, a local build can be referred to
from other projects (such as examples or specific test-cases).

Having two different files is unfortunately necessary since pkgconfig
does not support prefix rewriting on Linux, and having them in two
different directories is necessary since the AutoMake-generated files
is not capable of renaming a file, only relocating it.
This commit is contained in:
Roland Kaufmann 2012-09-21 12:28:57 +02:00
parent 510ca4995c
commit 72c732746d
4 changed files with 34 additions and 0 deletions

View File

@ -304,3 +304,6 @@ opm/core/linalg/LinearSolverAGMG.hpp
lib_libopmcore_la_LDFLAGS += \
$(FCLIBS)
endif
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = lib/pkgconfig/opm-core.pc

View File

@ -51,6 +51,8 @@ AC_CONFIG_FILES([
tests/Makefile
examples/Makefile
tutorials/Makefile
opm-core.pc
lib/pkgconfig/opm-core.pc
])
AC_OUTPUT

View File

@ -0,0 +1,11 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: @PACKAGE_NAME@
Description: @PACKAGE_STRING@
Version: @PACKAGE_VERSION@
URL: @PACKAGE_URL@
Libs: -L${libdir} -l@PACKAGE@
Cflags: -I${includedir}

18
opm-core.pc.in Normal file
View File

@ -0,0 +1,18 @@
# This is the configuration for local builds. Use this by putting the
# compilation output path (the directory in which you ran ./configure)
# into the environment variable PKG_CONFIG_PATH. This will enable you
# to use pkg-config in your code while making changes to opm-core.
# This is NOT the file that is installed in the system directories when
# you do `make install`. That is the one in lib/pkgconfig. However, if
# you make changes here, you should consider that one as well.
libdir=@abs_top_builddir@/lib/.libs
includedir=@abs_top_srcdir@
Name: @PACKAGE_NAME@
Description: @PACKAGE_STRING@
Version: @PACKAGE_VERSION@
URL: @PACKAGE_URL@
Libs: -L${libdir} -l@PACKAGE@
Cflags: -I${includedir}