Closed thatcosmonaut closed 1 week ago
I added spirv-cross as a git submodule instead of using cmake's FetchContent
to do this. I believe this keeps complexity low.
The following CMake options are relevant:
SDLGPUSHADERCROSS_SHARED
: build shared SDL3_gpu_sharedcross librarySDLGPUSHADERCROSS_STATIC
: build static SDL3_gpu_sharedcross librarySDLGPUSHADERCROSS_VENDORED
: use vendored spirv-crossSDLGPUSHADERCROSS_LINK_STATIC
: link to static spirv-crossSDLGPUSHADERCROSS_CLI
: build shadercross
utilSDLGPUSHADERCROSS_CLI_STATIC
: link shadercross
to static SDL3 and static SDL3_gpu_sharedcrossI also added -Werror
when building the shadercross
cli util, which errors now.
Thanks, I'll look into that. While I'm at it do you have any insight on the best way to link DirectXShaderCompiler?
Thanks, I'll look into that. While I'm at it do you have any insight on the best way to link DirectXShaderCompiler?
SDLGPUSHADERCROSS_VENDORED
assumes the sources of spirv-cross are already available (checked out as a git submodule).
I think we can do something similar here.
For dependencies that don't provide CMake support (ignore pkg-config because that is not available by default on Windows), I usually write custom FindXXX.cmake
modules.
Building it as a subproject is probably out of the question (LLVM is not fast to build).
Let's create a (cmake) script that downloads the prebuilt .so/dll binaries from the release binaries to a known location (e.g. external/dxcompiler
)
Then by building with SDLGPUSHADERCROSS_VENDORED=ON
, we will look in external/dxcompiler
for the binaries.
If SDLGPUSHADERCROSS_VENDORED=OFF
, then CMake will look in the default locations (and fail if it cannot find any).
I created a poc at https://github.com/madebr/SDL_gpu_shadercross/commit/e0df3340d5b626e17efc4274251c3393ea7d4b12 if you want to try things out.
Awesome, I will check that out shortly.
-Werror issue is fixed, it looks like verifying CMake files fails for SLR though.
Final note, I simply added the current main branch of spirv-cross as a submodule. For SDL_image and SDL_mixer we use libsdl-org forks of tagged releases.
I think it's safe to use spirv-cross main, they don't do ABI breaking changes and main branch is generally bugfixes and improvements.
Adding it as a submodule "freezes" it though. So you might want to regularly update it to get latest bugfixes.
Ah that's right. Makes sense.
Partially resolves #44
We can probably stop vendoring spirv_cross_c.h and spirv.h now that we're linking SPIRV-Cross directly.