mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-14 05:16:18 +01:00
dcfc9f689e
There is currently no `dllimport` attribute on any of our function, which prevents MSVC to optimize function calls. To fix that issue, we need to redeclare all our visibility macros for each of our libraries, because when compiling e.g. GIO code, we need dllimport in GLIB headers and dllexport in GIO headers. That means they cannot use the same GLIB_AVAILABLE_* macro. Since that's a lot of boilerplate to copy/paste after each version bump, this MR generate all those macros using a python script. Also simplify the meson side by using `gnu_symbol_visibility : 'hidden'` keyword argument instead of passing the cflag manually. This leaves only API index to add manually into glib-docs.xml when bumping GLib version. That file cannot be generated because Meson does not allow passing a buit file to gnome.gtkdoc()'s main_xml kwarg unfortunately.
59 lines
1.9 KiB
Meson
59 lines
1.9 KiB
Meson
# The list of minor versions in the 2.x.x series which have had
|
|
# GLIB_AVAILABLE_IN_* macros. This should include the current unreleased stable
|
|
# version.
|
|
first_version = 26
|
|
last_version = minor_version.is_odd() ? minor_version + 1 : minor_version
|
|
|
|
ignore_decorators = [
|
|
'GLIB_VAR',
|
|
'G_GNUC_INTERNAL',
|
|
'G_GNUC_WARN_UNUSED_RESULT',
|
|
'GLIB_AVAILABLE_IN_ALL',
|
|
]
|
|
|
|
foreach i : range(first_version, last_version + 2, 2)
|
|
version = i.to_string()
|
|
ignore_decorators += [
|
|
# Note that gtkdoc is going to use those in regex, and the longest match
|
|
# must come first. That's why '_FOR()' variant comes first.
|
|
# gtkdoc special-case '()' and replace it by a regex matching a symbol name.
|
|
'GLIB_AVAILABLE_IN_2_' + version,
|
|
'GLIB_DEPRECATED_IN_2_' + version + '_FOR()',
|
|
'GLIB_DEPRECATED_IN_2_' + version,
|
|
|
|
'GLIB_AVAILABLE_STATIC_INLINE_IN_2_' + version,
|
|
|
|
'GLIB_AVAILABLE_ENUMERATOR_IN_2_' + version,
|
|
'GLIB_DEPRECATED_ENUMERATOR_IN_2_' + version + '_FOR()',
|
|
'GLIB_DEPRECATED_ENUMERATOR_IN_2_' + version,
|
|
|
|
'GLIB_AVAILABLE_MACRO_IN_2_' + version,
|
|
'GLIB_DEPRECATED_MACRO_IN_2_' + version + '_FOR()',
|
|
'GLIB_DEPRECATED_MACRO_IN_2_' + version,
|
|
|
|
'GLIB_AVAILABLE_TYPE_IN_2_' + version,
|
|
'GLIB_DEPRECATED_TYPE_IN_2_' + version + '_FOR()',
|
|
'GLIB_DEPRECATED_TYPE_IN_2_' + version,
|
|
]
|
|
endforeach
|
|
|
|
ignore_decorators = '|'.join(ignore_decorators)
|
|
|
|
if get_option('gtk_doc')
|
|
# Check we have the minimum gtk-doc version required. Older versions won't
|
|
# generate correct documentation.
|
|
dependency('gtk-doc', version : '>=1.32.1',
|
|
fallback : ['gtk-doc', 'dummy_dep'],
|
|
default_options : ['tests=false'])
|
|
endif
|
|
|
|
# We cannot built the API reference off of a static library,
|
|
# as symbols might get dropped by the linker
|
|
if get_option('gtk_doc') and get_option('default_library') == 'static'
|
|
error('The API reference can only be built against a shared library')
|
|
endif
|
|
|
|
subdir('gio')
|
|
subdir('glib')
|
|
subdir('gobject')
|