-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Jarkko Sakkinen <[email protected]>
- Loading branch information
Showing
13 changed files
with
292 additions
and
57 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
[package] | ||
name = "polkavm-test-data" | ||
version.workspace = true | ||
authors.workspace = true | ||
license.workspace = true | ||
edition.workspace = true | ||
rust-version.workspace = true | ||
repository.workspace = true | ||
|
||
[build-dependencies] | ||
dirs = { workspace = true } | ||
duct = { workspace = true } | ||
polkavm-linker = { workspace = true } | ||
|
||
[lints] | ||
workspace = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
@echo off | ||
|
||
cd %1 | ||
|
||
cargo build -q --profile no-lto --bin test-blob -p test-blob --target ..\crates\polkavm-linker\riscv32emac-unknown-none-polkavm.json -Zunstable-options -Zbuild-std="core,alloc" | ||
cargo build -q --profile no-lto --bin test-blob -p test-blob --target ..\crates\polkavm-linker\riscv64emac-unknown-none-polkavm.json -Zunstable-options -Zbuild-std="core,alloc" | ||
cargo build -q --profile release --bin bench-pinky -p bench-pinky --target ..\crates\polkavm-linker\riscv32emac-unknown-none-polkavm.json -Zunstable-options -Zbuild-std="core,alloc" | ||
cargo build -q --profile release --bin bench-pinky -p bench-pinky --target ..\crates\polkavm-linker\riscv64emac-unknown-none-polkavm.json -Zunstable-options -Zbuild-std="core,alloc" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
use std::path::PathBuf; | ||
use std::process::Command; | ||
|
||
fn build_unix(project: &str, profile: &str, target: &str) -> Result<(), ()> { | ||
let mut path = PathBuf::new(); | ||
|
||
path.push(std::env!("CARGO_MANIFEST_DIR")); | ||
path.push(".."); | ||
path.push(".."); | ||
path.push("guest-programs"); | ||
|
||
let guest_programs = String::from(path.as_path().to_str().unwrap()); | ||
// path.push(project); | ||
let cargo_pwd = path.as_path(); | ||
|
||
let home = dirs::home_dir().unwrap(); | ||
let home_str = home.to_str().unwrap(); | ||
|
||
// Remaps for RUSTFLAGS: | ||
let remaps = std::format!("--remap-path-prefix={guest_programs}= --remap-path-prefix={home_str}=~"); | ||
std::env::set_current_dir(cargo_pwd).unwrap(); | ||
|
||
let mut cmd = Command::new("cargo"); | ||
cmd.env_clear() | ||
.env("PATH", std::env!("PATH")) | ||
.env("RUSTFLAGS", remaps) | ||
.env("RUSTUP_HOME", std::env!("RUSTUP_HOME")) | ||
.arg("build") | ||
.arg("-q") | ||
.arg("--profile") | ||
.arg(profile) | ||
.arg("--bin") | ||
.arg(project) | ||
.arg("-p") | ||
.arg(project) | ||
.arg("--target") | ||
.arg(target) | ||
.arg("-Zunstable-options") | ||
.arg("-Zbuild-std=core,alloc"); | ||
|
||
let res = cmd.output().unwrap(); | ||
|
||
if res.status.success() { | ||
return Ok(()); | ||
} | ||
|
||
let err = String::from_utf8_lossy(&res.stderr).to_string(); | ||
println!("cargo::error={err}"); | ||
|
||
Err(()) | ||
} | ||
|
||
fn main() -> Result<(), ()> { | ||
println!("cargo:rerun-if-env-changed=OUT_DIR"); | ||
|
||
if cfg!(windows) { | ||
let mut build_cmd = PathBuf::new(); | ||
|
||
build_cmd.push(std::env!("CARGO_MANIFEST_DIR")); | ||
build_cmd.push("build.cmd"); | ||
|
||
let mut path = PathBuf::new(); | ||
|
||
path.push(std::env!("CARGO_MANIFEST_DIR")); | ||
path.push(".."); | ||
path.push(".."); | ||
path.push("guest-programs"); | ||
|
||
let mut cmd = Command::new("powershell"); | ||
cmd.env_clear().env("PATH", std::env!("PATH")).arg(build_cmd).arg(path); | ||
} else { | ||
let target_32 = polkavm_linker::target_json_32_path() | ||
.unwrap() | ||
.into_os_string() | ||
.into_string() | ||
.unwrap(); | ||
|
||
let target_64 = polkavm_linker::target_json_64_path() | ||
.unwrap() | ||
.into_os_string() | ||
.into_string() | ||
.unwrap(); | ||
|
||
build_unix("test-blob", "no-lto", &target_32)?; | ||
build_unix("test-blob", "no-lto", &target_64)?; | ||
build_unix("bench-pinky", "release", &target_32)?; | ||
build_unix("bench-pinky", "release", &target_64)?; | ||
} | ||
|
||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
pub const BENCH_PINKY_32: &[u8] = include_bytes!("../../../guest-programs/target/riscv64emac-unknown-none-polkavm/release/bench-pinky"); | ||
pub const BENCH_PINKY_64: &[u8] = include_bytes!("../../../guest-programs/target/riscv64emac-unknown-none-polkavm/release/bench-pinky"); | ||
pub const TEST_BLOB_32: &[u8] = include_bytes!("../../../guest-programs/target/riscv32emac-unknown-none-polkavm/no-lto/test-blob"); | ||
pub const TEST_BLOB_64: &[u8] = include_bytes!("../../../guest-programs/target/riscv64emac-unknown-none-polkavm/no-lto/test-blob"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.