-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use SDL3_gpu_shadercross instead of unversioned SDL_gpu_shadercross
- Loading branch information
Showing
9 changed files
with
198 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
#!/bin/sh | ||
# Copyright 2022 Collabora Ltd. | ||
# SPDX-License-Identifier: Zlib | ||
|
||
set -eu | ||
|
||
cd `dirname $0`/.. | ||
|
||
# Needed so sed doesn't report illegal byte sequences on macOS | ||
export LC_CTYPE=C | ||
|
||
header=include/SDL3_gpu_shadercross/SDL_gpu_shadercross.h | ||
ref_major=$(sed -ne 's/^#define SDL_GPU_SHADERCROSS_MAJOR_VERSION *//p' $header) | ||
ref_minor=$(sed -ne 's/^#define SDL_GPU_SHADERCROSS_MINOR_VERSION *//p' $header) | ||
ref_micro=$(sed -ne 's/^#define SDL_GPU_SHADERCROSS_MICRO_VERSION *//p' $header) | ||
ref_version="${ref_major}.${ref_minor}.${ref_micro}" | ||
|
||
tests=0 | ||
failed=0 | ||
|
||
ok () { | ||
tests=$(( tests + 1 )) | ||
echo "ok - $*" | ||
} | ||
|
||
not_ok () { | ||
tests=$(( tests + 1 )) | ||
echo "not ok - $*" | ||
failed=1 | ||
} | ||
|
||
major=$(sed -ne 's/^set(MAJOR_VERSION \([0-9]*\))$/\1/p' CMakeLists.txt) | ||
minor=$(sed -ne 's/^set(MINOR_VERSION \([0-9]*\))$/\1/p' CMakeLists.txt) | ||
micro=$(sed -ne 's/^set(MICRO_VERSION \([0-9]*\))$/\1/p' CMakeLists.txt) | ||
ref_sdl_req=$(sed -ne 's/^set(SDL_REQUIRED_VERSION \([0-9.]*\))$/\1/p' CMakeLists.txt) | ||
version="${major}.${minor}.${micro}" | ||
|
||
if [ "$ref_version" = "$version" ]; then | ||
ok "CMakeLists.txt $version" | ||
else | ||
not_ok "CMakeLists.txt $version disagrees with SDL_gpu_shadercross.h $ref_version" | ||
fi | ||
|
||
for rcfile in src/version.rc; do | ||
tuple=$(sed -ne 's/^ *FILEVERSION *//p' "$rcfile" | tr -d '\r') | ||
ref_tuple="${ref_major},${ref_minor},${ref_micro},0" | ||
|
||
if [ "$ref_tuple" = "$tuple" ]; then | ||
ok "$rcfile FILEVERSION $tuple" | ||
else | ||
not_ok "$rcfile FILEVERSION $tuple disagrees with SDL_gpu_shadercross.h $ref_tuple" | ||
fi | ||
|
||
tuple=$(sed -ne 's/^ *PRODUCTVERSION *//p' "$rcfile" | tr -d '\r') | ||
|
||
if [ "$ref_tuple" = "$tuple" ]; then | ||
ok "$rcfile PRODUCTVERSION $tuple" | ||
else | ||
not_ok "$rcfile PRODUCTVERSION $tuple disagrees with SDL_gpu_shadercross.h $ref_tuple" | ||
fi | ||
|
||
tuple=$(sed -Ene 's/^ *VALUE "FileVersion", "([0-9, ]*)\\0"\r?$/\1/p' "$rcfile" | tr -d '\r') | ||
ref_tuple="${ref_major}, ${ref_minor}, ${ref_micro}, 0" | ||
|
||
if [ "$ref_tuple" = "$tuple" ]; then | ||
ok "$rcfile FileVersion $tuple" | ||
else | ||
not_ok "$rcfile FileVersion $tuple disagrees with SDL_gpu_shadercross.h $ref_tuple" | ||
fi | ||
|
||
tuple=$(sed -Ene 's/^ *VALUE "ProductVersion", "([0-9, ]*)\\0"\r?$/\1/p' "$rcfile" | tr -d '\r') | ||
|
||
if [ "$ref_tuple" = "$tuple" ]; then | ||
ok "$rcfile ProductVersion $tuple" | ||
else | ||
not_ok "$rcfile ProductVersion $tuple disagrees with SDL_gpu_shadercross.h $ref_tuple" | ||
fi | ||
done | ||
|
||
echo "1..$tests" | ||
exit "$failed" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# sdl3_gpu_shadercross cmake project-config input for CMakeLists.txt script | ||
|
||
include(FeatureSummary) | ||
set_package_properties(SDL3_gpu_shadercross PROPERTIES | ||
URL "https://github.com/libsdl-org/SDL_gpu_shadercross/" | ||
DESCRIPTION "Support support SPIR-V and HLSL on various backends" | ||
) | ||
|
||
set(SDL3_gpu_shadercross_FOUND ON) | ||
|
||
set(SDL3_gpu_SHADERCROSS_REQUIRED_VERSION @SDL_REQUIRED_VERSION@) | ||
|
||
set(SDL3_gpu_shadercross_SDL3_gpu_shadercross-shared_FOUND FALSE) | ||
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/SDL3_gpu_shadercross-shared-targets.cmake") | ||
include("${CMAKE_CURRENT_LIST_DIR}/SDL3_gpu_shadercross-shared.cmake") | ||
set(SDL3_gpu_shadercross_SDL3_gpu_shadercross-shared_FOUND TRUE) | ||
endif() | ||
|
||
set(SDL3_gpu_shadercross_SDL3_gpu_shadercross-static FALSE) | ||
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/SDL3_gpu_shadercross-static-targets.cmake") | ||
include("${CMAKE_CURRENT_LIST_DIR}/SDL3_gpu_shadercross-static.cmake") | ||
set(SDL3_gpu_shadercross_SDL3_gpu_shadercross-static_FOUND TRUE) | ||
endif() | ||
|
||
function(_sdl_create_target_alias_compat NEW_TARGET TARGET) | ||
if(CMAKE_VERSION VERSION_LESS "3.18") | ||
# Aliasing local targets is not supported on CMake < 3.18, so make it global. | ||
add_library(${NEW_TARGET} INTERFACE IMPORTED) | ||
set_target_properties(${NEW_TARGET} PROPERTIES INTERFACE_LINK_LIBRARIES "${TARGET}") | ||
else() | ||
add_library(${NEW_TARGET} ALIAS ${TARGET}) | ||
endif() | ||
endfunction() | ||
|
||
# Make sure SDL3_gpu_shadercross::SDL3_gpu_shadercross always exists | ||
if(NOT TARGET SDL3_gpu_shadercross::SDL3_gpu_shadercross) | ||
if(TARGET SDL3_gpu_shadercross::SDL3_gpu_shadercross) | ||
_sdl_create_target_alias_compat(SDL3_gpu_shadercross::SDL3_gpu_shadercross SDL3_gpu_shadercross::SDL3_gpu_shadercross-shared) | ||
elseif(TARGET SDL3_gpu_shadercross::SDL3_gpu_shadercross-static) | ||
_sdl_create_target_alias_compat(SDL3_gpu_shadercross::SDL3_gpu_shadercross SDL3_gpu_shadercross::SDL3_gpu_shadercross-static) | ||
endif() | ||
endif() | ||
|
||
@PACKAGE_INIT@ | ||
check_required_components(SDL3_gpu_shadercross) |
Oops, something went wrong.