From e9bbaf95fbe57d730bfb1ab40a41428ed4ee2ff6 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 14 Jan 2023 12:11:00 -0500 Subject: Simplify library build definitions --- meson.build | 22 ++++++++++------------ meson/library/meson.build | 28 ---------------------------- 2 files changed, 10 insertions(+), 40 deletions(-) delete mode 100644 meson/library/meson.build diff --git a/meson.build b/meson.build index 006939d..6ce6c8d 100644 --- a/meson.build +++ b/meson.build @@ -80,6 +80,10 @@ if host_machine.system() == 'darwin' # Windows elif host_machine.system() == 'windows' + if get_option('default_library') == 'both' + error('default_library=both is not supported on Windows') + endif + if cc.get_id() == 'msvc' msvc_args = [ '/experimental:external', @@ -208,8 +212,7 @@ core_name = 'pugl_@0@@1@'.format(platform, version_suffix) includes = include_directories(['include']) library_args = ['-DPUGL_INTERNAL'] -subdir('meson/library') -if library_type == 'static_library' +if get_option('default_library') == 'static' add_project_arguments( ['-DPUGL_STATIC'], language: ['c', 'cpp', 'objc', 'objcpp'], @@ -221,7 +224,7 @@ common_sources = files( 'src/internal.c', ) -libpugl = build_target( +libpugl = library( core_name, common_sources + platform_sources, c_args: library_args + core_args, @@ -230,7 +233,6 @@ libpugl = build_target( include_directories: includes, install: true, soversion: soversion, - target_type: library_type, version: meson.project_version(), ) @@ -260,7 +262,7 @@ if get_option('stub') name = 'pugl_' + platform + '_stub' + version_suffix sources = files('src/' + platform + '_stub' + extension) - stub_backend = build_target( + stub_backend = library( name, sources, c_args: library_args, @@ -269,7 +271,6 @@ if get_option('stub') include_directories: includes, install: true, soversion: soversion, - target_type: library_type, version: meson.project_version(), ) @@ -302,7 +303,7 @@ if opengl_dep.found() name = 'pugl_' + platform + '_gl' + version_suffix sources = files('src/' + platform + '_gl' + extension) - gl_backend = build_target( + gl_backend = library( name, sources, c_args: library_args, @@ -311,7 +312,6 @@ if opengl_dep.found() include_directories: includes, install: true, soversion: soversion, - target_type: library_type, version: meson.project_version(), ) @@ -355,7 +355,7 @@ if cairo_dep.found() cairo_args = cc.get_supported_arguments(cairo_args) - cairo_backend = build_target( + cairo_backend = library( name, sources, c_args: library_args + cairo_args, @@ -365,7 +365,6 @@ if cairo_dep.found() install: true, objc_args: library_args + cairo_args, soversion: soversion, - target_type: library_type, version: meson.project_version(), ) @@ -410,7 +409,7 @@ if vulkan_dep.found() ] endif - vulkan_backend = build_target( + vulkan_backend = library( name, sources, c_args: library_args, @@ -419,7 +418,6 @@ if vulkan_dep.found() include_directories: includes, install: true, soversion: soversion, - target_type: library_type, version: meson.project_version(), ) diff --git a/meson/library/meson.build b/meson/library/meson.build deleted file mode 100644 index 722406e..0000000 --- a/meson/library/meson.build +++ /dev/null @@ -1,28 +0,0 @@ -# Copyright 2020-2022 David Robillard -# SPDX-License-Identifier: 0BSD 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', 'objcpp'], - ) -endif -- cgit v1.2.1