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

This requires changing them from being generated sources at compile time
to custom targets, but it also ensures that they are actually there when
needed, in fact currently we may instead try to compile files that requires
them without having been generated yet.

See: https://gitlab.gnome.org/GNOME/glib/-/jobs/2346914 (glib)
See: https://gitlab.gnome.org/GNOME/glib/-/jobs/2344802 (gmodule)
See: https://gitlab.gnome.org/GNOME/glib/-/jobs/2345205 (gobject)
This commit is contained in:
Marco Trevisan (Treviño) 2022-10-20 00:27:53 +02:00
parent 7e5c5932fc
commit 341895a19e
4 changed files with 38 additions and 17 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

@ -1,19 +1,30 @@
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)
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 +242,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 +252,7 @@ deprecated_sources = files(
'deprecated/gthread-deprecated.c'
)
glib_sources = files(
glib_sources += files(
'garcbox.c',
'garray.c',
'gasyncqueue.c',
@ -416,6 +425,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',