Skip to content

Commit

Permalink
build: introduce enable_rust build option
Browse files Browse the repository at this point in the history
Introduce an option to enable/disable the build of all the Rust
sub-projects.

This can be useful to build scx on those systems where Rust is not
fully supported (e.g., armhf).

Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
  • Loading branch information
Andrea Righi committed Dec 9, 2023
1 parent 330e104 commit 6343bcf
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ options can be used in such cases.
- `cargo`: `cargo` to use when building rust sub-projects
- 'cargo_home': 'CARGO_HOME env to use when invoking cargo'
- `offline`: 'Compilation step should not access the internet'
- `enable_rust`: 'Enable the build of rust sub-projects'

For example, let's say you want to use `bpftool` and `libbpf` shipped in the
kernel tree located at `$KERNEL`. We need to build `bpftool` in the kernel
Expand Down
8 changes: 6 additions & 2 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,13 @@ if get_option('cargo_home') != ''
cargo_env.set('CARGO_HOME', get_option('cargo_home'))
endif

meson.add_install_script('meson-scripts/install_rust_user_scheds')
if get_option('enable_rust')
meson.add_install_script('meson-scripts/install_rust_user_scheds')
endif

run_target('fetch', command: [cargo_fetch, cargo], env: cargo_env)

subdir('rust')
if get_option('enable_rust')
subdir('rust')
endif
subdir('scheds')
2 changes: 2 additions & 0 deletions meson.options
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ option('cargo_home', type: 'string',
description: 'CARGO_HOME env to use when invoking cargo')
option('offline', type: 'boolean', value: 'false',
description: 'Compilation step should not access the internet')
option('enable_rust', type: 'boolean', value: 'true',
description: 'Enable rust sub-projects')
4 changes: 3 additions & 1 deletion scheds/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,7 @@ bpf_includes = ['-I', join_paths(meson.current_source_dir(), 'include'),
user_c_includes = include_directories('include')

subdir('kernel-examples')
subdir('rust-user')
if get_option('enable_rust')
subdir('rust-user')
endif
subdir('c-user')

0 comments on commit 6343bcf

Please sign in to comment.