From 3aec06bbc51b8563f0ed43cddb5f29cfbf660729 Mon Sep 17 00:00:00 2001 From: Bruce Cowan <bruce.cowan@strath.ac.uk> Date: Sat, 4 Jan 2020 14:21:54 +0000 Subject: [PATCH] Some build system tidying --- data/meson.build | 3 --- meson.build | 28 +++++++++++++++++++--------- meson_options.txt | 9 ++++----- src/main.c | 2 +- src/meson.build | 37 ++++++------------------------------- 5 files changed, 30 insertions(+), 49 deletions(-) diff --git a/data/meson.build b/data/meson.build index 74217a0..70a7b08 100644 --- a/data/meson.build +++ b/data/meson.build @@ -1,8 +1,5 @@ # SPDX-FileCopyrightText: 2016, 2018 Bruce Cowan <bruce@bcowan.me.uk> # SPDX-License-Identifier: CC0-1.0 - -gnome = import('gnome') - resources = gnome.compile_resources('gen-resources', 'rugby.gresource.xml', source_dir: 'data') diff --git a/meson.build b/meson.build index 87b3dfb..d199a66 100644 --- a/meson.build +++ b/meson.build @@ -1,16 +1,26 @@ -# SPDX-FileCopyrightText: 2016-2019 Bruce Cowan <bruce@bcowan.me.uk> +# SPDX-FileCopyrightText: 2016-2020 Bruce Cowan <bruce@bcowan.me.uk> # SPDX-License-Identifier: CC0-1.0 +project('rugby', 'c', + license:'GPL') -project('rugby', 'c', license:'GPL', meson_version: '>=0.45.0') +gnome = import('gnome') -add_project_arguments('-Wdeprecated-declarations', language: 'c') -add_project_arguments('-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_46', language: 'c') -add_project_arguments('-DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_46', language: 'c') -add_project_arguments('-DGDK_VERSION_MIN_REQUIRED=GDK_VERSION_3_16', language: 'c') -add_project_arguments('-DGDK_VERSION_MAX_ALLOWED=GDK_VERSION_3_16', language: 'c') +gio_dep = dependency('gio-2.0', version: '>= 2.46') +gtk_dep = dependency('gtk+-3.0', version: '>= 3.16') -gio_dep = dependency('gio-2.0', version: '>=2.46') -gtk_dep = dependency('gtk+-3.0', version: '>=3.16') +conf = configuration_data() +conf.set('TRY_POINTS', get_option('try_points')) +conf.set('UTRY_POINTS', get_option('utry_points')) +conf.set('KICK_POINTS', get_option('kick_points')) + +git = find_program('git', required: false) +if git.found() + VERSION = run_command('git', 'describe', '--always').stdout().strip() +else + VERSION = 'unknown' +endif + +conf.set_quoted('VERSION', VERSION) subdir('data') subdir('src') diff --git a/meson_options.txt b/meson_options.txt index b262aa4..368fd1a 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,6 +1,5 @@ -# SPDX-FileCopyrightText: 2018, 2019 Bruce Cowan <bruce@bcowan.me.uk> +# SPDX-FileCopyrightText: 2018-2020 Bruce Cowan <bruce@bcowan.me.uk> # SPDX-License-Identifier: CC0-1.0 - -option('try_points', type: 'string', value: '7') -option('utry_points', type: 'string', value: '5') -option('kick_points', type: 'string', value: '3') +option('try_points', type: 'integer', value: 7) +option('utry_points', type: 'integer', value: 5) +option('kick_points', type: 'integer', value: 3) diff --git a/src/main.c b/src/main.c index a71a53f..a783419 100644 --- a/src/main.c +++ b/src/main.c @@ -33,7 +33,7 @@ about_activated (GSimpleAction *simple, "license-type", GTK_LICENSE_GPL_3_0, "authors", authors, "comments", "Rugby scores possiblities program", - "version", PACKAGE_VERSION, + "version", VERSION, NULL); } diff --git a/src/meson.build b/src/meson.build index 6a3b7bc..7d11fb6 100644 --- a/src/meson.build +++ b/src/meson.build @@ -1,42 +1,17 @@ # SPDX-FileCopyrightText: 2016-2020 Bruce Cowan <bruce@bcowan.me.uk> # SPDX-License-Identifier: CC0-1.0 - -gnome = import('gnome') - -conf = configuration_data() -conf.set('TRY_POINTS', get_option('try_points')) -conf.set('UTRY_POINTS', get_option('utry_points')) -conf.set('KICK_POINTS', get_option('kick_points')) - -VCS_TAG = '' -COPYRIGHT_YEAR = '?' - -git = find_program('git', required: false) -if git.found() - VCS_TAG = run_command('git', 'describe', '--always').stdout().strip() -else - VCS_TAG = 'unknown' -endif - -conf.set_quoted('PACKAGE_VERSION', VCS_TAG) -conf.set_quoted('COPYRIGHT_YEAR', COPYRIGHT_YEAR) - -config_h = configure_file(configuration: conf, output: 'config.h') - -sources = files( +sources = [ 'main.c', 'rugby-app-window.c', 'rugby-list-store.c', 'rugby-possibility.c', 'rugby-possibility-widget.c' -) +] -sources += config_h -sources += resources - -deps = [gio_dep, gtk_dep] +config_h = configure_file(configuration: conf, output: 'config.h') executable('rugby', - sources, - dependencies: deps, + sources, resources, config_h, + dependencies: [gio_dep, gtk_dep], + install_dir: get_option('bindir'), install: true) -- GitLab