* fix

* fmt

* Update build_and_test.yml

* no nightly

* fix

* why

* Update build_and_test.yml

* a

* a

* ok

* linux only

* fmt

* Update build_and_test.yml

* fix
This commit is contained in:
Dongjia "toka" Zhang 2022-12-21 11:12:54 +09:00 committed by GitHub
parent b0df0a26a1
commit f1b25fed65
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 12 deletions

View File

@ -61,8 +61,6 @@ jobs:
with:
profile: minimal
toolchain: stable
- name: set mold linker as default linker
uses: rui314/setup-mold@v1
- name: Install and cache deps
uses: awalsh128/cache-apt-pkgs-action@v1.1.0
with:

View File

@ -23,6 +23,11 @@ fn build_dep_check(tools: &[&str]) {
}
fn main() {
if !cfg!(target_os = "linux") {
println!("cargo:warning=Only linux host is supported for now.");
exit(0);
}
let out_path = PathBuf::from(&env::var_os("OUT_DIR").unwrap());
println!("cargo:rerun-if-changed=harness.c");
@ -50,16 +55,25 @@ fn main() {
let symcc_dir = clone_and_build_symcc(&out_path);
let runtime_dir = std::env::var("CARGO_TARGET_DIR")
.map(PathBuf::from)
.unwrap_or_else(|_| {
std::env::current_dir()
.unwrap()
.join("..")
.join("runtime")
.join("target")
})
.join(std::env::var("PROFILE").unwrap());
let runtime_dir = std::env::current_dir().unwrap().join("..").join("runtime");
// Build the runtime
std::process::Command::new("cargo")
.current_dir(&runtime_dir)
.env_remove("CARGO_TARGET_DIR")
.arg("build")
.arg("--release")
.status()
.expect("Failed to build runtime");
std::fs::copy(
&runtime_dir
.join("target")
.join("release")
.join("libSymRuntime.so"),
&runtime_dir.join("libSymRuntime.so"),
)
.unwrap();
if !runtime_dir.join("libSymRuntime.so").exists() {
println!("cargo:warning=Runtime not found. Build it first.");