[gnome-tour/bilelmoussaoui/fixes] build: Drop the custom cargo.py script
- From: Bilal Elmoussaoui <bilelmoussaoui src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-tour/bilelmoussaoui/fixes] build: Drop the custom cargo.py script
- Date: Wed, 26 Jan 2022 19:10:41 +0000 (UTC)
commit a849b33de279ed7784119ae94cc1735bcabab5c0
Author: Bilal Elmoussaoui <belmouss redhat com>
Date: Wed Jan 26 20:10:25 2022 +0100
build: Drop the custom cargo.py script
build-aux/cargo.py | 52 ----------------------------------------------------
meson.build | 3 +--
src/meson.build | 45 +++++++++++++++++++++------------------------
3 files changed, 22 insertions(+), 78 deletions(-)
---
diff --git a/meson.build b/meson.build
index 439cba8..04e4435 100644
--- a/meson.build
+++ b/meson.build
@@ -18,8 +18,7 @@ dependency('libadwaita-1', version: '>= 1')
glib_compile_resources = find_program('glib-compile-resources', required: true)
desktop_file_validate = find_program('desktop-file-validate', required: false)
appstream_util = find_program('appstream-util', required: false)
-cargo = find_program('cargo', required: false)
-cargo_script = find_program('build-aux/cargo.py')
+cargo = find_program('cargo')
version = meson.project_version()
diff --git a/src/meson.build b/src/meson.build
index 633bea1..7a5224c 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -18,40 +18,37 @@ run_command(
check: true
)
-sources = files(
- 'widgets/pages/image.rs',
- 'widgets/pages/mod.rs',
- 'widgets/pages/welcome.rs',
- 'widgets/mod.rs',
- 'widgets/paginator.rs',
- 'widgets/window.rs',
- 'application.rs',
- 'config.rs',
- 'main.rs',
- 'utils.rs',
-)
-features = ''
-if get_option('video_path') != ''
- features = '--features video'
+cargo_options = [ '--manifest-path', meson.project_source_root() / 'Cargo.toml' ]
+cargo_options += [ '--target-dir', meson.project_build_root() / 'src' ]
+
+if get_option('profile') == 'default'
+ cargo_options += [ '--release' ]
+ rust_target = 'release'
+ message('Building in release mode')
+else
+ rust_target = 'debug'
+ message('Building in debug mode')
endif
-custom_target(
+cargo_env = [ 'CARGO_HOME=' + meson.project_build_root() / 'cargo-home' ]
+
+cargo_build = custom_target(
'cargo-build',
build_by_default: true,
- input: sources,
+ build_always_stale: true,
output: meson.project_name(),
console: true,
install: true,
install_dir: bindir,
depends: resources,
command: [
- cargo_script,
- meson.project_build_root(),
- meson.project_source_root(),
- '@OUTPUT@',
- profile,
- meson.project_name(),
- features,
+ 'env',
+ cargo_env,
+ cargo, 'build',
+ cargo_options,
+ '&&',
+ 'cp', 'src' / rust_target / meson.project_name(), '@OUTPUT@',
]
)
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]