diff options
author | 2017-03-31 14:15:56 -0400 | |
---|---|---|
committer | 2017-04-03 13:54:42 +0000 | |
commit | b7bf09ccac26aac57f0ea36ceb36ace848999d48 (patch) | |
tree | f3271a0eb51a6e1dee5b4ed7f3192ffea8e008f3 /src | |
parent | e074b03677e5fe92660a23f25b328ed558b8e198 (diff) |
jumper, drop Android NDK dependency
We don't _really_ need the Android NDK. We just need <arm_neon.h>
(which comes from Clang, not the NDK) and a smattering of <stdint.h>
([u]intN_t), <string.h> (memcpy) and <stddef.h> (size_t).
The idea here is solely to make it easier to run build_stages.py.
If this becomes a pain to maintain, I'm happy to go back to the NDK.
Change-Id: Ic6bb287646b6160ac42ac6e4d5290a66a7e92425
Reviewed-on: https://skia-review.googlesource.com/10980
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Mike Klein <mtklein@chromium.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/jumper/SkJumper.h | 29 | ||||
-rw-r--r-- | src/jumper/SkJumper_stages.cpp | 1 | ||||
-rwxr-xr-x | src/jumper/build_stages.py | 10 |
3 files changed, 30 insertions, 10 deletions
diff --git a/src/jumper/SkJumper.h b/src/jumper/SkJumper.h index 712417a7de..5758d4eba2 100644 --- a/src/jumper/SkJumper.h +++ b/src/jumper/SkJumper.h @@ -12,7 +12,34 @@ // and SkJumper_stages.cpp (compiled into Skia _and_ offline into SkJumper_generated.h). // Keep it simple! -#include <stdint.h> +#if defined(JUMPER) && defined(__ANDROID__) + // To reduce SkJumper's dependency on the Android NDK, + // we provide what we need from <string.h>, <stdint.h>, and <stddef.h> ourselves. + #define memcpy __builtin_memcpy + + using int8_t = signed char; + using uint8_t = unsigned char; + using int16_t = signed short; + using uint16_t = unsigned short; + using int32_t = signed int; + using uint32_t = unsigned int; + #if defined(__aarch64__) + using int64_t = signed long; + using uint64_t = unsigned long; + using size_t = uint64_t; + #else + using int64_t = signed long long; + using uint64_t = unsigned long long; + using size_t = uint32_t; + #endif + + // Now pretend we've included <stdint.h> (or it'll be included again by <arm_neon.h>). + #define __CLANG_STDINT_H + #define _STDINT_H_ +#else + #include <string.h> + #include <stdint.h> +#endif // SkJumper_stages.cpp has some unusual constraints on what constants it can use. // diff --git a/src/jumper/SkJumper_stages.cpp b/src/jumper/SkJumper_stages.cpp index 6dddf9c744..455184f817 100644 --- a/src/jumper/SkJumper_stages.cpp +++ b/src/jumper/SkJumper_stages.cpp @@ -6,7 +6,6 @@ */ #include "SkJumper.h" -#include <string.h> #define SI static inline diff --git a/src/jumper/build_stages.py b/src/jumper/build_stages.py index 65234d9634..60d9c1d7ef 100755 --- a/src/jumper/build_stages.py +++ b/src/jumper/build_stages.py @@ -5,14 +5,12 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -import os import re import subprocess import sys clang = sys.argv[1] if len(sys.argv) > 1 else 'clang-4.0' -ndk = sys.argv[2] if len(sys.argv) > 2 else os.path.expanduser('~/ndk') -objdump = sys.argv[3] if len(sys.argv) > 3 else 'gobjdump' +objdump = sys.argv[2] if len(sys.argv) > 2 else 'gobjdump' clang = ['ccache', clang, '-x', 'c++'] @@ -53,17 +51,13 @@ subprocess.check_call(clang + cflags + hsw + win + ['-c', 'src/jumper/SkJumper_stages.cpp'] + ['-o', 'win_hsw.o']) -aarch64 = [ - '--target=aarch64-linux-android', - '--sysroot=' + ndk + '/platforms/android-21/arch-arm64', -] +aarch64 = [ '--target=aarch64-linux-android' ] subprocess.check_call(clang + cflags + aarch64 + ['-c', 'src/jumper/SkJumper_stages.cpp'] + ['-o', 'aarch64.o']) vfp4 = [ '--target=armv7a-linux-android', - '--sysroot=' + ndk + '/platforms/android-18/arch-arm', '-mfpu=neon-vfpv4', '-mfloat-abi=hard', ] |