Make it build

Fix the circular dependency by moving the generated
headers to gdk/version/, and build that directory
first.

Misc other fixes, such as putting the custom targets
as sources, not depedencies, and using the correct
major version in the generator script.
This commit is contained in:
Matthias Clasen 2023-05-08 15:43:08 -04:00 committed by Emmanuele Bassi
parent 4d1f7a476d
commit 5ae25519a7
7 changed files with 27 additions and 28 deletions

View File

@ -135,7 +135,7 @@ def gen_visibility_macros(args, current_major_version, current_minor_version, cu
f.write(
textwrap.dedent(
f"""
#if GDK_VERSION_MIN_REQUIRED >= GDK_VERSION_2_{minor}
#if GDK_VERSION_MIN_REQUIRED >= GDK_VERSION_4_{minor}
#define {ns}_DEPRECATED_IN_{current_major_version}_{minor} {ns}_DEPRECATED
#define {ns}_DEPRECATED_IN_{current_major_version}_{minor}_FOR(f) {ns}_DEPRECATED_FOR (f)
#define {ns}_DEPRECATED_MACRO_IN_{current_major_version}_{minor} GDK_DEPRECATED_MACRO

View File

@ -44,9 +44,6 @@
#include <gdk/gdkconfig.h>
#include <gdk/gdkversionmacros.h>
/* Visibility macros; must be included after the two headers above */
#include <gdk/gdk-visibility.h>
G_BEGIN_DECLS
/**

View File

@ -110,6 +110,7 @@ gdk_public_headers = files([
'gdktoplevelsize.h',
'gdktoplevel.h',
'gdkdragsurface.h',
'gdkversionmacros.h'
])
install_headers(gdk_public_headers, subdir: 'gtk-4.0/gdk/')
@ -146,7 +147,7 @@ gdk_enums = gnome.mkenums_simple('gdkenumtypes',
sources: gdk_public_headers,
decorator: 'GDK_AVAILABLE_IN_ALL',
body_prefix: '#include "config.h"',
header_prefix: '#include "gdkversionmacros.h"\n#include "gdk-visibility.h"',
header_prefix: '#include "version/gdkversionmacros.h"\n#include "version/gdk-visibility.h"',
install_dir: gtk_includedir / 'gtk-4.0/gdk',
install_header: true,
)
@ -183,25 +184,6 @@ gdkversion_cdata.set('GTK_MAJOR_VERSION', gtk_major_version)
gdkversion_cdata.set('GTK_MINOR_VERSION', gtk_minor_version)
gdkversion_cdata.set('GTK_MICRO_VERSION', gtk_micro_version)
gdkversionmacros_h = custom_target(
input: 'gdkversionmacros.h.in',
output: 'gdkversionmacros.h',
command: [gen_visibility_macros, meson.project_version(), 'versions-macros', '@INPUT@', '@OUTPUT@'],
install: true,
install_dir: gtk_includedir / 'gtk-4.0/gdk',
# FIXME: Not needed with Meson >= 0.64.0
install_tag: 'devel',
)
gdk_visibility_h = custom_target(
output: 'gdk-visibility.h',
command: [gen_visibility_macros, meson.project_version(), 'visibility-macros', 'GDK', '@OUTPUT@'],
install: true,
install_dir: gtk_includedir / 'gtk-4.0/gdk',
# FIXME: Not needed with Meson >= 0.64.0
install_tag: 'devel',
)
gdkinc = include_directories('.')
gdkx11_inc = include_directories('x11')
gdkwayland_inc = include_directories('wayland')

21
gdk/version/meson.build Normal file
View File

@ -0,0 +1,21 @@
gdkversionmacros_h = custom_target(
input: 'gdkversionmacros.h.in',
output: 'gdkversionmacros.h',
command: [gen_visibility_macros, meson.project_version(), 'versions-macros', '@INPUT@', '@OUTPUT@'],
install: true,
install_dir: gtk_includedir / 'gtk-4.0/gdk',
# FIXME: Not needed with Meson >= 0.64.0
install_tag: 'devel',
)
gdk_visibility_h = custom_target(
output: 'gdk-visibility.h',
command: [gen_visibility_macros, meson.project_version(), 'visibility-macros', 'GDK', '@OUTPUT@'],
install: true,
install_dir: gtk_includedir / 'gtk-4.0/gdk',
# FIXME: Not needed with Meson >= 0.64.0
install_tag: 'devel',
)

View File

@ -24,8 +24,6 @@ gtk_css_deps = [
glib_dep,
gobject_dep,
platform_gio_dep,
gdkversionmacros_h,
gdk_visibility_h,
]
gtk_css_enums = gnome.mkenums('gtkcssenumtypes',
@ -43,6 +41,8 @@ libgtk_css = static_library('gtk_css',
gtk_css_public_sources,
gtk_css_private_sources,
gtk_css_enums,
gdkversionmacros_h,
gdk_visibility_h,
],
dependencies: gtk_css_deps,
include_directories: [ confinc, ],

View File

@ -344,12 +344,10 @@ common_cflags = cc.get_supported_arguments(test_cflags)
if get_option('default_library') != 'static'
if os_win32
cdata.set('DLL_EXPORT', true)
cdata.set('_GDK_EXTERN', '__declspec(dllexport) extern')
if cc.get_id() != 'msvc'
common_cflags += ['-fvisibility=hidden']
endif
else
cdata.set('_GDK_EXTERN', '__attribute__((visibility("default"))) extern')
common_cflags += ['-fvisibility=hidden']
endif
endif
@ -749,6 +747,7 @@ project_build_root = meson.current_build_dir()
gen_visibility_macros = find_program('build-aux/meson/gen-visibility-macros.py')
subdir('gdk/version')
subdir('gtk/css')
subdir('gdk')
subdir('gsk')