76 lines
2.5 KiB
Rust
76 lines
2.5 KiB
Rust
use cc;
|
|
|
|
use std::env;
|
|
|
|
fn main() {
|
|
let mut build = cc::Build::new();
|
|
|
|
build.include("vma_source");
|
|
|
|
// We want to use our own loader, instead of requiring us to link
|
|
// in vulkan.dll/.dylib in addition. This is especially important
|
|
// for MoltenVK, where there is no default installation path, unlike
|
|
// Linux (pkconfig) and Windows (VULKAN_SDK environment variable).
|
|
build.define("VMA_STATIC_VULKAN_FUNCTIONS", "0");
|
|
|
|
build.define("VMA_VULKAN_VERSION", "1002000");
|
|
build.define("VMA_DYNAMIC_VULKAN_FUNCTIONS", "0");
|
|
|
|
// TODO: Add some configuration options under crate features
|
|
//#define VMA_HEAVY_ASSERT(expr) assert(expr)
|
|
//#define VMA_USE_STL_CONTAINERS 1
|
|
//#define VMA_DEDICATED_ALLOCATION 0
|
|
//#define VMA_DEBUG_MARGIN 16
|
|
//#define VMA_DEBUG_DETECT_CORRUPTION 1
|
|
//#define VMA_DEBUG_INITIALIZE_ALLOCATIONS 1
|
|
//#define VMA_RECORDING_ENABLED 0
|
|
//#define VMA_DEBUG_MIN_BUFFER_IMAGE_GRANULARITY 256
|
|
|
|
let source_files = ["vma_lib/vma_lib.cpp"];
|
|
|
|
for source_file in &source_files {
|
|
build.file(&source_file);
|
|
}
|
|
|
|
build.cpp(true);
|
|
|
|
let target = env::var("TARGET").unwrap();
|
|
|
|
// don't assume vulkan headers to be installed, thus import them
|
|
build.include(".");
|
|
|
|
if target.contains("darwin") {
|
|
build
|
|
.flag("-std=c++11")
|
|
.flag("-Wno-missing-field-initializers")
|
|
.flag("-Wno-unused-variable")
|
|
.flag("-Wno-unused-parameter")
|
|
.flag("-Wno-unused-private-field")
|
|
.flag("-Wno-reorder")
|
|
.flag("-Wno-type-limits")
|
|
.cpp_link_stdlib("c++")
|
|
.cpp_set_stdlib("c++");
|
|
} else if target.contains("linux") {
|
|
build
|
|
.flag("-std=c++11")
|
|
.flag("-Wno-missing-field-initializers")
|
|
.flag("-Wno-unused-variable")
|
|
.flag("-Wno-unused-parameter")
|
|
.flag("-Wno-unused-private-field")
|
|
.flag("-Wno-reorder")
|
|
.flag("-Wno-type-limits")
|
|
.cpp_link_stdlib("stdc++");
|
|
} else if target.contains("windows") && target.contains("gnu") {
|
|
build
|
|
.flag("-std=c++11")
|
|
.flag("-Wno-missing-field-initializers")
|
|
.flag("-Wno-unused-variable")
|
|
.flag("-Wno-unused-parameter")
|
|
.flag("-Wno-unused-private-field")
|
|
.flag("-Wno-reorder")
|
|
.flag("-Wno-type-limits")
|
|
.cpp_link_stdlib("stdc++");
|
|
}
|
|
|
|
build.compile("vma_cpp");
|
|
}
|