* 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: with:
profile: minimal profile: minimal
toolchain: stable toolchain: stable
- name: set mold linker as default linker
uses: rui314/setup-mold@v1
- name: Install and cache deps - name: Install and cache deps
uses: awalsh128/cache-apt-pkgs-action@v1.1.0 uses: awalsh128/cache-apt-pkgs-action@v1.1.0
with: with:

View File

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