From 535186fd84d0fba3710cb33a4983efbbc074fcca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Mon, 3 Dec 2018 20:51:06 +0100 Subject: [PATCH] meson: provide a harfbuzz-config for use from CMake See #822 and #1437. --- meson.build | 16 ++++++++++++++++ src/meson.build | 14 +++++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/meson.build b/meson.build index 0b3f4e01d..f27d0ce2f 100644 --- a/meson.build +++ b/meson.build @@ -2,6 +2,22 @@ project('harfbuzz', 'c', 'cpp', meson_version: '>= 0.47.0', version: '2.2.0') +hb_version_arr = meson.project_version().split('.') +hb_version_major = hb_version_arr[0].to_int() +hb_version_minor = hb_version_arr[1].to_int() +hb_version_micro = hb_version_arr[2].to_int() + +# libtool versioning +hb_version_int = hb_version_major*10000 + hb_version_minor*100 + hb_version_micro +if hb_version_minor % 2 == 1 + hb_libtool_revision = 0 # for unstable releases +else + hb_libtool_revision = hb_version_micro # for stable releases +endif +hb_libtool_age = hb_version_int - hb_libtool_revision +hb_libtool_current = hb_libtool_age +hb_libtool_version_info = '@0@:@1@:@2@'.format(hb_libtool_current, hb_libtool_revision, hb_libtool_age) + pkgmod = import('pkgconfig') cpp = meson.get_compiler('cpp') diff --git a/src/meson.build b/src/meson.build index 8c7d21e25..94c7d0442 100644 --- a/src/meson.build +++ b/src/meson.build @@ -254,7 +254,19 @@ pkgmod.generate(libharfbuzz_subset, version: meson.project_version(), ) -if conf.get('HAVE_GOBJECT', 0) == 1 +have_gobject = conf.get('HAVE_GOBJECT', 0) == 1 + +cmake_config = configuration_data() +cmake_config.set('libdir', '${prefix}/@0@'.format(get_option('libdir'))) +cmake_config.set('includedir', '${prefix}/@0@'.format(get_option('includedir'))) +cmake_config.set('HB_LIBTOOL_VERSION_INFO', hb_libtool_version_info) +cmake_config.set('have_gobject', have_gobject ? 'true' : 'false') +configure_file(input: 'harfbuzz-config.cmake.in', + output: 'harfbuzz-config.cmake', + configuration: cmake_config, + install_dir: join_paths(get_option('libdir'), 'cmake', 'harfbuzz')) + +if have_gobject gnome = import('gnome') h_templ = configure_file(