diff options
author | David Robillard <d@drobilla.net> | 2022-05-29 10:41:04 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2022-05-29 10:47:43 -0400 |
commit | abdf052c7c3c206511878aa10bce700cfb9701b5 (patch) | |
tree | aa71dff3c5ecbe0e5499f93fce0c38b196a5dc8d /meson/library | |
parent | 4dd1eac7c46f7be257ce10cb2ce6b79939650938 (diff) | |
download | pugl-abdf052c7c3c206511878aa10bce700cfb9701b5.tar.gz pugl-abdf052c7c3c206511878aa10bce700cfb9701b5.tar.bz2 pugl-abdf052c7c3c206511878aa10bce700cfb9701b5.zip |
Make meson configuration more modular
Diffstat (limited to 'meson/library')
-rw-r--r-- | meson/library/meson.build | 25 |
1 files changed, 25 insertions, 0 deletions
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 <d@drobilla.net> +# 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 |