build: go back to submodule method but clone a minimal subset

This commit is contained in:
chyyran 2023-02-04 16:58:31 -05:00
parent 701ff2f7a2
commit 0f4c1ba163
7 changed files with 38 additions and 8 deletions

3
.gitmodules vendored
View file

@ -0,0 +1,3 @@
[submodule "spirv-to-dxil-sys/native/mesa"]
path = spirv-to-dxil-sys/native/mesa
url = https://gitlab.freedesktop.org/mesa/mesa

View file

@ -14,7 +14,10 @@ spirv-to-dxil-rs builds a copy of spirv-to-dxil statically from Mesa. Many of th
Lex and Yacc are not required. Additionally, [CMake 3.6](https://cmake.org/) or later is required to run the build script. Lex and Yacc are not required. Additionally, [CMake 3.6](https://cmake.org/) or later is required to run the build script.
A script to clone a minimal subset of Mesa required to build spirv-to-dxil has been provided.
```bash ```bash
$ ./clone-mesa.sh
$ cargo build $ cargo build
``` ```

9
clone_mesa.sh Normal file
View file

@ -0,0 +1,9 @@
git clone --filter=blob:none --no-checkout https://gitlab.freedesktop.org/mesa/mesa
git submodule add https://gitlab.freedesktop.org/mesa/mesa spirv-to-dxil-sys/native/mesa
git submodule absorbgitdirs
git -C spirv-to-dxil-sys/native/mesa config core.sparseCheckout true
git -C spirv-to-dxil-sys/native/mesa config core.symlinks false
cp ./spirv-to-dxil-sys/native/mesa-sparse-checkout ./.git/modules/spirv-to-dxil-sys/native/mesa/info
git submodule update --init --force --checkout spirv-to-dxil-sys/native/mesa

View file

@ -1,8 +1,6 @@
use cmake::Config; use cmake::Config;
use std::{env, fs::File, path::{Path, PathBuf}}; use std::{env, fs::File, path::{Path, PathBuf}};
const MESA_HASH: &str = "13b25a6114fc226b1aa06125fa56bc5fffd900d4";
fn main() { fn main() {
let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap()); let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap());
if env::var("DOCS_RS").is_ok() { if env::var("DOCS_RS").is_ok() {
@ -12,7 +10,6 @@ fn main() {
} }
let cmake_dst = Config::new("native") let cmake_dst = Config::new("native")
.define("MESA_HASH", MESA_HASH)
.build_target("mesa") .build_target("mesa")
.build(); .build();

View file

@ -46,11 +46,7 @@ set(MESA_EXTRA_FLAGS
ExternalProject_Add(mesa ExternalProject_Add(mesa
GIT_REPOSITORY https://gitlab.freedesktop.org/mesa/mesa URL file://${CMAKE_CURRENT_LIST_DIR}/mesa
GIT_TAG ${MESA_HASH}
GIT_SHALLOW true
GIT_PROGRESS true
GIT_CONFIG core.symlinks=false
PREFIX ${CMAKE_BINARY_DIR}/mesa 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} 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 && ninja src/vulkan/util/libvulkan_util.a && ninja src/microsoft/spirv_to_dxil/libspirv_to_dxil.a 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

@ -0,0 +1 @@
Subproject commit 8f928a95e167423320af711b21270a8212f34628

View file

@ -0,0 +1,21 @@
/meson.build
/src/meson.build
/bin
/include
/src/loader
/src/android_stub
/src/compiler
/src/util
/src/vulkan
/src/microsoft
/src/gallium
/src/virtio
/src/amd/common
/src/tool
/src/mesa
/src/gtest
/src/getopt
/src/mapi
/src/c11
/VERSION
/meson_options.txt