diff options
author | Lily Foster <lily@lily.flowers> | 2023-04-21 17:50:22 +0300 |
---|---|---|
committer | GStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org> | 2023-04-21 19:55:37 +0300 |
commit | 8e4fd2c1678cd29641d2a085eb7b2edd28232184 (patch) | |
tree | e20ed9b476799870b7b6b83ae4224709ecf226e3 /meson.build | |
parent | 41ba4b2bc32e30e86f4f80d918eddc00d9b5f396 (diff) |
meson: support rust cross-compiling with cargo wrapper
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1188>
Diffstat (limited to 'meson.build')
-rw-r--r-- | meson.build | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/meson.build b/meson.build index da9649bb5..b1e8f04ac 100644 --- a/meson.build +++ b/meson.build @@ -21,13 +21,14 @@ endif cargo = find_program('cargo', version:'>=1.40') cargo_wrapper = find_program('cargo_wrapper.py') cargo_c = find_program('cargo-cbuild', version:'>=0.9.3', required: false) -rustc = find_program('rustc', version:'>=1.52') + +rustc = meson.get_compiler('rust') if not cargo_c.found() error('cargo-c missing, install it with: \'cargo install cargo-c\'') endif -system = build_machine.system() +system = host_machine.system() exe_suffix = '' if system == 'windows' exe_suffix = '.exe' @@ -365,7 +366,7 @@ pkgconfig_install_dir = get_option('libdir') / 'pkgconfig' extra_args = [] if get_option('doc').disabled() - extra_args = ['--disable-doc'] + extra_args += ['--disable-doc'] endif # 'pkgconfig' is the entry in the machine file, if specified @@ -383,6 +384,18 @@ if pkg_config_path.length() > 0 extra_env += {'PKG_CONFIG_PATH': pathsep.join(pkg_config_path)} endif +# get compiler and flags for rust (if any) +rustc_cmd = '' +rust_flags = [] +foreach rustc_arg : rustc.cmd_array() + if rustc_cmd == '' + rustc_cmd = rustc_arg + else + rust_flags += [rustc_arg] + endif +endforeach +extra_env += {'RUSTC': rustc_cmd, 'RUSTFLAGS': ' '.join(rust_flags)} + rs_plugins = custom_target('gst-plugins-rs', build_by_default: true, output: output, |