diff options
author | David Robillard <d@drobilla.net> | 2023-01-14 20:10:38 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2023-01-14 20:10:38 -0500 |
commit | 1521f6628ee43deb09eb9c6d36a8a4efe8f7567c (patch) | |
tree | cdf44b8da7dbfaebae5081e1d7121ab6d104c4ea | |
parent | 56ec14c4369c591f5efbb500b0829b760bee7800 (diff) | |
download | zix-1521f6628ee43deb09eb9c6d36a8a4efe8f7567c.tar.gz zix-1521f6628ee43deb09eb9c6d36a8a4efe8f7567c.tar.bz2 zix-1521f6628ee43deb09eb9c6d36a8a4efe8f7567c.zip |
Fix and simplify library naming on Windows
-rw-r--r-- | meson.build | 16 | ||||
-rw-r--r-- | meson/library/meson.build | 31 |
2 files changed, 13 insertions, 34 deletions
diff --git a/meson.build b/meson.build index bbf63d0..5eaf574 100644 --- a/meson.build +++ b/meson.build @@ -40,6 +40,16 @@ thread_dep = dependency('threads', required: get_option('threads')) platform_c_args = [] +# 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 + # Determine whether to use POSIX no_posix = get_option('posix').disabled() or host_machine.system() == 'windows' if no_posix @@ -259,7 +269,6 @@ if thread_dep.found() endif # Set appropriate arguments for building against the library type -subdir('meson/library') extra_c_args = [] if get_option('default_library') == 'static' extra_c_args = ['-DZIX_STATIC'] @@ -296,7 +305,7 @@ endif # Build shared and/or static library libzix = library( - meson.project_name() + library_suffix, + versioned_name, sources, c_args: c_suppressions + library_c_args, dependencies: [thread_dep], @@ -304,6 +313,7 @@ libzix = library( include_directories: include_dirs, install: true, link_args: library_link_args, + soversion: soversion, version: meson.project_version(), ) @@ -444,7 +454,7 @@ if not get_option('tests').disabled() '-Wno-poison-system-directories', ] endif - + elif cc.get_id() == 'gcc' header_suppressions += [ '-Wno-padded', 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 |