tomlc99 icon indicating copy to clipboard operation
tomlc99 copied to clipboard

meson: Add basic meson build definition

Open jk-ozlabs opened this issue 1 year ago • 1 comments

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.

jk-ozlabs avatar Jan 29 '24 10:01 jk-ozlabs

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)

jk-ozlabs avatar Jan 30 '24 06:01 jk-ozlabs