How to install eigen library (or any other header-only library) into flatpak-builder environment?

389 views Asked by At

I'm trying to incorporate the eigen library into the flatpak build of my application, but can't figure out how to do it properly. So far, I've only used libraries using the cmake-ninja as buildsystem and that has worked quite well. Since eigen is a header only library, I suppose it should somehow work with the simple buildsystem, but I can't figure out how to specify that the Eigen subfolder from the source files has to be installed to the /include folder. What I've tried so far in my manifest:

{
   ...
   modules = [
        ...
        {
            "name": "eigen",
            "buildsystem": "simple",
            "build-commands": [ "install -d Eigen /include/Eigen" ] ,
            "sources": [
                {
                    "type": "archive",
                    "url": "https://gitlab.com/libeigen/eigen/-/archive/3.3.9/eigen-3.3.9.zip",
                    "sha512": "3b06da583037649ad42190bd018ddf40b85179ad0877ebd7c1ca7b8498a1453eed25919de27d3bb737754086e1513408e7de4a2110d51912f2e5503e1ab7d838"
                }
            ]
        },
        ...
}

But no files get copied into the /include subfolder, and my application's CMake build subsequently then of course also doesn't find eigen. There must be something very simple I'm missing here.

I've tried looking this up on the web for some hours now, but I'm not even sure yet which documentation might help me here. The flatpak-builder command reference seems too brief on information to be useful in this context, and also in the flatpak documentation I didn't really find anything that fits my needs. The tutorials I found only useinstall -D hello.sh ... as build-command for the simple buildsystem; some use npm commands, which got me confused - I tried apt install..., but of course apt isn't available - is there some reference if/which package managers are available in which runtime maybe?.

I understand that in my above command, flatpak builder probably cannot determine the path of the Eigen that I want to copy (though there is no error message in the output) - but how do I specify that it's the folder from the sources folder?

1

There are 1 answers

0
codeling On BEST ANSWER

I guess my original question can be answered easily, since I just realized that eigen actually supports cmake. So changing my module to this:

{
   ...
   modules = [
        ...
        {
            "name": "eigen",
            "buildsystem": "cmake",
            "builddir": true,
            "sources": [
                {
                    "type": "archive",
                    "url": "https://gitlab.com/libeigen/eigen/-/archive/3.3.9/eigen-3.3.9.zip",
                    "sha512": "3b06da583037649ad42190bd018ddf40b85179ad0877ebd7c1ca7b8498a1453eed25919de27d3bb737754086e1513408e7de4a2110d51912f2e5503e1ab7d838"
                }
            ]
        },
        ...
}

makes everything work.