[libgweather/ebassi/gtk4: 2/10] build: Consolidate library definitions
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgweather/ebassi/gtk4: 2/10] build: Consolidate library definitions
- Date: Sun, 10 Oct 2021 16:50:24 +0000 (UTC)
commit db52e389de011ecacb865d9848059b42ba776952
Author: Emmanuele Bassi <ebassi gnome org>
Date: Thu Oct 7 20:58:32 2021 +0100
build: Consolidate library definitions
Instead of having a bunch of definitions and file generators in the
top-level meson.build, let's move everything needed by the library into
the libgweather/meson.build file.
libgweather/meson.build | 91 +++++++++++++++++++++++++++++++++++++++++--------
meson.build | 56 +-----------------------------
2 files changed, 77 insertions(+), 70 deletions(-)
---
diff --git a/libgweather/meson.build b/libgweather/meson.build
index c941a911..f6504432 100644
--- a/libgweather/meson.build
+++ b/libgweather/meson.build
@@ -5,16 +5,60 @@ add_project_arguments([
'-D_DEFAULT_SOURCE',
], language: 'c')
+c_compiler = meson.get_compiler('c')
+
header_subdir = 'libgweather-3.0/libgweather'
libgweather_map = meson.current_source_dir() / 'libgweather.map'
link_depends = []
link_args = []
+# convert to soname
+current = libgweather_lt_c - libgweather_lt_a
+interface_age = libgweather_lt_r
+libgweather_so_version = '@0@.@1@.@2@'.format(
+ current,
+ libgweather_lt_a,
+ interface_age,
+)
+
+libgweather_darwin_versions = [
+ current + 1,
+ '@0@.@1@'.format(current + 1, interface_age),
+]
+
if c_compiler.has_link_argument('-Wl,--version-script,' + libgweather_map)
link_depends += libgweather_map
link_args += ['-Wl,--version-script,' + libgweather_map]
endif
+config_h = configuration_data()
+config_h.set_quoted('GETTEXT_PACKAGE', GETTEXT_PACKAGE)
+config_h.set_quoted('LOCALEDIR', datadir / 'locale')
+config_h.set_quoted('GNOMELOCALEDIR', datadir / 'locale')
+config_h.set_quoted('G_LOG_DOMAIN', 'GWeather')
+config_h.set_quoted('GWEATHER_BIN_LOCATION_DIR', pkglibdir)
+config_h.set_quoted('LIBGWEATHER_VERSION', meson.project_version())
+
+if c_compiler.has_member('struct tm', 'tm_gmtoff', prefix: '#include <time.h>')
+ config_h.set('HAVE_TM_TM_GMOFF', 1)
+endif
+
+if c_compiler.has_header_symbol('time.h', 'timezone')
+ config_h.set('HAVE_TIMEZONE', 1)
+endif
+
+if c_compiler.has_header_symbol('langinfo.h', '_NL_MEASUREMENT_MEASUREMENT')
+ config_h.set('HAVE__NL_MEASUREMENT_MEASUREMENT', 1)
+endif
+
+config_h.set_quoted('ZONEINFO_DIR', get_option('zoneinfo_dir'))
+config_h.set_quoted('OWM_APIKEY', get_option('owm_apikey'))
+
+configure_file(
+ output: 'config.h',
+ configuration: config_h,
+)
+
versionconf = configuration_data()
versionconf.set('GWEATHER_MAJOR_VERSION', libgweather_version[0])
versionconf.set('GWEATHER_MINOR_VERSION', libgweather_version[1])
@@ -28,8 +72,17 @@ configure_file(
install_dir: includedir / header_subdir,
)
-gweather_new_headers = [
- 'gweather.h',
+deps_libgweather = [
+ dependency('gio-2.0', version: glib_req_version),
+ dependency('gtk+-3.0', version: gtk_req_version),
+ dependency('libsoup-2.4', version: libsoup_req_version),
+ dependency('libxml-2.0', version: libxml_req_version),
+ dependency('geocode-glib-1.0'),
+
+ c_compiler.find_library('m', required: false),
+]
+
+gweather_headers = [
'gweather-location.h',
'gweather-location-entry.h',
'gweather-timezone.h',
@@ -39,43 +92,51 @@ gweather_new_headers = [
]
gweather_enum_types = gnome.mkenums('gweather-enum-types',
- sources: gweather_new_headers,
+ sources: gweather_headers,
c_template: 'gweather-enum-types.c.tmpl',
h_template: 'gweather-enum-types.h.tmpl',
install_header: true,
install_dir: includedir / header_subdir,
)
-install_headers(gweather_new_headers,
- subdir: header_subdir)
+install_headers(gweather_headers + ['gweather.h'], subdir: header_subdir)
gweather_c_sources = [
gweather_enum_types,
'gweather.c',
- 'gweather-private.c',
'gweather-weather.c',
+ 'gweather-location.c',
+ 'gweather-timezone.c',
+ 'gweather-location-entry.c',
+ 'gweather-timezone-menu.c',
+]
+
+gweather_priv_sources = [
+ 'gweather-private.c',
'weather-metar.c',
'weather-iwin.c',
'weather-metno.c',
'weather-owm.c',
'weather-sun.c',
'weather-moon.c',
- 'gweather-location.c',
- 'gweather-timezone.c',
- 'gweather-location-entry.c',
- 'gweather-timezone-menu.c',
]
-introspection_sources = gweather_c_sources + gweather_new_headers
+introspection_sources = gweather_c_sources + gweather_headers
lib_libgweather = shared_library('gweather-3',
- gweather_c_sources,
- include_directories: root_inc,
+ sources: [
+ gweather_c_sources,
+ gweather_priv_sources,
+ ],
dependencies: deps_libgweather,
link_depends: link_depends,
link_args: link_args,
version: libgweather_so_version,
darwin_versions: libgweather_darwin_versions,
+ include_directories: [
+ include_directories('.'),
+ include_directories('..'),
+ ],
install: true,
)
@@ -102,7 +163,7 @@ libgweather_dep = declare_dependency(
sources: [gweather_enum_types[1], gweather_gir],
dependencies: deps_libgweather,
link_with: lib_libgweather,
- include_directories: root_inc,
+ include_directories: include_directories('..'),
)
if enable_vala
@@ -145,7 +206,7 @@ test('test_libgweather',
)
executable('test_metar',
- sources: ['test_metar.c', gweather_c_sources],
+ sources: ['test_metar.c', gweather_c_sources, gweather_priv_sources],
c_args: test_cargs,
dependencies: libgweather_dep,
install: false,
diff --git a/meson.build b/meson.build
index 5aac43f2..358b5f39 100644
--- a/meson.build
+++ b/meson.build
@@ -18,14 +18,6 @@ libgweather_lt_c=16
libgweather_lt_r=0
libgweather_lt_a=0
-# convert to soname
-libgweather_so_version = '@0@.@1@.@2@'.format((libgweather_lt_c - libgweather_lt_a),
- libgweather_lt_a, libgweather_lt_r)
-
-current = libgweather_lt_c - libgweather_lt_a
-interface_age = libgweather_lt_r
-libgweather_darwin_versions = [current + 1, '@0@.@1@'.format(current + 1, interface_age)]
-
pkgconfig = import('pkgconfig')
gnome = import('gnome')
i18n = import('i18n')
@@ -47,22 +39,7 @@ gtk_req_version = '>= 3.13.5'
libsoup_req_version = '>= 2.44.0'
libxml_req_version = '>= 2.6.0'
-c_compiler = meson.get_compiler('c')
-
-gtk_dep = dependency('gtk+-3.0', version: gtk_req_version)
-glib_dep = dependency('gio-2.0', version: glib_req_version)
-libsoup_dep = dependency('libsoup-2.4', version: libsoup_req_version)
-libxml_dep = dependency('libxml-2.0', version: libxml_req_version)
-geocode_glib_dep = dependency('geocode-glib-1.0')
-math_dep = c_compiler.find_library('m', required : false)
-deps_libgweather = [
- math_dep,
- gtk_dep,
- glib_dep,
- libsoup_dep,
- libxml_dep,
- geocode_glib_dep,
-]
+GETTEXT_PACKAGE = 'libgweather-3.0'
pylint = find_program('pylint-3', 'pylint3', 'pylint', required: false)
pylint_flags = [
@@ -72,35 +49,6 @@ pylint_flags = [
'-d', 'C0326',
]
-config_h = configuration_data()
-GETTEXT_PACKAGE = 'libgweather-3.0'
-config_h.set_quoted('GETTEXT_PACKAGE', GETTEXT_PACKAGE)
-config_h.set_quoted('LOCALEDIR', join_paths(datadir, 'locale'))
-config_h.set_quoted('GNOMELOCALEDIR', join_paths(datadir, 'locale'))
-config_h.set_quoted('G_LOG_DOMAIN', 'GWeather')
-config_h.set_quoted('GWEATHER_BIN_LOCATION_DIR', pkglibdir)
-config_h.set_quoted('LIBGWEATHER_VERSION', meson.project_version())
-
-if c_compiler.has_member('struct tm', 'tm_gmtoff', prefix: '#include <time.h>')
- config_h.set('HAVE_TM_TM_GMOFF', 1)
-endif
-
-if c_compiler.has_header_symbol('time.h', 'timezone')
- config_h.set('HAVE_TIMEZONE', 1)
-endif
-
-if c_compiler.has_header_symbol('langinfo.h', '_NL_MEASUREMENT_MEASUREMENT')
- config_h.set('HAVE__NL_MEASUREMENT_MEASUREMENT', 1)
-endif
-
-config_h.set_quoted('ZONEINFO_DIR', get_option('zoneinfo_dir'))
-config_h.set_quoted('OWM_APIKEY', get_option('owm_apikey'))
-
-configure_file(
- output: 'config.h',
- configuration: config_h,
-)
-
if get_option('glade_catalog') == 'false'
enable_glade_catalog = false
else
@@ -118,8 +66,6 @@ else
enable_vala = enable_vala != 'false'
endif
-root_inc = include_directories('.')
-
subdir('data')
subdir('libgweather')
subdir('schemas')
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]