Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
D
dune-common
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 69
    • Issues 69
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 51
    • Merge Requests 51
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Incidents
    • Environments
  • Packages & Registries
    • Packages & Registries
    • Package Registry
  • Analytics
    • Analytics
    • CI / CD
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Core Modules
  • dune-common
  • Merge Requests
  • !910

Open
Opened Jan 08, 2021 by Christian Engwer@christiOwner
  • Report abuse
Report abuse

WIP: Fix pkg config

  • Overview 34
  • Commits 19
  • Pipelines 16
  • Changes 14

Improve generation of pkg-config files. This allows (or will allow) to use DUNE without the DUNE build-system and in particular without cmake, just using the information provided by pkg-config.

See #188

Feature

  • both dune- and external-dependencies are added to dune-common.pc
  • cmake helper functions assist in collecting these dependencies
  • for external dependecies we either use their existing pc fiels or write our own ones (containing the information extracted from the cmake target)
  • helper functions write the pc files to keep the necessary effort in other modules as small as possible (see dune-geometry!155 and dune-istl!416)
  • several external dependencies are already fully supported

Possible Features

The current changes offer the possibility to use the pkg-config files in DUNE modules further down the stack and avoid rerunning test already performed in one of the dependencies.

Open Questions

  • there are still some packages that a tricky to implement. In particular suitesparse still needs some discussion.
  • we might transition several tests to use pkg-config and by this reduce the cmake code we have to maintain.
  • how do we properly handle config.h, although this is a general question and not specific to pkg-config.

Using DUNE without cmake

With these new features it is now possible to use DUNE without the DUNE build-system and in particular without cmake, just using the information provided by pkg-config.

An example can be found in infrastructure/pkg-config-test, which will serve us as test-infrastructure.

The user has to set the PKG_CONFIG_PATH and can then find the necessary DUNE flags.

> export PKG_CONFIG_PATH="[INSTALLDIR]/lib/pkg-config:[INSTALLDIR]/lib/pkg-config/dune:$PKG_CONFIG_PATH"

The he/she can use basically any type of build-system.

Here follow three examples:

Plain Makefile

CXXFLAGS = -g -Wall $(shell pkg-config --cflags dune-istl)
LDFLAGS = -g -Wall $(shell pkg-config --libs-only-L dune-istl)
LDLIBS = $(shell pkg-config --libs-only-l --libs-only-other dune-istl)

CC=g++
CXX=g++

all: myduneprogram

Meson

project('myduneprogram', 'cpp')

dune_istl = dependency('dune-istl')
executable('myduneprogram', ['src/myduneprogram.cc'], dependencies: dune_istl)

Plain CMake

cmake_minimum_required(VERSION 3.13)
project(myduneprogram LANGUAGES CXX)

include(FindPkgConfig)
pkg_check_modules(dune_istl REQUIRED IMPORTED_TARGET dune-istl)

add_executable(myduneprogram src/myduneprogram.cc)
target_link_libraries(myduneprogram PRIVATE PkgConfig::dune_istl)
target_include_directories(myduneprogam PRIVATE ${CMAKE_BINARY_DIR})
Edited Jan 19, 2021 by Christian Engwer
Assignee
Assign to
Reviewer
Request review from
None
Milestone
None
Assign milestone
Time tracking
Reference: core/dune-common!910
Source branch: fix-pkg-config