summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2023-01-14 21:34:23 -0500
committerDavid Robillard <d@drobilla.net>2023-01-14 21:34:23 -0500
commitf33d936ce99f9c175ed1171e93b0217258537bb1 (patch)
tree4885251b1614800b11592b60bbcf5032f84b8149
parent819fba38eb5fb2f9671471f7b967d696688a1807 (diff)
downloadingen-f33d936ce99f9c175ed1171e93b0217258537bb1.tar.gz
ingen-f33d936ce99f9c175ed1171e93b0217258537bb1.tar.bz2
ingen-f33d936ce99f9c175ed1171e93b0217258537bb1.zip
Fix and simplify library naming on Windows
-rw-r--r--meson.build11
-rw-r--r--meson/library/meson.build31
-rw-r--r--src/meson.build3
3 files changed, 12 insertions, 33 deletions
diff --git a/meson.build b/meson.build
index 7a1ca3a2..c6572e32 100644
--- a/meson.build
+++ b/meson.build
@@ -58,6 +58,16 @@ endif
ingen_data_dir = get_option('prefix') / get_option('datadir') / 'ingen' # / versioned_name
ingen_module_dir = get_option('prefix') / get_option('libdir') # / versioned_name
+# 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
+
platform_defines = [
'-DINGEN_DATA_DIR="@0@"'.format(ingen_data_dir),
'-DINGEN_MODULE_DIR="@0@"'.format(ingen_module_dir),
@@ -153,7 +163,6 @@ platform_defines += '-DHAVE_JACK_PORT_RENAME=@0@'.format(
#############
# Set appropriate arguments for building against the library type
-subdir('meson/library')
if get_option('default_library') == 'static'
add_project_arguments(['-DINGEN_STATIC'], language: ['cpp'])
endif
diff --git a/meson/library/meson.build b/meson/library/meson.build
deleted file mode 100644
index 921f3c33..00000000
--- a/meson/library/meson.build
+++ /dev/null
@@ -1,31 +0,0 @@
-# Copyright 2020-2022 David Robillard <d@drobilla.net>
-# SPDX-License-Identifier: 0BSD OR GPL-3.0-or-later
-
-# 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
diff --git a/src/meson.build b/src/meson.build
index 833a9db2..56c7fc86 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -42,7 +42,7 @@ ingen_deps = [
ingen_include_dirs = include_directories('../include', 'include')
libingen = shared_library(
- 'ingen' + library_suffix,
+ versioned_name,
sources,
cpp_args: cpp_suppressions + platform_defines,
dependencies: ingen_deps,
@@ -50,6 +50,7 @@ libingen = shared_library(
implicit_include_directories: false,
include_directories: ingen_include_dirs,
install: true,
+ soversion: soversion,
version: meson.project_version(),
)