Skip to content

Commit

Permalink
meson: Install CMake and pkg-config files into architecture-independe… (
Browse files Browse the repository at this point in the history
#60)

toml++ is header-only so these should be installed into architecture-independent directories to allow them to be found for crosscompiling regardless of the architecture they were installed on.

Fixes #59.
  • Loading branch information
tambry authored Sep 17, 2020
1 parent bf26a88 commit 248e603
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ if is_msvc or is_icc_cl
'/GF', # string pooling
'/openmp-',
'/permissive-',
'/sdl-',
'/sdl-',
'/utf-8',
'/volatile:iso',
'/Zc:__cplusplus',
Expand All @@ -182,7 +182,7 @@ if is_msvc or is_icc_cl
'/Oy', # omit frame pointers
'/Oi', # generate intrinsics
language : 'cpp'
)
)
add_project_link_arguments('/ltcg', language : 'cpp')
endif
if is_pedantic
Expand Down Expand Up @@ -479,24 +479,27 @@ tomlplusplus_dep = declare_dependency(
)

pkgc = import('pkgconfig')
pkgc.generate (
pkgc.generate(
name: meson.project_name(),
version: meson.project_version(),
description: 'Header-only TOML config file parser and serializer for modern C++'
description: 'Header-only TOML config file parser and serializer for modern C++',
install_dir: join_paths(get_option('datadir'), 'pkgconfig'),
)

# cmake
if get_option('generate_cmake_config') and not is_subproject
cmake = import('cmake')
cmake.write_basic_package_version_file(
name: meson.project_name(),
version: meson.project_version()
version: meson.project_version(),
install_dir: join_paths('lib', 'cmake', meson.project_name()),
)

cmake_conf = configuration_data()
cmake.configure_package_config_file(
name: meson.project_name(),
input: 'cmake/tomlplusplus.cmake.in',
configuration: cmake_conf,
install_dir: join_paths('lib', 'cmake', meson.project_name()),
)
endif

3 comments on commit 248e603

@Tachi107
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two small issues with this:

  1. The architecture-independent directory of CMake Config and Version files is datadir/cmake
  2. CMake Version files are not architecture independent unless created with the ARCHITECTURE_INDEPENDENT option, and that is currently not supported by Meson (from the CMake docs : "an architecture check will be performed, and the package will be considered compatible only if the architecture matches exactly. For example, if the package is built for a 32-bit architecture, the package is only considered compatible if it is used on a 32-bit architecture, unless ARCH_INDEPENDENT is given")

@marzer
Copy link
Owner

@marzer marzer commented on 248e603 Jan 31, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't use CMake at all so I have no idea. You're welcome to submit a PR fixing whatever issues you have with the CMake integration.

@Tachi107
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #140

Please sign in to comment.