| 1 |
# Copyright 2020-2022 David Robillard <[email protected]> |
| 2 |
# SPDX-License-Identifier: CC0-1.0 OR GPL-2.0-or-later |
| 3 |
|
| 4 |
# General definitions for building libraries. |
| 5 |
# |
| 6 |
# These are essentially workarounds for Meson/Windows/MSVC. Unfortunately, |
| 7 |
# Meson's default_library option doesn't support shared and static builds very |
| 8 |
# well. In particular, it's often necessary to define different symbols for |
| 9 |
# static and shared builds of libraries so that symbols can be exported. To |
| 10 |
# work around this, default_library=both isn't supported on Windows. On other |
| 11 |
# platforms with GCC-like compilers, we can support both because symbols can |
| 12 |
# safely be exported in the same way (giving them default visibility) in both |
| 13 |
# static and shared builds. |
| 14 |
|
| 15 |
default_library = get_option('default_library') |
| 16 |
host_system = host_machine.system() |
| 17 |
|
| 18 |
# Abort on Windows with default_library=both |
| 19 |
if host_system == 'windows' and default_library == 'both' |
| 20 |
error('default_library=both is not supported on Windows') |
| 21 |
endif |
| 22 |
|
| 23 |
# Set library_suffix to the suffix for libraries |
| 24 |
if host_system == 'windows' and default_library == 'shared' |
| 25 |
# Meson appends a version to the name only for DLLs, which leads to |
| 26 |
# inconsistent library names, like `mylib-1-1`. So, provide no suffix to |
| 27 |
# ultimately get the same name as on other platforms, like `mylib-1`. |
| 28 |
library_suffix = '' |
| 29 |
else |
| 30 |
library_suffix = '-@0@'.format(meson.project_version().split('.')[0]) |
| 31 |
endif |