Fix SDL_LEAN_AND_MEAN build

main
Anonymous Maarten 2024-03-11 20:16:20 +01:00 committed by Sam Lantinga
parent d4794cc714
commit bee8a95571
3 changed files with 32 additions and 19 deletions

View File

@ -15,8 +15,9 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
platform: platform:
- { name: Android.mk } - { name: "Android.mk" }
- { name: CMake, cmake: 1, android_abi: "arm64-v8a", android_platform: 23, arch: "aarch64", artifact: "SDL-android-arm64", apk-artifact: "SDL-android-apks-arm64" } - { name: "CMake", cmake: 1, android_abi: "arm64-v8a", android_platform: 23, arch: "aarch64", artifact: "SDL-android-arm64", apk-artifact: "SDL-android-apks-arm64" }
- { name: "CMake (lean and mean)", cmake: 1, cppflags: "-DSDL_LEAN_AND_MEAN=1", android_abi: "arm64-v8a", android_platform: 23, arch: "aarch64", artifact: "SDL-lean-android-arm64", apk-artifact: "SDL-lean-android-apks-arm64" }
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
@ -26,23 +27,25 @@ jobs:
local-cache: true local-cache: true
ndk-version: r21e ndk-version: r21e
- name: Build (Android.mk) - name: Build (Android.mk)
if: ${{ matrix.platform.name == 'Android.mk' }} if: ${{ contains(matrix.platform.name, 'Android.mk') }}
run: | run: |
./build-scripts/androidbuildlibs.sh ./build-scripts/androidbuildlibs.sh
- uses: actions/setup-java@v4 - uses: actions/setup-java@v4
if: ${{ matrix.platform.name == 'CMake' }} if: ${{ contains(matrix.platform.name, 'CMake') }}
with: with:
distribution: 'temurin' distribution: 'temurin'
java-version: '11' java-version: '11'
- name: Setup (CMake) - name: Setup (CMake)
if: ${{ matrix.platform.name == 'CMake' }} if: ${{ contains(matrix.platform.name, 'CMake') }}
run: | run: |
sudo apt-get update sudo apt-get update
sudo apt-get install ninja-build pkg-config sudo apt-get install ninja-build pkg-config
- name: Configure (CMake) - name: Configure (CMake)
if: ${{ matrix.platform.name == 'CMake' }} if: ${{ contains(matrix.platform.name, 'CMake') }}
run: | run: |
cmake -S . -B build \ cmake -S . -B build \
-DCMAKE_C_FLAGS="${{ matrix.platform.cppflags }}" \
-DCMAKE_CXX_FLAGS="${{ matrix.platform.cppflags }}" \
-Wdeprecated -Wdev -Werror \ -Wdeprecated -Wdev -Werror \
-DCMAKE_TOOLCHAIN_FILE=${{ steps.setup_ndk.outputs.ndk-path }}/build/cmake/android.toolchain.cmake \ -DCMAKE_TOOLCHAIN_FILE=${{ steps.setup_ndk.outputs.ndk-path }}/build/cmake/android.toolchain.cmake \
-DSDL_WERROR=ON \ -DSDL_WERROR=ON \
@ -59,25 +62,25 @@ jobs:
-DCMAKE_BUILD_TYPE=Release \ -DCMAKE_BUILD_TYPE=Release \
-GNinja -GNinja
- name: Build (CMake) - name: Build (CMake)
if: ${{ matrix.platform.name == 'CMake' }} if: ${{ contains(matrix.platform.name, 'CMake') }}
run: | run: |
cmake --build build --config Release --parallel --verbose cmake --build build --config Release --parallel --verbose
- name: Build test apk's (CMake) - name: Build test apk's (CMake)
if: ${{ matrix.platform.name == 'CMake' }} if: ${{ contains(matrix.platform.name, 'CMake') }}
run: | run: |
cmake --build build --config Release --parallel --verbose --target testaudiocapture-apk testcontroller-apk testmultiaudio-apk testsprite-apk cmake --build build --config Release --parallel --verbose --target testaudiocapture-apk testcontroller-apk testmultiaudio-apk testsprite-apk
- name: Install (CMake) - name: Install (CMake)
if: ${{ matrix.platform.name == 'CMake' }} if: ${{ contains(matrix.platform.name, 'CMake') }}
run: | run: |
cmake --install build --config Release cmake --install build --config Release
echo "SDL3_DIR=$(pwd)/prefix" >> $GITHUB_ENV echo "SDL3_DIR=$(pwd)/prefix" >> $GITHUB_ENV
( cd prefix; find ) | LC_ALL=C sort -u ( cd prefix; find ) | LC_ALL=C sort -u
- name: Package (CPack) - name: Package (CPack)
if: ${{ matrix.platform.name == 'CMake' }} if: ${{ contains(matrix.platform.name, 'CMake') }}
run: | run: |
cmake --build build/ --config Release --target package cmake --build build/ --config Release --target package
- name: Verify CMake configuration files - name: Verify CMake configuration files
if: ${{ matrix.platform.name == 'CMake' }} if: ${{ contains(matrix.platform.name, 'CMake') }}
run: | run: |
cmake -S cmake/test -B cmake_config_build -G Ninja \ cmake -S cmake/test -B cmake_config_build -G Ninja \
-DCMAKE_TOOLCHAIN_FILE=${{ steps.setup_ndk.outputs.ndk-path }}/build/cmake/android.toolchain.cmake \ -DCMAKE_TOOLCHAIN_FILE=${{ steps.setup_ndk.outputs.ndk-path }}/build/cmake/android.toolchain.cmake \
@ -87,19 +90,19 @@ jobs:
-DCMAKE_PREFIX_PATH=${{ env.SDL3_DIR }} -DCMAKE_PREFIX_PATH=${{ env.SDL3_DIR }}
cmake --build cmake_config_build --verbose cmake --build cmake_config_build --verbose
- name: Verify sdl3.pc - name: Verify sdl3.pc
if: ${{ matrix.platform.name == 'CMake' }} if: ${{ contains(matrix.platform.name, 'CMake') }}
run: | run: |
export CC="${{ steps.setup_ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=${{ matrix.platform.arch }}-none-linux-androideabi${{ matrix.platform.android_platform }}" export CC="${{ steps.setup_ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=${{ matrix.platform.arch }}-none-linux-androideabi${{ matrix.platform.android_platform }}"
export PKG_CONFIG_PATH=${{ env.SDL3_DIR }}/lib/pkgconfig export PKG_CONFIG_PATH=${{ env.SDL3_DIR }}/lib/pkgconfig
cmake/test/test_pkgconfig.sh cmake/test/test_pkgconfig.sh
- uses: actions/upload-artifact@v4 - uses: actions/upload-artifact@v4
if: ${{ matrix.platform.name == 'CMake' }} if: ${{ contains(matrix.platform.name, 'CMake') }}
with: with:
if-no-files-found: error if-no-files-found: error
name: ${{ matrix.platform.artifact }} name: ${{ matrix.platform.artifact }}
path: build/dist/SDL3* path: build/dist/SDL3*
- uses: actions/upload-artifact@v4 - uses: actions/upload-artifact@v4
if: ${{ matrix.platform.name == 'CMake' }} if: ${{ contains(matrix.platform.name, 'CMake') }}
with: with:
if-no-files-found: error if-no-files-found: error
name: ${{ matrix.platform.apk-artifact }} name: ${{ matrix.platform.apk-artifact }}

View File

@ -931,7 +931,12 @@ SDL_Renderer *SDL_CreateRendererWithProperties(SDL_PropertiesID props)
} }
if (surface) { if (surface) {
#if SDL_VIDEO_RENDER_SW
renderer = SW_CreateRendererForSurface(surface, props); renderer = SW_CreateRendererForSurface(surface, props);
#else
renderer = NULL;
SDL_SetError("SDL not built with software renderer");
#endif
if (!renderer) { if (!renderer) {
goto error; goto error;
} }

View File

@ -364,16 +364,21 @@ static int surface_testCompleteSurfaceConversion(void *arg)
for (i = 0; i < SDL_arraysize(pixel_formats); ++i) { for (i = 0; i < SDL_arraysize(pixel_formats); ++i) {
for (j = 0; j < SDL_arraysize(pixel_formats); ++j) { for (j = 0; j < SDL_arraysize(pixel_formats); ++j) {
fmt1 = SDL_CreatePixelFormat(pixel_formats[i]); fmt1 = SDL_CreatePixelFormat(pixel_formats[i]);
SDL_assert(fmt1 != NULL); SDLTest_AssertCheck(fmt1 != NULL, "SDL_CreatePixelFormat(%s[0x%08" SDL_PRIx32 "]) should return a non-null pixel format",
SDL_GetPixelFormatName(pixel_formats[i]), pixel_formats[i]);
cvt1 = SDL_ConvertSurface(face, fmt1); cvt1 = SDL_ConvertSurface(face, fmt1);
SDL_assert(cvt1 != NULL); SDLTest_AssertCheck(cvt1 != NULL, "SDL_ConvertSurface(..., %s[0x%08" SDL_PRIx32 "]) should return a non-null surface",
SDL_GetPixelFormatName(pixel_formats[i]), pixel_formats[i]);
fmt2 = SDL_CreatePixelFormat(pixel_formats[j]); fmt2 = SDL_CreatePixelFormat(pixel_formats[j]);
SDL_assert(fmt1 != NULL); SDLTest_AssertCheck(fmt2 != NULL, "SDL_CreatePixelFormat(%s[0x%08" SDL_PRIx32 "]) should return a non-null pixel format",
SDL_GetPixelFormatName(pixel_formats[i]), pixel_formats[i]);
cvt2 = SDL_ConvertSurface(cvt1, fmt2); cvt2 = SDL_ConvertSurface(cvt1, fmt2);
SDL_assert(cvt2 != NULL); SDLTest_AssertCheck(cvt2 != NULL, "SDL_ConvertSurface(..., %s[0x%08" SDL_PRIx32 "]) should return a non-null surface",
SDL_GetPixelFormatName(pixel_formats[i]), pixel_formats[i]);
if (fmt1->bytes_per_pixel == face->format->bytes_per_pixel && if (fmt1 && fmt2 &&
fmt1->bytes_per_pixel == face->format->bytes_per_pixel &&
fmt2->bytes_per_pixel == face->format->bytes_per_pixel && fmt2->bytes_per_pixel == face->format->bytes_per_pixel &&
(fmt1->Amask != 0) == (face->format->Amask != 0) && (fmt1->Amask != 0) == (face->format->Amask != 0) &&
(fmt2->Amask != 0) == (face->format->Amask != 0)) { (fmt2->Amask != 0) == (face->format->Amask != 0)) {