chromium thirt_party skia编译shared_liberary


默认情况下,Android4.4 chromium webview使用的skia是系统的skia

  'conditions': [
    # In component mode (shared_lib), we build all of skia as a single DLL.
    # However, in the static mode, we need to build skia as multiple targets
    # in order to support the use case where a platform (e.g. Android) may
    # already have a copy of skia as a system library.
    ['component=="static_library" and use_system_skia==0', {
      'targets': [
        {
          'target_name': 'skia_library',
          'type': 'static_library',
          'includes': [
            'skia_library.gypi',
            'skia_common.gypi',
          ],
        },
      ],
    }],
    ['component=="static_library" and use_system_skia==1', {
      'targets': [
        {
          'target_name': 'skia_library',
          'type': 'none',
          'includes': ['skia_system.gypi'],
        },
      ],
    }],
    ['component=="static_library"', {
      'targets': [
        {
          'target_name': 'skia',
          'type': 'none',
          'dependencies': [
            'skia_library',
            'skia_chrome',
          ],
          'export_dependent_settings': [
            'skia_library',
            'skia_chrome',
          ],
        },
        {
          'target_name': 'skia_chrome',
          'type': 'static_library',
          'includes': [
            'skia_chrome.gypi',
            'skia_common.gypi',
          ],
        },
      ],
    },
    {  # component != static_library
      'targets': [
        {
          'target_name': 'skia',
          'type': 'shared_library',
          'includes': [
            'skia_library.gypi',
            'skia_chrome.gypi',
            'skia_common.gypi',
          ],
          'defines': [
            'SKIA_DLL',
            'GR_DLL=1',
            'GR_IMPLEMENTATION=1',
            'SKIA_IMPLEMENTATION=1',
          ],
          'direct_dependent_settings': {
            'defines': [
              'SKIA_DLL',
              'GR_DLL=1',
            ],
          },
        },
        {
          'target_name': 'skia_library',
          'type': 'none',
        },
        {
          'target_name': 'skia_chrome',
          'type': 'none',
        },
      ],
    }],
  ],


变量

use_system_skia

控制是否采用系统所带的skia,但如果因为升级或者移植,skia可能版本不一样,因此不如用chromium中自带的skia.

修改build/common.gypi中代码:

        'use_system_skia%': '<(android_webview_build)',

编译webview的话,默认使用系统的skia, 只要注释它 则会用thirt_party的skia.



另一个参数是component,也在build/common.gypi

'component%': 'static_library',

修改为shared_library则可。修改后,gyp之后,编译可能出现问题:

warning: shared library text segment is not shareable
error: treating warnings as errors

参考

1)http://gcc.gnu.org/onlinedocs/gcc-4.8.1/gcc/Code-Gen-Options.html#Code-Gen-Options
2)http://eli.thegreenplace.net/2011/11/03/position-independent-code-pic-in-shared-libraries/

  --warn-shared-textrel       Warn if text segment is not shareable
  --no-warn-shared-textrel    Do not warn if text segment is not shareable (default)


gyp生成mk文件时,在DEBUG和Rlease中都加入了warn-shared-textrel选项。

去掉则可。











评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值