Add a way to force system asio to be used

This commit is contained in:
Robbert van der Helm
2022-06-10 14:09:01 +02:00
parent b826f80037
commit c4c4bacd14
3 changed files with 51 additions and 1 deletions
+17
View File
@@ -6,6 +6,23 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic
Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
### Added
- Added a `system-asio` build option to aid distro packaging.
### Packaging notes
- The new `system-asio` build option forces asio to be used from the standard
include directories instead of being defined as a regular Meson dependency.
Asio does not have any pkgconfig or CMake [build
definitions](https://github.com/chriskohlhoff/asio/issues/1071), so it's
impossible to detect its presence and version in a normal way, and as such
Meson will fall back to using the included wrap dependency. Configuring the
project with `meson setup build -Dsystem-asio=true ...` will cause
`<asio.hpp>` to be used instead.
## [4.0.0] - 2022-06-09
### Added
+22 -1
View File
@@ -22,6 +22,7 @@ project(
is_64bit_system = build_machine.cpu_family() not in ['x86', 'arm']
with_32bit_libraries = (not is_64bit_system) or get_option('build.cpp_args').contains('-m32')
with_bitbridge = get_option('bitbridge')
with_system_asio = get_option('system-asio')
with_winedbg = get_option('winedbg')
with_vst3 = get_option('vst3')
@@ -192,7 +193,27 @@ endif
# These are all headers-only libraries, and thus won't require separate 32-bit
# and 64-bit versions
asio_dep = dependency('asio', version : '>=1.22.0')
# NOTE: The standalone asio library does not come with a pkgconfig or CMake
# build definition, and Meson thus also won't be able to detect it this
# way. As a workaround for distro packaging, configuring the project with
# `-Dsystem-asio=true` will use `<asio.h>` from the standard include
# directories instead.
if with_system_asio
if not meson.get_compiler('cpp', native : true).check_header('asio.hpp')
error('The \'system-asio\' build option was set, but <asio.hpp> was not found')
endif
asio_version = meson.get_compiler('cpp', native : true).get_define('ASIO_VERSION', prefix : '#include <asio.hpp>')
if asio_version.to_int() < 102000
error('Expected version 1.22.0 of the asio library or higher, found @0@ (MMmmrr)'.format(asio_version))
endif
# This is a dummy dependency, since the library is only accessible implicitly through the system include path
asio_dep = declare_dependency()
else
asio_dep = dependency('asio', version : '>=1.22.0')
endif
if meson.version().version_compare('>=0.60')
# Bitsery's CMake build definition is capitalized for some reason
bitsery_dep = dependency('bitsery', 'Bitsery', version : '>=5.2.0')
+12
View File
@@ -5,6 +5,18 @@ option(
description : 'Build a 32-bit host application for hosting 32-bit plugins. See the readme for full instructions on how to use this.'
)
option(
'system-asio',
type : 'boolean',
value : false,
description : '''If set to true, then <asio.hpp> from the standard include
directories will be used in place of a pkgconfig definition,
CMake dependency, or subproject wrap. The asio library does
not come with any build definitions Meson can use to detect
its installed version and location, so this behavior is
behind an option as it's only relevant for distro packaging.'''
)
option(
'vst3',
type : 'boolean',