fix build rs
This commit is contained in:
2
run.py
2
run.py
@@ -50,7 +50,7 @@ class Language(Enum):
|
|||||||
"build",
|
"build",
|
||||||
],
|
],
|
||||||
Language.RUST: [
|
Language.RUST: [
|
||||||
"cargo",
|
"make",
|
||||||
"build",
|
"build",
|
||||||
],
|
],
|
||||||
Language.KOTLIN: [
|
Language.KOTLIN: [
|
||||||
|
|||||||
12
space/src-rs/Makefile
Normal file
12
space/src-rs/Makefile
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
BUILD_DIR = ../../build
|
||||||
|
|
||||||
|
TARGET = ./target/debug/srcrs
|
||||||
|
|
||||||
|
OUTPUT = rs.out
|
||||||
|
|
||||||
|
all: build
|
||||||
|
|
||||||
|
build:
|
||||||
|
cargo build
|
||||||
|
cp $(TARGET) $(BUILD_DIR)/$(OUTPUT)
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
use std::env;
|
|
||||||
use std::fs;
|
|
||||||
use std::path::Path;
|
|
||||||
|
|
||||||
fn main() {
|
|
||||||
println!("cargo::rerun-if-changed=src/main.rs");
|
|
||||||
// TODO: change to always execute build.rs
|
|
||||||
let target_dir = env::var("CARGO_TARGET_DIR").unwrap_or_else(|_| "target".to_string());
|
|
||||||
let profile = env::var("PROFILE").unwrap();
|
|
||||||
let exe_name = env::var("CARGO_PKG_NAME").unwrap();
|
|
||||||
|
|
||||||
println!("cargo::warning={}", profile);
|
|
||||||
|
|
||||||
let target_path = Path::new(&target_dir).join(&profile).join(&exe_name);
|
|
||||||
let dest_path = Path::new("../../build").join("rs.out");
|
|
||||||
println!("cargo::warning={}", exe_name);
|
|
||||||
if target_path.exists() {
|
|
||||||
println!("cargo::warning=copy to {:#?}", dest_path);
|
|
||||||
match fs::copy(&target_path, &dest_path) {
|
|
||||||
Ok(_) => println!("cargo::warning=copy success"),
|
|
||||||
Err(_) => println!("cargo::warning=copy failed"),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user