Skip to content

Commit

Permalink
Simplified meson rust compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikReider committed Dec 10, 2023
1 parent 5637651 commit e844bca
Showing 1 changed file with 23 additions and 15 deletions.
38 changes: 23 additions & 15 deletions src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,27 @@ else
rust_target = 'debug'
endif

foreach prog : ['swayosd-server', 'swayosd-client', 'swayosd-libinput-backend']
custom_target(
'cargo-build: @0@'.format(prog),
build_by_default: true,
build_always_stale: true,
output: prog,
console: true,
install: true,
install_dir: join_paths(get_option('prefix'), get_option('bindir')),
command: [
'env', cargo_env,
cargo_bin, 'build', cargo_opt, '&&',
'cp', '-f', 'src' / rust_target / prog, '@OUTPUT@',
]
)
binaries = [
'swayosd-server',
'swayosd-client',
'swayosd-libinput-backend'
]
binaries_path = []
foreach prog : binaries
binaries_path += '@OUTDIR@/@0@/@1@'.format(rust_target, prog)
endforeach

custom_target(
'Cargo Build',
build_by_default: true,
build_always_stale: true,
output: binaries,
console: true,
install: true,
install_dir: join_paths(get_option('prefix'), get_option('bindir')),
command: [
'env', cargo_env,
cargo_bin, 'build', cargo_opt, '&&',
'cp', '-f', binaries_path, '@OUTDIR@'
]
)

0 comments on commit e844bca

Please sign in to comment.