g810-led icon indicating copy to clipboard operation
g810-led copied to clipboard

Add a meson build system

Open dcbaker opened this issue 5 years ago • 1 comments

meson is a build system generator similar to cmake or autotools, but without the craziness of either of those languages. It provides a pleasant scripting language that is inspired by languages like python, but is not python. It has a non-turring complete language, with an emphasis on upstream functionality instead of downstream scripts. It has support for most Unix-like OSes, including Linux, the four major BSDs, and macOS. this includes support for abstracting dependency discovery, using pkg-config, macOS frameworks, cmake, and some hand coded finders for very common packages. It provides nice features like builtin support for debug builds, changing from static to shared library builds, turning warning arguments on and off, generates for pkg-config, and other modern niceties.

For g810-led this provides a number of advantages for distro packaging. Distros already use meson for projects like mesa, systemd, and gnome, so they're packaging wrappers already know how to configure, build, and install meson based packages. It also provides advantages when moving to other platforms, as meson understands the difference between clang, apple's clang fork, gcc, and a host of other compilers.

I'll understand if you're not interested, I mostly wrote this for my own use ( the make system included doesn't work on my distro without passing a host of linker flags due to where libraries are placed, but would work fine if pkg-config was used). I thought I'd offer, since there's also work on using this with macos, and meson would hopefully simplify that as well.

One major difference between the meson build and the markefile build is that the meson build doesn't attempt to link a default profile, or run systemd commands on install/uninstall. That really isn't something that the build system should be doing, that's something the distro package manager should be doing for you.

I've additionally added a pkg-config file for the library, to make linking against it simpler, especially when libhidapi is used, and an additional -D option needs to be passed to the compiler.

dcbaker avatar May 07 '20 22:05 dcbaker

Thank for the PR... I just discover meson. Maintaining multiple build systems makes things more complicated. But I like this solution.

MatMoul avatar May 08 '20 21:05 MatMoul