[meson] Fix build with -Dgobject=disabled

This commit is contained in:
Khaled Hosny 2023-01-23 13:43:35 +02:00 committed by خالد حسني (Khaled Hosny)
parent 2b87af808b
commit 1cf61f3053
2 changed files with 9 additions and 7 deletions

View File

@ -758,6 +758,8 @@ configure_file(input: 'harfbuzz-config.cmake.in',
install_dir: get_option('libdir') / 'cmake' / 'harfbuzz', install_dir: get_option('libdir') / 'cmake' / 'harfbuzz',
) )
gobject_enums_c = []
gobject_enums_h = []
libharfbuzz_gobject_dep = null_dep libharfbuzz_gobject_dep = null_dep
if have_gobject if have_gobject
gnome = import('gnome') gnome = import('gnome')
@ -780,13 +782,13 @@ if have_gobject
symbol_prefix: 'hb_gobject', symbol_prefix: 'hb_gobject',
) )
enum_c = custom_target('hb-gobject-enums.cc', gobject_enums_c = custom_target('hb-gobject-enums.cc',
input: enums[0], input: enums[0],
output: 'hb-gobject-enums.cc', output: 'hb-gobject-enums.cc',
command: [find_program('fix_get_types.py'), '@INPUT@', '@OUTPUT@'] command: [find_program('fix_get_types.py'), '@INPUT@', '@OUTPUT@']
) )
enum_h = custom_target('hb-gobject-enums.h', gobject_enums_h = custom_target('hb-gobject-enums.h',
input: enums[1], input: enums[1],
output: 'hb-gobject-enums.h', output: 'hb-gobject-enums.h',
command: [find_program('fix_get_types.py'), '@INPUT@', '@OUTPUT@'], command: [find_program('fix_get_types.py'), '@INPUT@', '@OUTPUT@'],
@ -794,15 +796,15 @@ if have_gobject
install_dir: get_option('prefix') / get_option('includedir') / meson.project_name(), install_dir: get_option('prefix') / get_option('includedir') / meson.project_name(),
) )
hb_gobject_sources += [enum_c] hb_gobject_sources += [gobject_enums_c]
harfbuzz_gobject_def = custom_target('harfbuzz-gobject.def', harfbuzz_gobject_def = custom_target('harfbuzz-gobject.def',
command: [gen_def, '@OUTPUT@', '@INPUT@'], command: [gen_def, '@OUTPUT@', '@INPUT@'],
input: [hb_gobject_headers, enum_h], input: [hb_gobject_headers, gobject_enums_h],
output: 'harfbuzz-gobject.def') output: 'harfbuzz-gobject.def')
defs_list += [harfbuzz_gobject_def] defs_list += [harfbuzz_gobject_def]
libharfbuzz_gobject = library('harfbuzz-gobject', [hb_gobject_sources, enum_c, enum_h], libharfbuzz_gobject = library('harfbuzz-gobject', [hb_gobject_sources, gobject_enums_c, gobject_enums_h],
include_directories: incconfig, include_directories: incconfig,
dependencies: [glib_dep, gobject_dep], dependencies: [glib_dep, gobject_dep],
link_with: [libharfbuzz], link_with: [libharfbuzz],
@ -825,7 +827,7 @@ if have_gobject
if build_gir if build_gir
conf.set('HAVE_INTROSPECTION', 1) conf.set('HAVE_INTROSPECTION', 1)
hb_gen_files_gir = gnome.generate_gir(libharfbuzz_gobject, hb_gen_files_gir = gnome.generate_gir(libharfbuzz_gobject,
sources: [gir_headers, gir_sources, enum_h], sources: [gir_headers, gir_sources, gobject_enums_h],
dependencies: libharfbuzz_dep, dependencies: libharfbuzz_dep,
namespace: 'HarfBuzz', namespace: 'HarfBuzz',
nsversion: '0.0', nsversion: '0.0',

View File

@ -41,7 +41,7 @@ if conf.get('HAVE_GLIB', 0) == 1
) )
meson.override_find_program('hb-shape', hb_shape) meson.override_find_program('hb-shape', hb_shape)
hb_info = executable('hb-info', [hb_info_sources, enum_h], hb_info = executable('hb-info', [hb_info_sources, gobject_enums_h],
cpp_args: cpp_args, cpp_args: cpp_args,
include_directories: [incconfig, incsrc], include_directories: [incconfig, incsrc],
dependencies: [util_deps, libharfbuzz_gobject_dep], dependencies: [util_deps, libharfbuzz_gobject_dep],