android.mk: introduce SDL3_sve2 static library adding -armv8-a+sve2

This commit is contained in:
Anonymous Maarten 2026-05-27 18:55:22 +02:00
parent 6a3b0413dc
commit 853204a854
3 changed files with 51 additions and 35 deletions

View file

@ -1,5 +1,45 @@
LOCAL_PATH := $(call my-dir)
SDL_PRIVATE_CFLAGS := \
-DGL_GLEXT_PROTOTYPES \
-Wall -Wextra \
-Wmissing-prototypes \
-Wunreachable-code-break \
-Wunneeded-internal-declaration \
-Wmissing-variable-declarations \
-Wfloat-conversion \
-Wshorten-64-to-32 \
-Wunreachable-code-return \
-Wshift-sign-overflow \
-Wstrict-prototypes \
-Wkeyword-macro \
ifeq ($(TARGET_ARCH_ABI),arm64-v8a)
###########################
#
# SVE2 simd code (arm64-v8a only)
#
###########################
include $(CLEAR_VARS)
LOCAL_MODULE := SDL3_sve2
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include $(LOCAL_PATH)/include/build_config $(LOCAL_PATH)/src
LOCAL_SRC_FILES := \
$(wildcard $(LOCAL_PATH)/src/video/arm/*.c)
LOCAL_CFLAGS += \
$(SDL_PRIVATE_CFLAGS) \
-march=armv8-a+sve2 \
include $(BUILD_STATIC_LIBRARY)
endif
###########################
#
# SDL shared library
@ -84,22 +124,10 @@ LOCAL_SRC_FILES := \
$(wildcard $(LOCAL_PATH)/src/tray/*.c) \
$(wildcard $(LOCAL_PATH)/src/video/*.c) \
$(wildcard $(LOCAL_PATH)/src/video/android/*.c) \
$(wildcard $(LOCAL_PATH)/src/video/arm/*.c) \
$(wildcard $(LOCAL_PATH)/src/video/yuv2rgb/*.c))
LOCAL_CFLAGS += -DGL_GLEXT_PROTOTYPES
LOCAL_CFLAGS += \
-Wall -Wextra \
-Wmissing-prototypes \
-Wunreachable-code-break \
-Wunneeded-internal-declaration \
-Wmissing-variable-declarations \
-Wfloat-conversion \
-Wshorten-64-to-32 \
-Wunreachable-code-return \
-Wshift-sign-overflow \
-Wstrict-prototypes \
-Wkeyword-macro \
$(SDL_PRIVATE_CFLAGS) \
# Warnings we haven't fixed (yet)
LOCAL_CFLAGS += -Wno-unused-parameter -Wno-sign-compare
@ -114,6 +142,10 @@ ifeq ($(NDK_DEBUG),1)
cmd-strip :=
endif
ifeq ($(TARGET_ARCH_ABI),arm64-v8a)
LOCAL_STATIC_LIBRARIES += SDL3_sve2
endif
include $(BUILD_SHARED_LIBRARY)

View file

@ -22,30 +22,14 @@
/*
* IMPORTANT: Please do NOT include this header file directly or indirectly
* outside the src/video/arm folder.
*
*
*/
#if !defined(SDL_SVE2_EXTENSION_H) //&& (defined(__ARM_FEATURE_SVE2) && __ARM_FEATURE_SVE2)
#ifndef SDL_SVE2_EXTENSION_H
#define SDL_SVE2_EXTENSION_H
#include "SDL_sve2_util.h"
/*
* NOTE: Some Android builds didn't attach '-march=armv8-a+sve2' to
* SDL_sve2_*.c and hence the macro __ARM_FEATURE_SVE is not
* defined by the compiler. This might not be a problem as the
* SDL_TARGETING("arch=armv8-a+sve2") enables the feature for
* individual functions, until some version of compilers
* provides arm_sve.h raising errors then __ARM_FEATURE_SVE
* is not defined. Although it should be avoided, as a
* workaround, we have to define the __ARM_FEATURE_SVE here as
* an ugly hack.
*/
#ifdef SDL_PLATFORM_ANDROID
#ifndef __ARM_FEATURE_SVE
#define __ARM_FEATURE_SVE 1
#endif
#endif
#include <arm_sve.h>
#include <stdint.h>
@ -1197,4 +1181,4 @@ static inline svuint16_t sdl_sve_chn_blend_with_3masks_and_opacity(
return svlsr_n_u16_m(svptrue_b16(), vTarget, 8); // vTarget >> 8;
}
#endif /* SDL_SVE2_EXTENSION_H */
#endif /* SDL_SVE2_EXTENSION_H */

View file

@ -22,10 +22,10 @@
/*
* IMPORTANT: Please do NOT include this header file directly or indirectly
* outside the src/video/arm folder.
*
*
*/
#if !defined(SD_SVE2_SWIZZLE_H) //&& (defined(__ARM_FEATURE_SVE2) && __ARM_FEATURE_SVE2)
#ifndef SD_SVE2_SWIZZLE_H
#define SD_SVE2_SWIZZLE_H
#include "SDL_sve2_extension.h"
@ -2378,4 +2378,4 @@ static inline void sdl_sve_rgb32_to_rgb565_swizzle_dispatcher(SDL_BlitInfo *info
}
}
#endif /* SD_SVE2_SWIZZLE_H */
#endif /* SD_SVE2_SWIZZLE_H */