Clean Android build defaults
Disable unit-tests. The logging in GTest would need to be adjusted. Restructure ARM cpu detection. Flatten if-else logic. Change #if defined(HAVE_*) to #if HAVE_* because we only need to check for features that the library was actually built with. This should have been harmless, as disabled feature sets wouldn't have any features to call. Change-Id: Iea21aa42ce5f049c53ca0376d25bcd0f36f38284
This commit is contained in:
parent
5daaa838a6
commit
d6e80deb32
11
configure
vendored
11
configure
vendored
@ -588,13 +588,18 @@ process_toolchain() {
|
||||
fi
|
||||
|
||||
# Enable unit tests if we have a working C++ compiler
|
||||
case "$tgt_cc" in
|
||||
vs*)
|
||||
soft_enable unit_tests;;
|
||||
case "$toolchain" in
|
||||
*-vs*)
|
||||
soft_enable unit_tests
|
||||
;;
|
||||
*-android-*)
|
||||
# GTestLog must be modified to use Android logging utilities.
|
||||
;;
|
||||
*)
|
||||
check_cxx "$@" <<EOF && soft_enable unit_tests
|
||||
int z;
|
||||
EOF
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
|
@ -36,6 +36,9 @@ static int arm_cpu_env_mask(void)
|
||||
|
||||
int arm_cpu_caps(void)
|
||||
{
|
||||
/* This function should actually be a no-op. There is no way to adjust any of
|
||||
* these because the RTCD tables do not exist: the functions are called
|
||||
* statically */
|
||||
int flags;
|
||||
int mask;
|
||||
if (!arm_cpu_env_flags(&flags))
|
||||
@ -43,19 +46,19 @@ int arm_cpu_caps(void)
|
||||
return flags;
|
||||
}
|
||||
mask = arm_cpu_env_mask();
|
||||
#if defined(HAVE_EDSP)
|
||||
#if HAVE_EDSP
|
||||
flags |= HAS_EDSP;
|
||||
#endif
|
||||
#if defined(HAVE_MEDIA)
|
||||
#endif /* HAVE_EDSP */
|
||||
#if HAVE_MEDIA
|
||||
flags |= HAS_MEDIA;
|
||||
#endif
|
||||
#if defined(HAVE_NEON)
|
||||
#endif /* HAVE_MEDIA */
|
||||
#if HAVE_NEON
|
||||
flags |= HAS_NEON;
|
||||
#endif
|
||||
#endif /* HAVE_NEON */
|
||||
return flags & mask;
|
||||
}
|
||||
|
||||
#elif defined(_MSC_VER)
|
||||
#elif defined(_MSC_VER) /* end !CONFIG_RUNTIME_CPU_DETECT */
|
||||
/*For GetExceptionCode() and EXCEPTION_ILLEGAL_INSTRUCTION.*/
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_EXTRA_LEAN
|
||||
@ -74,7 +77,7 @@ int arm_cpu_caps(void)
|
||||
* instructions via their assembled hex code.
|
||||
* All of these instructions should be essentially nops.
|
||||
*/
|
||||
#if defined(HAVE_EDSP)
|
||||
#if HAVE_EDSP
|
||||
if (mask & HAS_EDSP)
|
||||
{
|
||||
__try
|
||||
@ -88,7 +91,7 @@ int arm_cpu_caps(void)
|
||||
/*Ignore exception.*/
|
||||
}
|
||||
}
|
||||
#if defined(HAVE_MEDIA)
|
||||
#if HAVE_MEDIA
|
||||
if (mask & HAS_MEDIA)
|
||||
__try
|
||||
{
|
||||
@ -101,7 +104,7 @@ int arm_cpu_caps(void)
|
||||
/*Ignore exception.*/
|
||||
}
|
||||
}
|
||||
#if defined(HAVE_NEON)
|
||||
#if HAVE_NEON
|
||||
if (mask & HAS_NEON)
|
||||
{
|
||||
__try
|
||||
@ -115,14 +118,13 @@ int arm_cpu_caps(void)
|
||||
/*Ignore exception.*/
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif /* HAVE_NEON */
|
||||
#endif /* HAVE_MEDIA */
|
||||
#endif /* HAVE_EDSP */
|
||||
return flags & mask;
|
||||
}
|
||||
|
||||
#elif defined(__linux__)
|
||||
#if defined(__ANDROID__)
|
||||
#elif defined(__ANDROID__) /* end _MSC_VER */
|
||||
#include <cpu-features.h>
|
||||
|
||||
int arm_cpu_caps(void)
|
||||
@ -137,19 +139,20 @@ int arm_cpu_caps(void)
|
||||
mask = arm_cpu_env_mask();
|
||||
features = android_getCpuFeatures();
|
||||
|
||||
#if defined(HAVE_EDSP)
|
||||
#if HAVE_EDSP
|
||||
flags |= HAS_EDSP;
|
||||
#endif
|
||||
#if defined(HAVE_MEDIA)
|
||||
#endif /* HAVE_EDSP */
|
||||
#if HAVE_MEDIA
|
||||
flags |= HAS_MEDIA;
|
||||
#endif
|
||||
#if defined(HAVE_NEON)
|
||||
#endif /* HAVE_MEDIA */
|
||||
#if HAVE_NEON
|
||||
if (features & ANDROID_CPU_ARM_FEATURE_NEON)
|
||||
flags |= HAS_NEON;
|
||||
#endif
|
||||
#endif /* HAVE_NEON */
|
||||
return flags & mask;
|
||||
}
|
||||
#else // !defined(__ANDROID__)
|
||||
|
||||
#elif defined(__linux__) /* end __ANDROID__ */
|
||||
#include <stdio.h>
|
||||
|
||||
int arm_cpu_caps(void)
|
||||
@ -175,27 +178,27 @@ int arm_cpu_caps(void)
|
||||
char buf[512];
|
||||
while (fgets(buf, 511, fin) != NULL)
|
||||
{
|
||||
#if defined(HAVE_EDSP) || defined(HAVE_NEON)
|
||||
#if HAVE_EDSP || HAVE_NEON
|
||||
if (memcmp(buf, "Features", 8) == 0)
|
||||
{
|
||||
char *p;
|
||||
#if defined(HAVE_EDSP)
|
||||
#if HAVE_EDSP
|
||||
p=strstr(buf, " edsp");
|
||||
if (p != NULL && (p[5] == ' ' || p[5] == '\n'))
|
||||
{
|
||||
flags |= HAS_EDSP;
|
||||
}
|
||||
#if defined(HAVE_NEON)
|
||||
#if HAVE_NEON
|
||||
p = strstr(buf, " neon");
|
||||
if (p != NULL && (p[5] == ' ' || p[5] == '\n'))
|
||||
{
|
||||
flags |= HAS_NEON;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
#endif /* HAVE_NEON */
|
||||
#endif /* HAVE_EDSP */
|
||||
}
|
||||
#endif
|
||||
#if defined(HAVE_MEDIA)
|
||||
#endif /* HAVE_EDSP || HAVE_NEON */
|
||||
#if HAVE_MEDIA
|
||||
if (memcmp(buf, "CPU architecture:",17) == 0){
|
||||
int version;
|
||||
version = atoi(buf+17);
|
||||
@ -204,14 +207,13 @@ int arm_cpu_caps(void)
|
||||
flags |= HAS_MEDIA;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif /* HAVE_MEDIA */
|
||||
}
|
||||
fclose(fin);
|
||||
}
|
||||
return flags & mask;
|
||||
}
|
||||
#endif // defined(__linux__)
|
||||
#else
|
||||
#else /* end __linux__ */
|
||||
#error "--enable-runtime-cpu-detect selected, but no CPU detection method " \
|
||||
"available for your platform. Reconfigure with --disable-runtime-cpu-detect."
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user