cef中v8编译成动态库

目的

cef是chrome引擎的开原版本,里面的v8会被编译到libcef.dll,无法单独使用, 如果将cef中的v8单独编译成dll文件就可以和nodeJS结合,编译成类似node-webkit 的东东

原理

cef的构建编译使用的是gyp和ninja,其中gyp负责生成ninja,ninja负责编译

修改v8项目下面的v8.gyp

添加component变量到v8.gyp文件中的variables就可以了

{
  'variables': {
    'icu_use_data_file_flag%': 0,
    'v8_code': 1,
    'v8_random_seed%': 314159265,
    'v8_vector_stores%': 0,
    'component':'shared_library',#设置component为动态库
    'embed_script%': "",
    'v8_extra_library_files%': [],
    'v8_experimental_extra_library_files%': [],

重新生成ninja文件

重新运行cef项目下的cef_create_projects.bat 然后重新打开cef.sln 编译即可