From: Mike Klein Date: Fri, 31 Mar 2017 18:15:56 +0000 (-0400) Subject: jumper, drop Android NDK dependency X-Git-Tag: accepted/tizen/5.0/unified/20181102.025319~46^2~202 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b7bf09ccac26aac57f0ea36ceb36ace848999d48;p=platform%2Fupstream%2FlibSkiaSharp.git jumper, drop Android NDK dependency We don't _really_ need the Android NDK. We just need (which comes from Clang, not the NDK) and a smattering of ([u]intN_t), (memcpy) and (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 Commit-Queue: Mike Klein --- diff --git a/src/jumper/SkJumper.h b/src/jumper/SkJumper.h index 712417a..5758d4e 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 +#if defined(JUMPER) && defined(__ANDROID__) + // To reduce SkJumper's dependency on the Android NDK, + // we provide what we need from , , and 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 (or it'll be included again by ). + #define __CLANG_STDINT_H + #define _STDINT_H_ +#else + #include + #include +#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 6dddf9c..455184f 100644 --- a/src/jumper/SkJumper_stages.cpp +++ b/src/jumper/SkJumper_stages.cpp @@ -6,7 +6,6 @@ */ #include "SkJumper.h" -#include #define SI static inline diff --git a/src/jumper/build_stages.py b/src/jumper/build_stages.py index 65234d9..60d9c1d 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', ]