mirror of
https://github.com/italicsjenga/ash-molten.git
synced 2024-12-23 21:31:30 +11:00
Build molten inside the build script
This commit is contained in:
parent
14fce3794f
commit
8d9dbb3cf9
|
@ -11,3 +11,6 @@ documentation = "https://docs.rs/ash-molten"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
ash = "0.29"
|
ash = "0.29"
|
||||||
|
|
||||||
|
[features]
|
||||||
|
external = []
|
||||||
|
|
22
build.rs
22
build.rs
|
@ -1,7 +1,27 @@
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
// Features are not used inside build scripts, so we have to explicitly query them from the
|
||||||
|
// enviroment
|
||||||
|
fn is_external_enabled() -> bool {
|
||||||
|
std::env::vars()
|
||||||
|
.filter_map(|(flag, _)| {
|
||||||
|
const NAME: &'static str = "CARGO_FEATURE_";
|
||||||
|
if flag.starts_with(NAME) {
|
||||||
|
let feature = flag.split(NAME).nth(1).expect("").to_string();
|
||||||
|
println!("{:?}", feature);
|
||||||
|
return Some(feature);
|
||||||
|
}
|
||||||
|
None
|
||||||
|
})
|
||||||
|
.find(|f| f == "EXTERNAL")
|
||||||
|
.is_some()
|
||||||
|
}
|
||||||
fn main() {
|
fn main() {
|
||||||
let project_dir = PathBuf::from(std::env::var("CARGO_MANIFEST_DIR").unwrap()).join("external");
|
// The 'external' feature was not enabled. Molten will be built automaticaly.
|
||||||
|
if !is_external_enabled() {
|
||||||
|
std::process::Command::new("bash").arg("build_molten.sh").status().expect("Unable to build molten");
|
||||||
|
let project_dir = PathBuf::from(std::env::var("CARGO_MANIFEST_DIR").unwrap()).join("native");
|
||||||
println!("cargo:rustc-link-search=native={}", project_dir.display());
|
println!("cargo:rustc-link-search=native={}", project_dir.display());
|
||||||
|
}
|
||||||
println!("cargo:rustc-link-lib=framework=Metal");
|
println!("cargo:rustc-link-lib=framework=Metal");
|
||||||
println!("cargo:rustc-link-lib=framework=AppKit");
|
println!("cargo:rustc-link-lib=framework=AppKit");
|
||||||
println!("cargo:rustc-link-lib=framework=QuartzCore");
|
println!("cargo:rustc-link-lib=framework=QuartzCore");
|
||||||
|
|
|
@ -2,4 +2,4 @@ git submodule update --init
|
||||||
cd MoltenVK
|
cd MoltenVK
|
||||||
sh fetchDependencies
|
sh fetchDependencies
|
||||||
make macos
|
make macos
|
||||||
cp Package/Release/MoltenVK/macOS/static/libMoltenVK.a ../external
|
cp Package/Release/MoltenVK/macOS/static/libMoltenVK.a ../native
|
||||||
|
|
BIN
external/libMoltenVK.a
vendored
BIN
external/libMoltenVK.a
vendored
Binary file not shown.
Loading…
Reference in a new issue