Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

meson: Add basic meson build definition #90

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jk-ozlabs
Copy link

Add a simple meson.build file to build and install a library (shared by default, but easily configurable as static too), headers and libtoml.pc metadata.

$ meson setup --prefix=$PWD/install obj
[...]
$ ninja -C obj
ninja: Entering directory `obj'
[2/2] Linking target libtoml.so
$ ninja -C obj install
ninja: Entering directory `obj'
[0/1] Installing files.
Installing libtoml.so to /home/jk/devel/tomlc99/install/lib/x86_64-linux-gnu
Installing /home/jk/devel/tomlc99/toml.h to /home/jk/devel/tomlc99/install/include/
Installing /home/jk/devel/tomlc99/obj/meson-private/tomlc99.pc to /home/jk/devel/tomlc99/install/lib/x86_64-linux-gnu/pkgconfig
$ find install/ -type f -o -type l
install/include/toml.h
install/lib/x86_64-linux-gnu/libtoml.so
install/lib/x86_64-linux-gnu/libtoml.so.1
install/lib/x86_64-linux-gnu/libtoml.so.1.0
install/lib/x86_64-linux-gnu/pkgconfig/tomlc99.pc

We're mirroring the naming used by the existing Makefile here; project name is tomlc99, library name is libtoml.

Add a simple meson.build file to build and install a library (shared by
default, but easily configurable as static too), headers and
`libtoml.pc` metadata.

    $ meson setup --prefix=$PWD/install obj
    [...]
    $ ninja -C obj
    ninja: Entering directory `obj'
    [2/2] Linking target libtoml.so
    $ ninja -C obj install
    ninja: Entering directory `obj'
    [0/1] Installing files.
    Installing libtoml.so to /home/jk/devel/tomlc99/install/lib/x86_64-linux-gnu
    Installing /home/jk/devel/tomlc99/toml.h to /home/jk/devel/tomlc99/install/include/
    Installing /home/jk/devel/tomlc99/obj/meson-private/tomlc99.pc to /home/jk/devel/tomlc99/install/lib/x86_64-linux-gnu/pkgconfig
    $ find install/ -type f -o -type l
    install/include/toml.h
    install/lib/x86_64-linux-gnu/libtoml.so
    install/lib/x86_64-linux-gnu/libtoml.so.1
    install/lib/x86_64-linux-gnu/libtoml.so.1.0
    install/lib/x86_64-linux-gnu/pkgconfig/tomlc99.pc

We're mirroring the naming used by the existing Makefile here; project
name is `tomlc99`, library name is `libtoml`.

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
@jk-ozlabs
Copy link
Author

The rationale here is allowing simple integration into another project, using meson's wrap system. We just need the following in that project's own meson.build:

toml_dep = dependency('tomlc99', fallback: ['tomlc99', 'libtoml_dep'])

And a wrap definition in subprojects/tomlc99.wrap, containing:

[wrap-git]
url = https://github.com/cktan/tomlc99
revision = <version>

(I'm happy to add instructions to the readme, but probably best done after the PR is integrated, as the url won't be valid until then)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant