-
-
Notifications
You must be signed in to change notification settings - Fork 155
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
build(meson): CMake's Package Version file is installed in the wrong place #140
Comments
The library is always header-only. The user can choose to 'compile' it by disabling header-only mode and marking a specific TU as the 'implementation' one, but that's got nothing to do with the build system in the traditional sense. |
Unrelated to this issue, but would you accept a PR enabling support for building and installing the library implemented in Meson? I ask because I'd like to package this library for Debian (and derivatives), and traditional libraries are generally preferred to header-only ones (thanks to shared linking- packaging a header-only library doesn't make users' lives better). I'm thinking to something similar to how cpp-httplib does it (but without the split.py part), you can take a look here: https://github.com/yhirose/cpp-httplib/blob/master/meson.build |
As long as it's not overly disruptive to current workflows and isn't cumbersome to maintain, sure. It being header-only is mostly for my benefit.
What is the path forward for this this issue? I'm not going to do anything about CMake-related issues myself, since I value my blood un-boiled - I'd sooner just close it. From your description above, it sounds like "do nothing until meson gets a fix" is the right move, but I don't know enough about the interop to make any real suggestions here. |
The fix to Meson is pending in mesonbuild/meson#9916, but will require toml++ to bump its Meson requirement to version 0.62.0 (when released). Doing nothing about this would prevent the library from getting packaged in Linux distributions and basically any other package manager (or at least that's what I would do), since it causes issues for things like cross-architecture compatibility. In my opinion, the "best" solution to this is to drop Meson's If you like this solution, I could prepare a PR :) |
Sounds good to me, fire away |
They would also have the option to configure the project with
Not true. Given: Lines 534 to 538 in 8e669aa
This could be changed to: # cmake_installdir = get_option('build_libary') ? 'lib' : get_option('datadir')
# cmake_installdir = cmake_installdir / 'cmake' / meson.project_name()
cmake_installdir = 'lib/cmake' / meson.project_name()
if meson.version().version_compare('>=0.62.0')
cmake.write_basic_package_version_file(
name: meson.project_name(),
version: meson.project_version(),
arch_independent: true, # get_option('build_library')
install_dir: cmake_installdir,
)
else
cmake.write_basic_package_version_file(
name: meson.project_name(),
version: meson.project_version(),
install_dir: cmake_installdir,
)
endif It would then generate an architecture-dependent file on older versions of meson, and an architecture-independent file on newer versions of meson. People using old versions of meson would "pay the price" by having worse versions of the file, which they may or may not care about (Debian certainly does). You could also use: if meson.version().version_compare('>=0.62.0')
cmake_kwargs = {'arch_independent': true}
else
cmake_kwargs = {}
endif
cmake.write_basic_package_version_file(
name: meson.project_name(),
version: meson.project_version(),
install_dir: 'lib'/'cmake'/meson.project_name(),
kwargs: cmake_kwargs,
) but that would emit a FeatureNew warning on 0.62. |
Right
Oh right, |
Since Meson doesn't yet support CMake's ARCH_INDEPENDENT option, a pre-generated Package Version file in installed instead of generating it at configure time. I've also cleaned up a bit the nearby lines of code. Fixes marzer#140
Since Meson doesn't yet support CMake's ARCH_INDEPENDENT option, a pre-generated Package Version file is installed instead of generating it at configure time. I've also cleaned up a bit the nearby lines of code. Fixes marzer#140
Since Meson doesn't yet support CMake's ARCH_INDEPENDENT option, a pre-generated Package Version file is installed instead of generating it at configure time. I've also cleaned up a bit the nearby lines of code. Fixes marzer#140
* build(meson): install CMake Config files to datadir Since Meson doesn't yet support CMake's ARCH_INDEPENDENT option, a pre-generated Package Version file is installed instead of generating it at configure time. I've also cleaned up a bit the nearby lines of code. Fixes #140 * build(meson): don't hardcode include in CMake Config
Environment
toml++ version and/or commit hash: 248e603 to present
Target arch: all
Describe the bug
Quoting 248e603#commitcomment-65698096
I don't use personally use the CMake integration, but as a (newbie) Debian package maintainer I'm starting to care about architecture compatibilities. The most appropriate fix would be to set
ARCH_INDEPENDENT
, but that would require a patch in upstream Meson, so we currently have three options:write_basic_package_version_file()
, but move the output to the arch-dependentlibdir/cmake
- might require to also move the Config file, and it is not rightdatadir/cmake
- I don't know if you ever looked at one, but they are not really human-friendlyfind_package(tomlplusplus)
, but without specifying the desired versionI haven't used Toml++ in quite some time, but I believe that this library can be consumed as both an header-only library and a compiled library, right? If so, neither the pkg-config file nor the CMake ones should unconditionally get installed in the architecture-independent directory, but that should depend on the current configuration (
libdir
when compiling the library,datadir
when header-only)The text was updated successfully, but these errors were encountered: