From abdf052c7c3c206511878aa10bce700cfb9701b5 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 29 May 2022 10:41:04 -0400 Subject: Make meson configuration more modular --- meson/library/meson.build | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 meson/library/meson.build (limited to 'meson/library/meson.build') diff --git a/meson/library/meson.build b/meson/library/meson.build new file mode 100644 index 0000000..5533fb5 --- /dev/null +++ b/meson/library/meson.build @@ -0,0 +1,25 @@ +# Copyright 2020-2022 David Robillard +# SPDX-License-Identifier: CC0-1.0 OR ISC + +# General code to determine the library type to build. +# +# Unfortunately, meson's default_library option does not handle real-world +# situations out of the box. In particular, it is usually necessary to specify +# different flags for static and shared builds of C libraries so that symbols +# can be exported. To work around this, we do not support default_library=both +# 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. + +if get_option('default_library') == 'both' + if host_machine.system() == 'windows' + error('default_library=both is not supported on Windows') + endif + + library_type = 'both_libraries' +elif get_option('default_library') == 'shared' + library_type = 'shared_library' +else + library_type = 'static_library' + add_project_arguments(['-DPUGL_STATIC'], language: ['c', 'cpp', 'objc']) +endif -- cgit v1.2.1