Loupe/src/meson.build

49 lines
1.1 KiB
Meson
Raw Normal View History

configure_file(
input: 'config.rs.in',
output: 'config.rs',
configuration: conf
)
build_root = meson.project_build_root()
source_root = meson.project_source_root()
# Copy the config.rs output to the source directory.
run_command(
'cp',
build_root / 'src' / 'config.rs',
source_root / 'src' / 'config.rs',
check: true
)
cargo_options = [ '--manifest-path', source_root / 'Cargo.toml' ]
cargo_options += [ '--target-dir', build_root / 'src' ]
2022-08-05 00:13:59 -04:00
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
cargo_env = [ 'CARGO_HOME=' + build_root / 'cargo-home' ]
cargo_release = custom_target(
'cargo-build',
build_by_default: true,
2022-08-05 00:13:59 -04:00
build_always_stale: true,
output: meson.project_name(),
console: true,
install: true,
install_dir: get_option('bindir'),
command: [
2022-08-05 00:13:59 -04:00
'env',
cargo_env,
cargo, 'build',
cargo_options,
'&&',
'cp', 'src' / rust_target / meson.project_name(), '@OUTPUT@',
]
)