コード例 #1
0
ファイル: gn_to_bp.py プロジェクト: bbernhar/skia
def write_android_config(config_path, defines):
  gn_to_bp_utils.WriteUserConfig(config_path, defines)
  append_to_file(config_path, '''
#ifndef SK_BUILD_FOR_ANDROID
    #error "SK_BUILD_FOR_ANDROID must be defined!"
#endif''')
  disallow_platforms(config_path, 'ANDROID')
コード例 #2
0
def write_config(config_path, defines, platform):
  gn_to_bp_utils.WriteUserConfig(config_path, defines)
  append_to_file(config_path, '''
// Correct SK_BUILD_FOR flags that may have been set by
// SkTypes.h/Android.bp
#ifndef SK_BUILD_FOR_%s
    #define SK_BUILD_FOR_%s
#endif
#ifdef SK_BUILD_FOR_ANDROID
    #undef SK_BUILD_FOR_ANDROID
#endif''' % (platform, platform))
  disallow_platforms(config_path, platform)
コード例 #3
0
defs = gn_to_bp_utils.GetArchSources(os.path.join(skia_gn_dir, 'opts.gni'))

# Add source file until fix lands in
# https://skia-review.googlesource.com/c/skia/+/101820
srcs.add("src/ports/SkFontMgr_empty_factory.cpp")


# Turn a list of strings into the style bpfmt outputs.
def bpfmt(indent, lst, sort=True):
    if sort:
        lst = sorted(lst)
    return ('\n' + ' ' * indent).join('"%s",' % v for v in lst)


# Most defines go into SkUserConfig.h, where they're seen by Skia and its users.
gn_to_bp_utils.WriteUserConfig('include/config/SkUserConfig.h', defines)

# OK!  We have everything to fill in Android.bp...
with open('Android.bp', 'w') as f:
    print >> f, bp.substitute({
        'local_includes':
        bpfmt(8, local_includes),
        'srcs':
        bpfmt(8, srcs),
        'cflags':
        bpfmt(8, cflags, False),
        'cflags_cc':
        bpfmt(8, cflags_cc),
        'arm_srcs':
        bpfmt(16, defs['armv7']),
        'arm_neon_srcs':
コード例 #4
0
    for i in range(len(p)):
      s = s + 'defined(SK_BUILD_FOR_%s)' % p[i]
      if i < len(p) - 1:
        s += ' || '
        if i % 2 == 1:
          s += '\\\n    '
    print(s, file=f)
    print('    #error "Only SK_BUILD_FOR_%s should be defined!"' % desired, file=f)
    print('#endif', file=f)

def append_to_file(config, s):
  with open(config, 'a') as f:
    print(s, file=f)

android_config = 'android/include/config/SkUserConfig.h'
gn_to_bp_utils.WriteUserConfig(android_config, android_defines)
append_to_file(android_config, '''
#ifndef SK_BUILD_FOR_ANDROID
    #error "SK_BUILD_FOR_ANDROID must be defined!"
#endif''')
disallow_platforms(android_config, 'ANDROID')

def write_config(config_path, defines, platform):
  gn_to_bp_utils.WriteUserConfig(config_path, defines)
  append_to_file(config_path, '''
// Correct SK_BUILD_FOR flags that may have been set by
// SkTypes.h/Android.bp
#ifndef SK_BUILD_FOR_%s
    #define SK_BUILD_FOR_%s
#endif
#ifdef SK_BUILD_FOR_ANDROID