diff --git a/.gitmodules b/.gitmodules index 6a34cef..e69de29 100644 --- a/.gitmodules +++ b/.gitmodules @@ -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 diff --git a/spirv-to-dxil-sys/build.rs b/spirv-to-dxil-sys/build.rs index f29d534..2c8a5a2 100644 --- a/spirv-to-dxil-sys/build.rs +++ b/spirv-to-dxil-sys/build.rs @@ -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!"); } diff --git a/spirv-to-dxil-sys/native/CMakeLists.txt b/spirv-to-dxil-sys/native/CMakeLists.txt index 9cde2f9..25660b5 100644 --- a/spirv-to-dxil-sys/native/CMakeLists.txt +++ b/spirv-to-dxil-sys/native/CMakeLists.txt @@ -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 ) diff --git a/spirv-to-dxil-sys/native/mesa b/spirv-to-dxil-sys/native/mesa deleted file mode 160000 index 60d7e15..0000000 --- a/spirv-to-dxil-sys/native/mesa +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 60d7e15a7e61c6d51c3fa8e26839793782a12fb4