From d6e8d39292143755e5b19e96422e239442fd0e92 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Thu, 25 Jun 2020 15:38:42 +0100 Subject: [PATCH] build: Add subproject support for libsysprof-capture MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This will be used to build libsysprof-capture as a subproject within libglib, with the symbols from libglib being left unresolved until the static libsysprof-capture is linked into libglib. When built as a subproject, libsysprof-capture won’t install anything. Signed-off-by: Philip Withnall --- src/libsysprof-capture/meson.build | 33 +++++++++++++++++------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/src/libsysprof-capture/meson.build b/src/libsysprof-capture/meson.build index c8cd6895..5f5b7ca2 100644 --- a/src/libsysprof-capture/meson.build +++ b/src/libsysprof-capture/meson.build @@ -13,7 +13,9 @@ libsysprof_capture_headers = files([ 'sysprof-version-macros.h', ]) -install_headers(libsysprof_capture_headers, subdir: sysprof_header_subdir) +if not meson.is_subproject() + install_headers(libsysprof_capture_headers, subdir: sysprof_header_subdir) +endif libsysprof_capture_sources = files([ 'mapped-ring-buffer.c', @@ -34,6 +36,7 @@ configure_file( output: 'sysprof-version.h', configuration: sysprof_version_conf, install_dir: join_paths(get_option('includedir'), sysprof_header_subdir), + install: not meson.is_subproject(), ) libsysprof_capture_deps = [ @@ -47,7 +50,7 @@ libsysprof_capture = static_library( dependencies: libsysprof_capture_deps, c_args: [ '-DSYSPROF_CAPTURE_COMPILATION' ], install_dir: get_option('libdir'), - install: true, + install: not meson.is_subproject(), gnu_symbol_visibility: 'hidden', ) @@ -59,15 +62,17 @@ libsysprof_capture_dep = declare_dependency( include_directories: libsysprof_capture_include_dirs, ) -pkgconfig.generate( - libraries: [libsysprof_capture], - subdirs: [ sysprof_header_subdir ], - version: meson.project_version(), - name: 'sysprof-capture-@0@'.format(libsysprof_api_version), - filebase: 'sysprof-capture-@0@'.format(libsysprof_api_version), - description: 'The static capture library for tools that generate profiling capture data', - install_dir: join_paths(get_option('libdir'), 'pkgconfig'), - variables: [ - 'datadir=' + datadir_for_pc_file, - ], -) +if not meson.is_subproject() + pkgconfig.generate( + libraries: [libsysprof_capture], + subdirs: [ sysprof_header_subdir ], + version: meson.project_version(), + name: 'sysprof-capture-@0@'.format(libsysprof_api_version), + filebase: 'sysprof-capture-@0@'.format(libsysprof_api_version), + description: 'The static capture library for tools that generate profiling capture data', + install_dir: join_paths(get_option('libdir'), 'pkgconfig'), + variables: [ + 'datadir=' + datadir_for_pc_file, + ], + ) +endif