1 Star 0 Fork 59

zzzzzzhao / sysmaster

forked from openEuler / sysmaster 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
build.rs 1.86 KB
一键复制 编辑 原始数据 按行查看 历史
hexiaowen 提交于 2023-08-04 15:20 . build: porting to using rust 1.57
// Copyright (c) 2022 Huawei Technologies Co.,Ltd. All rights reserved.
//
// sysMaster is licensed under Mulan PSL v2.
// You can use this software according to the terms and conditions of the Mulan
// PSL v2.
// You may obtain a copy of Mulan PSL v2 at:
// http://license.coscl.org.cn/MulanPSL2
// THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY
// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
// NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
// See the Mulan PSL v2 for more details.
//! do prepared actions for build
// if use env out_dir need add build.rs
use std::{env, process::Command};
const RELEASE: &str = "release";
macro_rules! warn {
($message:expr) => {
println!("cargo:warning={}", $message);
};
}
fn main() {
let m_dir = env::var("CARGO_MANIFEST_DIR").unwrap();
let s_cmd = format!("{}/build.sh", m_dir);
let out_dir = env::var("OUT_DIR").unwrap();
let t: Vec<_> = out_dir.split("build").collect();
println!("{:?},{:?}", s_cmd, t[0]);
let result = Command::new(&s_cmd)
.args(&[t[0].to_string()])
.status()
.unwrap();
warn!(format!("{:?}", result));
// warn!(format!(
// "{:?}",
// pkg_config::Config::new().probe("liblmdb").is_ok()
// ));
//println!("cargo:rust-flags = -C prefer-dynamic -C target-feature=-crt-static");
//pkg_config::Config::new().probe("lmdb").unwrap();
// println!("cargo:rustc-link-search=native=/usr/lib");
// println!("cargo:rustc-link-lib=dylib=lmdb");
println!("cargo:rerun-if-changed=build.sh");
println!("cargo:rerun-if-changed=build.rs");
// println!("cargo:rerun-if-changed=config.service");
// turn on "debug" for non-release build
let profile = env::var("PROFILE").unwrap();
if profile != RELEASE {
println!("cargo:rustc-cfg=debug");
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Rust
1
https://gitee.com/zzzzzzhao/sysmaster.git
git@gitee.com:zzzzzzhao/sysmaster.git
zzzzzzhao
sysmaster
sysmaster
master

搜索帮助

344bd9b3 5694891 D2dac590 5694891