mirror of
https://github.com/italicsjenga/spirv-to-dxil-rs.git
synced 2024-12-23 11:31:31 +11:00
build: clone mesa directly from gitlab
If we don't do this, the crate is too big for crates.io.
This commit is contained in:
parent
fddf8aab2a
commit
3261a3c54f
3
.gitmodules
vendored
3
.gitmodules
vendored
|
@ -1,3 +0,0 @@
|
|||
[submodule "spirv-to-dxil-sys/vendor/mesa"]
|
||||
path = spirv-to-dxil-sys/native/mesa
|
||||
url = https://gitlab.freedesktop.org/mesa/mesa
|
|
@ -1,6 +1,8 @@
|
|||
use cmake::Config;
|
||||
use std::{env, fs::File, path::PathBuf};
|
||||
|
||||
const MESA_HASH: &str = "5678fbe010fb8ba9ac6188c5ec7368fb55a98319";
|
||||
|
||||
fn main() {
|
||||
let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap());
|
||||
if env::var("DOCS_RS").is_ok() {
|
||||
|
@ -10,6 +12,7 @@ fn main() {
|
|||
}
|
||||
|
||||
let cmake_dst = Config::new("native")
|
||||
.define("MESA_HASH", MESA_HASH)
|
||||
.build_target("mesa")
|
||||
.build();
|
||||
|
||||
|
@ -26,18 +29,16 @@ fn main() {
|
|||
println!("cargo:rustc-link-lib=static=spirv_to_dxil");
|
||||
println!("cargo:rustc-link-lib=static=vulkan_util");
|
||||
|
||||
if !cfg!(feature = "included-bindings") {
|
||||
let bindings = bindgen::Builder::default()
|
||||
.header("native/wrapper.h")
|
||||
.clang_arg(format!("-F{}", header_dst.display()))
|
||||
.clang_arg(format!("-F{}", header_compiler_dst.display()))
|
||||
.clang_arg(format!("-I{}", header_dst.display()))
|
||||
.clang_arg(format!("-I{}", header_compiler_dst.display()))
|
||||
.parse_callbacks(Box::new(bindgen::CargoCallbacks))
|
||||
.generate()
|
||||
.expect("Unable to generate bindings");
|
||||
bindings
|
||||
.write_to_file(out_dir.join("bindings.rs"))
|
||||
.expect("Couldn't write bindings!");
|
||||
}
|
||||
let bindings = bindgen::Builder::default()
|
||||
.header("native/wrapper.h")
|
||||
.clang_arg(format!("-F{}", header_dst.display()))
|
||||
.clang_arg(format!("-F{}", header_compiler_dst.display()))
|
||||
.clang_arg(format!("-I{}", header_dst.display()))
|
||||
.clang_arg(format!("-I{}", header_compiler_dst.display()))
|
||||
.parse_callbacks(Box::new(bindgen::CargoCallbacks))
|
||||
.generate()
|
||||
.expect("Unable to generate bindings");
|
||||
bindings
|
||||
.write_to_file(out_dir.join("bindings.rs"))
|
||||
.expect("Couldn't write bindings!");
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
cmake_minimum_required(VERSION 3.6)
|
||||
cmake_minimum_required(VERSION 3.8)
|
||||
project(native-spirv-to-dxil)
|
||||
include(ExternalProject)
|
||||
|
||||
|
@ -46,10 +46,14 @@ set(MESA_EXTRA_FLAGS
|
|||
|
||||
|
||||
ExternalProject_Add(mesa
|
||||
URL file://${CMAKE_CURRENT_LIST_DIR}/mesa
|
||||
GIT_REPOSITORY https://gitlab.freedesktop.org/mesa/mesa
|
||||
GIT_TAG ${MESA_HASH}
|
||||
GIT_SHALLOW true
|
||||
GIT_PROGRESS true
|
||||
GIT_CONFIG core.symlinks=false
|
||||
PREFIX ${CMAKE_BINARY_DIR}/mesa
|
||||
CONFIGURE_COMMAND cd ${CMAKE_BINARY_DIR}/mesa/src/mesa && meson setup ${CMAKE_BINARY_DIR}/mesa/src/mesa-build ${MESA_EXTRA_FLAGS}
|
||||
BUILD_COMMAND cd ${CMAKE_BINARY_DIR}/mesa/src/mesa-build && meson compile src/vulkan/util/vulkan_util:static_library && meson compile src/microsoft/spirv_to_dxil/spirv_to_dxil:static_library
|
||||
BUILD_COMMAND cd ${CMAKE_BINARY_DIR}/mesa/src/mesa-build && ninja src/vulkan/util/libvulkan_util.a && ninja src/microsoft/spirv_to_dxil/libspirv_to_dxil.a
|
||||
INSTALL_COMMAND cmake -DOUT_DIR=${CMAKE_BINARY_DIR}/mesa -DMESA_BUILD=${CMAKE_BINARY_DIR}/mesa/src/mesa-build -P ${CMAKE_CURRENT_LIST_DIR}/install_spirv_to_dxil.cmake
|
||||
BUILD_BYPRODUCTS ${CMAKE_BINARY_DIR}/mesa/lib/spirv_to_dxil.lib ${CMAKE_BINARY_DIR}/mesa/lib/libspirv_to_dxil.a ${CMAKE_BINARY_DIR}/mesa/lib/vulkan_util.lib ${CMAKE_BINARY_DIR}/mesa/lib/libvulkan_util.a
|
||||
)
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
Subproject commit 60d7e15a7e61c6d51c3fa8e26839793782a12fb4
|
Loading…
Reference in a new issue