mirror of
https://github.com/webmproject/libwebp.git
synced 2024-12-27 06:08:21 +01:00
fix Android standalone toolchain build
add a check for cpu-features.h and rework some of the ifdef's around
android + neon. for android builds with cpu-features enabled the
*_neon.c files will still need to be flagged correctly (with e.g.,
.c.neon in Android.mk) to properly build them.
BUG=webp:353
Change-Id: I905ce305af0a204e560b915d8665093a3edaceb9
(cherry picked from commit c6d1db4b36
)
This commit is contained in:
parent
6fcc3a720d
commit
0e8c3004be
@ -25,6 +25,7 @@ ifneq ($(findstring armeabi-v7a, $(TARGET_ARCH_ABI)),)
|
|||||||
# specifically.
|
# specifically.
|
||||||
NEON := c.neon
|
NEON := c.neon
|
||||||
USE_CPUFEATURES := yes
|
USE_CPUFEATURES := yes
|
||||||
|
WEBP_CFLAGS += -DHAVE_CPU_FEATURES_H
|
||||||
else
|
else
|
||||||
NEON := c
|
NEON := c
|
||||||
endif
|
endif
|
||||||
|
@ -54,6 +54,7 @@ if(ANDROID)
|
|||||||
set(WEBP_DEP_INCLUDE_DIRS ${WEBP_DEP_INCLUDE_DIRS}
|
set(WEBP_DEP_INCLUDE_DIRS ${WEBP_DEP_INCLUDE_DIRS}
|
||||||
${ANDROID_NDK}/sources/android/cpufeatures
|
${ANDROID_NDK}/sources/android/cpufeatures
|
||||||
)
|
)
|
||||||
|
add_definitions(-DHAVE_CPU_FEATURES_H)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
|
@ -84,6 +84,7 @@ model {
|
|||||||
// Check for NEON usage.
|
// Check for NEON usage.
|
||||||
if (getTargetPlatform() == "arm" || getTargetPlatform() == "arm64") {
|
if (getTargetPlatform() == "arm" || getTargetPlatform() == "arm64") {
|
||||||
NEON = "c.neon"
|
NEON = "c.neon"
|
||||||
|
cCompiler.define "HAVE_CPU_FEATURES_H"
|
||||||
} else {
|
} else {
|
||||||
NEON = "c"
|
NEON = "c"
|
||||||
}
|
}
|
||||||
|
@ -243,6 +243,10 @@ AS_IF([test "x$enable_neon" != "xno"], [
|
|||||||
NEON_FLAGS=""],
|
NEON_FLAGS=""],
|
||||||
[AC_DEFINE(WEBP_HAVE_NEON_RTCD, [1],
|
[AC_DEFINE(WEBP_HAVE_NEON_RTCD, [1],
|
||||||
[Set to 1 if runtime detection of NEON is enabled])])])
|
[Set to 1 if runtime detection of NEON is enabled])])])
|
||||||
|
|
||||||
|
case "$host_os" in
|
||||||
|
*android*) AC_CHECK_HEADERS([cpu-features.h]) ;;
|
||||||
|
esac
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
AC_SUBST([NEON_FLAGS])])
|
AC_SUBST([NEON_FLAGS])])
|
||||||
|
@ -72,18 +72,20 @@ extern "C" {
|
|||||||
#define WEBP_USE_AVX2
|
#define WEBP_USE_AVX2
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__ANDROID__) && defined(__ARM_ARCH_7A__)
|
|
||||||
#define WEBP_ANDROID_NEON // Android targets that might support NEON
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// The intrinsics currently cause compiler errors with arm-nacl-gcc and the
|
// The intrinsics currently cause compiler errors with arm-nacl-gcc and the
|
||||||
// inline assembly would need to be modified for use with Native Client.
|
// inline assembly would need to be modified for use with Native Client.
|
||||||
#if (defined(__ARM_NEON__) || defined(WEBP_ANDROID_NEON) || \
|
#if (defined(__ARM_NEON__) || \
|
||||||
defined(__aarch64__) || defined(WEBP_HAVE_NEON)) && \
|
defined(__aarch64__) || defined(WEBP_HAVE_NEON)) && \
|
||||||
!defined(__native_client__)
|
!defined(__native_client__)
|
||||||
#define WEBP_USE_NEON
|
#define WEBP_USE_NEON
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if !defined(WEBP_USE_NEON) && defined(__ANDROID__) && \
|
||||||
|
defined(__ARM_ARCH_7A__) && defined(HAVE_CPU_FEATURES_H)
|
||||||
|
#define WEBP_ANDROID_NEON // Android targets that may have NEON
|
||||||
|
#define WEBP_USE_NEON
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(_MSC_VER) && _MSC_VER >= 1700 && defined(_M_ARM)
|
#if defined(_MSC_VER) && _MSC_VER >= 1700 && defined(_M_ARM)
|
||||||
#define WEBP_USE_NEON
|
#define WEBP_USE_NEON
|
||||||
#define WEBP_USE_INTRINSICS
|
#define WEBP_USE_INTRINSICS
|
||||||
|
Loading…
Reference in New Issue
Block a user