| 1 |
# Configuration file |
| 2 |
conf = configuration_data() |
| 3 |
conf.set_quoted('NAME', name) |
| 4 |
conf.set_quoted('PKGNAME', meson.project_name()) |
| 5 |
conf.set_quoted('APP_ID', app_id) |
| 6 |
conf.set_quoted('PATH_ID', path_id) |
| 7 |
conf.set_quoted('VERSION', meson.project_version()) |
| 8 |
conf.set_quoted('PROFILE', profile) |
| 9 |
conf.set_quoted('LOCALEDIR', localedir) |
| 10 |
conf.set_quoted('DATADIR', datadir) |
| 11 |
|
| 12 |
configure_file( |
| 13 |
input: 'config.rs.in', |
| 14 |
output: 'config.rs', |
| 15 |
configuration: conf |
| 16 |
) |
| 17 |
|
| 18 |
run_command( |
| 19 |
'cp', |
| 20 |
join_paths(meson.project_build_root(), 'src', 'config.rs'), |
| 21 |
join_paths(meson.project_source_root(), 'src', 'config.rs'), |
| 22 |
check: true |
| 23 |
) |
| 24 |
|
| 25 |
# Setup cargo |
| 26 |
cargo = find_program('cargo') |
| 27 |
cargo_options = [ '--manifest-path', meson.project_source_root() / 'Cargo.toml' ] |
| 28 |
cargo_options += [ '--target-dir', meson.project_build_root() / 'target' ] |
| 29 |
|
| 30 |
if get_option('profile') == 'default' |
| 31 |
cargo_options += [ '--release' ] |
| 32 |
rust_target = 'release' |
| 33 |
message('Building in release mode') |
| 34 |
else |
| 35 |
rust_target = 'debug' |
| 36 |
message('Building in debug mode') |
| 37 |
endif |
| 38 |
|
| 39 |
cargo_release = custom_target( |
| 40 |
'cargo-build', |
| 41 |
build_by_default: true, |
| 42 |
build_always_stale: true, |
| 43 |
output: meson.project_name(), |
| 44 |
console: true, |
| 45 |
install: true, |
| 46 |
install_dir: bindir, |
| 47 |
command: [ |
| 48 |
'env', |
| 49 |
cargo, 'build', |
| 50 |
cargo_options, |
| 51 |
'&&', |
| •52 |
'cp', meson.project_build_root() / 'target' / get_option('host_arch') / 'release' / 'fragments', '@OUTPUT@', |
| 53 |
] |
| •54 |
) |