summaryrefslogtreecommitdiffstats
path: root/meson/library
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2022-07-14 15:38:57 -0400
committerDavid Robillard <d@drobilla.net>2022-08-13 18:17:34 -0400
commit03b1626676f596d78df9de718e3e079e8269f5cc (patch)
tree5a99193e9ba6f0b67620462c632fbd30b88b46ec /meson/library
parent3ca0a8cf142d59bd0c76d141fa394ffacc6f9c12 (diff)
downloadganv-03b1626676f596d78df9de718e3e079e8269f5cc.tar.gz
ganv-03b1626676f596d78df9de718e3e079e8269f5cc.tar.bz2
ganv-03b1626676f596d78df9de718e3e079e8269f5cc.zip
Switch to meson build system
Diffstat (limited to 'meson/library')
-rw-r--r--meson/library/meson.build31
1 files changed, 31 insertions, 0 deletions
diff --git a/meson/library/meson.build b/meson/library/meson.build
new file mode 100644
index 0000000..fffc831
--- /dev/null
+++ b/meson/library/meson.build
@@ -0,0 +1,31 @@
+# Copyright 2020-2022 David Robillard <d@drobilla.net>
+# SPDX-License-Identifier: CC0-1.0 OR ISC
+
+# General definitions for building libraries.
+#
+# These are essentially workarounds for Meson/Windows/MSVC. Unfortunately,
+# Meson's default_library option doesn't support shared and static builds very
+# well. In particular, it's often necessary to define different symbols for
+# static and shared builds of libraries so that symbols can be exported. To
+# work around this, default_library=both isn't supported on Windows. On other
+# platforms with GCC-like compilers, we can support both because symbols can
+# safely be exported in the same way (giving them default visibility) in both
+# static and shared builds.
+
+default_library = get_option('default_library')
+host_system = host_machine.system()
+
+# Abort on Windows with default_library=both
+if host_system == 'windows' and default_library == 'both'
+ error('default_library=both is not supported on Windows')
+endif
+
+# Set library_suffix to the suffix for libraries
+if host_system == 'windows' and default_library == 'shared'
+ # Meson appends a version to the name only for DLLs, which leads to
+ # inconsistent library names, like `mylib-1-1`. So, provide no suffix to
+ # ultimately get the same name as on other platforms, like `mylib-1`.
+ library_suffix = ''
+else
+ library_suffix = '-@0@'.format(meson.project_version().split('.')[0])
+endif