Merge branch 'wip/add-built-headers-deps' into 'main'

glib, gmodule, gobject: Add generated headers to the lib dependency

See merge request GNOME/glib!2991
This commit is contained in:
Xavier Claessens 2022-10-24 13:51:30 +00:00
commit 8fe2e4d364
5 changed files with 56 additions and 18 deletions

View File

@ -743,12 +743,15 @@ gio_headers = files(
'gliststore.h',
)
gvisibility_h = configure_file(
gvisibility_h = custom_target(
output: 'gio-visibility.h',
command: [gen_visibility_macros, meson.project_version(), 'visibility-macros', 'GIO', '@OUTPUT@'],
install: true,
install_dir: glib_includedir / 'gio',
install_tag : 'devel',
)
gio_sources += gvisibility_h
gio_headers += gvisibility_h
gio_headers += application_headers
gio_headers += settings_headers
gio_headers += gdbus_headers
@ -857,6 +860,7 @@ schemas_subdir = join_paths('glib-2.0', 'schemas')
libgio_dep = declare_dependency(link_with : libgio,
dependencies : [libgmodule_dep, libgobject_dep, gioenumtypes_dep],
sources: gvisibility_h,
include_directories : [gioinc],
variables : [
'schemasdir=' + join_paths(glib_datadir, schemas_subdir),

View File

@ -362,6 +362,12 @@ endif
gnulib_sources += other_needed_math_sources
# g-gnulib.h includes glib.h that requires some headers to be generated
gnulib_sources += [
'g-gnulib.h',
glib_built_headers,
]
gnulib_lib = static_library('gnulib', gnulib_sources,
dependencies : [libm],
include_directories : [configinc, glibinc, include_directories ('.')],

View File

@ -1,19 +1,31 @@
glib_sources = []
glibconfig_h = configure_file(input : 'glibconfig.h.in', output : 'glibconfig.h',
install_dir : join_paths(get_option('libdir'), 'glib-2.0/include'),
install_tag : 'devel',
configuration : glibconfig_conf)
glib_sources += glibconfig_h
gversionmacros_h = configure_file(
gversionmacros_h = custom_target(
input: 'gversionmacros.h.in',
output: 'gversionmacros.h',
command: [gen_visibility_macros, meson.project_version(), 'versions-macros', '@INPUT@', '@OUTPUT@'],
install: true,
install_dir: glib_includedir,
install_tag : 'devel',
)
gvisibility_h = configure_file(
gvisibility_h = custom_target(
output: 'glib-visibility.h',
command: [gen_visibility_macros, meson.project_version(), 'visibility-macros', 'GLIB', '@OUTPUT@'],
install: true,
install_dir: glib_includedir / 'glib',
install_tag : 'devel',
)
glib_built_headers = [gversionmacros_h, gvisibility_h]
glib_sources += glib_built_headers
glib_c_args_internal = [
'-DGLIB_COMPILATION',
]
@ -231,8 +243,6 @@ glib_sub_headers = files(
'gprintf.h',
)
glib_sub_headers += [gversionmacros_h, gvisibility_h]
install_headers(glib_sub_headers, subdir : 'glib-2.0/glib')
deprecated_sources = files(
@ -243,7 +253,7 @@ deprecated_sources = files(
'deprecated/gthread-deprecated.c'
)
glib_sources = files(
glib_sources += files(
'garcbox.c',
'garray.c',
'gasyncqueue.c',
@ -397,7 +407,17 @@ libglib = library('glib-2.0',
link_args : [noseh_link_args, glib_link_flags, win32_ldflags],
include_directories : configinc,
link_with: [charset_lib, gnulib_lib],
dependencies : [pcre2, thread_dep, librt] + libintl_deps + libiconv + platform_deps + [gnulib_libm_dependency, libm] + [libsysprof_capture_dep],
dependencies : [
gnulib_libm_dependency,
libiconv,
libintl_deps,
libm,
librt,
libsysprof_capture_dep,
pcre2,
platform_deps,
thread_dep,
],
c_args : glib_c_args,
objc_args : glib_c_args,
gnu_symbol_visibility : 'hidden',
@ -406,6 +426,7 @@ libglib = library('glib-2.0',
libglib_dep = declare_dependency(
link_with : libglib,
dependencies : libintl_deps,
sources : glib_built_headers,
# We sadly need to export configinc here because everyone includes <glib/*.h>
include_directories : [configinc, glibinc])

View File

@ -66,13 +66,15 @@ gmodule_c = files('gmodule.c')
install_headers([gmodule_h], subdir : 'glib-2.0')
gvisibility_h = configure_file(
gvisibility_h = custom_target(
output: 'gmodule-visibility.h',
command: [gen_visibility_macros, meson.project_version(), 'visibility-macros', 'GMODULE', '@OUTPUT@'],
install: true,
install_dir: glib_includedir / 'gmodule',
install_tag : 'devel',
)
install_headers(gvisibility_h, subdir : 'glib-2.0/gmodule')
gmodule_sources = [gmodule_c]
gmodule_sources = [gmodule_c, gvisibility_h]
if host_system == 'windows'
gmodule_win_rc = configure_file(
input: 'gmodule.rc.in',
@ -131,6 +133,7 @@ pkg.generate(libraries : [libgmodule, export_dynamic_ldflags],
libgmodule_dep = declare_dependency(link_with : libgmodule,
include_directories : [gmoduleinc],
sources : [gvisibility_h],
dependencies : [libglib_dep])
meson.override_dependency('gmodule-no-export-2.0', libgmodule_dep)

View File

@ -23,16 +23,20 @@ gobject_install_headers = files(
'gobjectnotifyqueue.c', # sic
)
gvisibility_h = configure_file(
gobject_sources = []
gvisibility_h = custom_target(
output: 'gobject-visibility.h',
command: [gen_visibility_macros, meson.project_version(), 'visibility-macros', 'GOBJECT', '@OUTPUT@'],
install: true,
install_dir: glib_includedir / 'gobject',
install_tag : 'devel',
)
gobject_install_headers += gvisibility_h
gobject_sources += gvisibility_h
install_headers(gobject_install_headers, subdir : 'glib-2.0/gobject')
gobject_sources = files(
gobject_sources += files(
'gatomicarray.c',
'gbinding.c',
'gbindinggroup.c',
@ -128,8 +132,6 @@ glib_enumtypes_c = custom_target('glib_enumtypes_c',
'--template', files('glib-enumtypes.c.template'),
'@INPUT@'])
glib_enumtypes_dep = declare_dependency(sources : [glib_enumtypes_h])
# Expose as variable to be used by gobject-introspection
# when it includes GLib as a subproject
glib_types_h = files('glib-types.h')
@ -159,7 +161,9 @@ pkg.generate(libgobject,
libgobject_dep = declare_dependency(link_with : libgobject,
include_directories : [gobjectinc],
dependencies : [libglib_dep, glib_enumtypes_dep])
sources : [gvisibility_h, glib_enumtypes_h],
dependencies : [libglib_dep],
)
meson.override_dependency('gobject-2.0', libgobject_dep)
executable('gobject-query', 'gobject-query.c',