Skip to content

Commit

Permalink
Set CARGO_BUILD_TARGET in wasm-builder
Browse files Browse the repository at this point in the history
  • Loading branch information
ark0f committed Oct 20, 2023
1 parent ef49e0e commit 047cd31
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion utils/wasm-builder/src/crate_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

use anyhow::{Context, Result};
use cargo_metadata::{Metadata, MetadataCommand, Package};
use std::{collections::HashMap, path::Path};
use std::{collections::HashMap, env, path::Path};

use crate::builder_error::BuilderError;

Expand All @@ -43,9 +43,12 @@ impl CrateInfo {
BuilderError::ManifestPathInvalid(manifest_path.to_path_buf())
);

let target = env::var_os("TARGET").unwrap();

let mut meta_cmd = MetadataCommand::new();
let metadata = meta_cmd
.manifest_path(manifest_path)
.env("CARGO_BUILD_TARGET", target) // for cross-compilation
.exec()
.context("unable to invoke `cargo metadata`")?;

Expand Down

0 comments on commit 047cd31

Please sign in to comment.