build.rs 1.01 KB
Newer Older
qinsoon's avatar
qinsoon committed
1 2
extern crate gcc;

3
#[cfg(any(target_os = "macos", target_os = "linux"))]
qinsoon's avatar
qinsoon committed
4 5
#[cfg(target_arch = "x86_64")]
fn main() {
Kunshan Wang's avatar
Kunshan Wang committed
6
    gcc::compile_library("libruntime.a", &["src/runtime/runtime_x64_sysv.c"]);
7
    
8
    gcc::Config::new().flag("-O3").flag("-c")
Kunshan Wang's avatar
Kunshan Wang committed
9
                     .file("src/runtime/swap_stack_x64_sysv.S")
10
                     .compile("libswap_stack.a"); 
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
}

#[cfg(target_os = "linux")]
#[cfg(target_arch = "aarch64")]
fn main() {
    gcc::compile_library("libruntime.a", &["src/runtime/runtime_aarch64_sysv.c"]);

    gcc::Config::new().flag("-O3").flag("-c")
        .file("src/runtime/swap_stack_aarch64_sysv.S")
        .compile("libswap_stack.a");
}

// This is here to enable cross compiling from windows/x86_64 to linux/aarch64
#[cfg(target_os = "windows")]
#[cfg(target_arch = "x86_64")]
fn main() {
    gcc::compile_library("libruntime.a", &["src/runtime/runtime_aarch64_sysv.c"]);

    gcc::Config::new().flag("-O3").flag("-c")
        .file("src/runtime/swap_stack_aarch64_sysv.S")
        .compile("libswap_stack.a");
32
}