meson: Don't mangle profile and app id suffix

This commit is contained in:
Sophie Herold 2024-09-27 21:22:52 +02:00
parent bf9392e8a2
commit f6b7ae7567
8 changed files with 28 additions and 27 deletions

View file

@ -16,7 +16,6 @@
// SPDX-License-Identifier: GPL-3.0-or-later
pub const APP_ID: &str = default_env(option_env!("APP_ID"), "org.gnome.Loupe.Devel");
pub const PROFILE: &str = default_env(option_env!("PROFILE"), ".Devel");
pub const VERSION: &str = default_env(option_env!("VERSION"), "unknown");
pub const LOCALEDIR: &str = default_env(option_env!("LOCALEDIR"), "/usr/share/locale/");

View file

@ -3,28 +3,26 @@ source_root = meson.project_source_root()
cargo_options = ['--manifest-path', source_root / 'Cargo.toml']
cargo_options += ['--target-dir', build_root / 'src']
if get_option('profile') == 'development'
rust_target = 'debug'
message('Building in debug mode')
else
cargo_options += ['--release']
rust_target = 'release'
message('Building in release mode')
endif
cargo_options += ['--profile', profile]
if gtk4_x11.found()
cargo_options += ['--features', 'x11']
endif
if profile == 'dev'
rust_target = 'debug'
elif profile == 'release'
rust_target = 'release'
endif
cargo_env = {
'CARGO_HOME': build_root / 'cargo-home',
'APP_ID': app_id,
'PROFILE': profile,
'VERSION': version,
'LOCALEDIR': localedir,
}
# Build binary
cargo_build = custom_target(
'cargo-build',
build_by_default: true,
@ -39,6 +37,7 @@ cargo_build = custom_target(
],
)
# Copy binary
custom_target(
'cp-binary',
depends: cargo_build,
@ -67,6 +66,7 @@ custom_target(
],
)
# Run tests
test(
'cargo-test',
cargo,

View file

@ -205,7 +205,7 @@ mod imp {
}
));
if config::PROFILE == ".Devel" {
if config::APP_ID.ends_with(".Devel") {
obj.add_css_class("devel");
}