Loupe/src/meson.build

82 lines
1.4 KiB
Meson
Raw Normal View History

build_root = meson.project_build_root()
source_root = meson.project_source_root()
2024-07-17 13:28:14 +02:00
cargo_options = ['--manifest-path', source_root / 'Cargo.toml']
cargo_options += ['--target-dir', build_root / 'src']
cargo_options += ['--profile', profile]
if gtk4_x11.found()
2024-07-17 13:28:14 +02:00
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,
'VERSION': version,
'LOCALEDIR': localedir,
}
# Build binary
2022-11-07 16:19:27 +01:00
cargo_build = custom_target(
'cargo-build',
build_by_default: true,
2022-08-05 00:13:59 -04:00
build_always_stale: true,
2022-11-07 16:19:27 +01:00
output: 'src',
console: true,
2022-11-07 16:19:27 +01:00
env: cargo_env,
command: [
2024-07-17 13:28:14 +02:00
cargo,
'build',
2022-08-05 00:13:59 -04:00
cargo_options,
2024-07-17 13:28:14 +02:00
],
)
2022-11-07 16:19:27 +01:00
# Copy binary
2024-07-17 13:28:14 +02:00
custom_target(
2022-11-07 16:19:27 +01:00
'cp-binary',
depends: cargo_build,
build_by_default: true,
build_always_stale: true,
install: true,
install_dir: get_option('bindir'),
output: meson.project_name(),
command: [
'cp',
'src' / rust_target / meson.project_name(),
'@OUTPUT@',
],
)
2024-07-17 13:28:14 +02:00
custom_target(
'cargo-doc',
build_by_default: false,
build_always_stale: true,
output: 'doc',
console: true,
command: [
2024-07-17 13:28:14 +02:00
cargo,
'doc',
cargo_options + ['--no-deps', '--document-private-items'],
],
)
# Run tests
test(
'cargo-test',
cargo,
args: [
'test',
cargo_options,
'--',
'--test-threads=1',
],
is_parallel: false,
timeout: 1800,
2025-04-18 02:40:39 +02:00
)