summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2023-01-14 20:36:24 -0500
committerDavid Robillard <d@drobilla.net>2023-01-14 20:36:24 -0500
commitaaba53520913cfdb27caa09bd2e682739294fade (patch)
tree98971b0d768d4578f3f3cac55a8bc09311ee857c
parent3a9b8e38a146dfdbb618d95f6db8fa919fa2e3e6 (diff)
downloadlilv-aaba53520913cfdb27caa09bd2e682739294fade.tar.gz
lilv-aaba53520913cfdb27caa09bd2e682739294fade.tar.bz2
lilv-aaba53520913cfdb27caa09bd2e682739294fade.zip
Fix and simplify library naming on Windows
-rw-r--r--meson.build16
-rw-r--r--meson/library/meson.build31
2 files changed, 13 insertions, 34 deletions
diff --git a/meson.build b/meson.build
index d382ff4..c8151fe 100644
--- a/meson.build
+++ b/meson.build
@@ -83,6 +83,16 @@ platform_defines += [
'-DLILV_DEFAULT_LV2_PATH="@0@"'.format(default_lv2_path)
]
+# Use versioned name everywhere to support parallel major version installations
+if host_machine.system() == 'windows'
+ if get_option('default_library') == 'both'
+ error('default_library=both is not supported on Windows')
+ endif
+ soversion = ''
+else
+ soversion = meson.project_version().split('.')[0]
+endif
+
add_project_arguments(platform_defines, language: ['c'])
################
@@ -133,20 +143,20 @@ common_dependencies = [
# Set appropriate arguments for building against the library type
extra_c_args = []
-subdir('meson/library')
if get_option('default_library') == 'static'
extra_c_args = ['-DLILV_STATIC']
endif
# Build main shared and/or static library
liblilv = library(
- meson.project_name() + library_suffix,
+ versioned_name,
sources,
c_args: c_suppressions + extra_c_args + ['-DLILV_INTERNAL'],
dependencies: common_dependencies,
gnu_symbol_visibility: 'hidden',
include_directories: include_directories('include', 'src'),
install: true,
+ soversion: soversion,
version: meson.project_version(),
)
@@ -207,7 +217,7 @@ if not get_option('tests').disabled()
liblilv_static = liblilv.get_static_lib()
elif get_option('default_library') == 'shared'
liblilv_static = static_library(
- meson.project_name() + library_suffix,
+ versioned_name,
sources,
include_directories: include_directories('include', 'src'),
c_args: c_suppressions + ['-DLILV_INTERNAL', '-DLILV_STATIC'],
diff --git a/meson/library/meson.build b/meson/library/meson.build
deleted file mode 100644
index 756a222..0000000
--- a/meson/library/meson.build
+++ /dev/null
@@ -1,31 +0,0 @@
-# Copyright 2020-2022 David Robillard <d@drobilla.net>
-# SPDX-License-Identifier: 0BSD 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