# MinGW5_3_0_32-CEF-Compiled-Experience **Repository Path**: czzcreator/MinGW5_3_0_32-CEF-Compiled-Experience ## Basic Information - **Project Name**: MinGW5_3_0_32-CEF-Compiled-Experience - **Description**: 编译 google CEF in QtCreator5.9.8 Mingw5.3.0_32 - **Primary Language**: C++ - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2020-04-26 - **Last Updated**: 2022-03-28 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # MinGW5_3_0_32 CEF Compiled Experience 使用 mingw 编译 CEF 在 QtCreator5.9.8 环境下 Chromium Embedded Framework (CEF) Standard Binary Distribution for Windows ------------------------------------------------------------------------------- Date: March 10, 2020 CEF Version: 80.0.8+gf96cd1d+chromium-80.0.3987.132 CEF URL: https://bitbucket.org/chromiumembedded/cef.git @f96cd1de5e61c7ace2d8ccce2335f51bec8f654f Chromium Version: 80.0.3987.132 Chromium URL: https://chromium.googlesource.com/chromium/src.git @aef8d0d95ba78d006e1ee65dff907bd824c7389b This distribution contains all components necessary to build and distribute an application using CEF on the Windows platform. Please see the LICENSING section of this document for licensing terms and conditions. CONTENTS -------- cmake Contains CMake configuration files shared by all targets. Debug Contains libcef.dll, libcef.lib and other components required to build and run the debug version of CEF-based applications. By default these files should be placed in the same directory as the executable and will be copied there as part of the build process. include Contains all required CEF header files. libcef_dll Contains the source code for the libcef_dll_wrapper static library that all applications using the CEF C++ API must link against. Release Contains libcef.dll, libcef.lib and other components required to build and run the release version of CEF-based applications. By default these files should be placed in the same directory as the executable and will be copied there as part of the build process. Resources Contains resources required by libcef.dll. By default these files should be placed in the same directory as libcef.dll and will be copied there as part of the build process. tests/ Directory of tests that demonstrate CEF usage. cefclient Contains the cefclient sample application configured to build using the files in this distribution. This application demonstrates a wide range of CEF functionalities. cefsimple Contains the cefsimple sample application configured to build using the files in this distribution. This application demonstrates the minimal functionality required to create a browser window. ceftests Contains unit tests that exercise the CEF APIs. gtest Contains the Google C++ Testing Framework used by the ceftests target. shared Contains source code shared by the cefclient and ceftests targets. USAGE ----- Building using CMake: CMake can be used to generate project files in many different formats. See usage instructions at the top of the CMakeLists.txt file. Please visit the CEF Website for additional usage information. https://bitbucket.org/chromiumembedded/cef/ REDISTRIBUTION -------------- This binary distribution contains the below components. Required components: The following components are required. CEF will not function without them. * CEF core library. * libcef.dll * Crash reporting library. * chrome_elf.dll * Unicode support data. * icudtl.dat * V8 snapshot data. * snapshot_blob.bin * v8_context_snapshot.bin Optional components: The following components are optional. If they are missing CEF will continue to run but any related functionality may become broken or disabled. * Localized resources. Locale file loading can be disabled completely using CefSettings.pack_loading_disabled. The locales directory path can be customized using CefSettings.locales_dir_path. * locales/ Directory containing localized resources used by CEF, Chromium and Blink. A .pak file is loaded from this directory based on the CefSettings.locale value. Only configured locales need to be distributed. If no locale is configured the default locale of "en-US" will be used. Without these files arbitrary Web components may display incorrectly. * Other resources. Pack file loading can be disabled completely using CefSettings.pack_loading_disabled. The resources directory path can be customized using CefSettings.resources_dir_path. * cef.pak * cef_100_percent.pak * cef_200_percent.pak These files contain non-localized resources used by CEF, Chromium and Blink. Without these files arbitrary Web components may display incorrectly. * cef_extensions.pak This file contains non-localized resources required for extension loading. Pass the `--disable-extensions` command-line flag to disable use of this file. Without this file components that depend on the extension system, such as the PDF viewer, will not function. * devtools_resources.pak This file contains non-localized resources required for Chrome Developer Tools. Without this file Chrome Developer Tools will not function. * Angle and Direct3D support. * d3dcompiler_47.dll (required for Windows Vista and newer) * libEGL.dll * libGLESv2.dll Without these files HTML5 accelerated content like 2D canvas, 3D CSS and WebGL will not function. * SwiftShader support. * swiftshader/libEGL.dll * swiftshader/libGLESv2.dll Without these files WebGL will not function in software-only mode when the GPU is not available or disabled. LICENSING --------- The CEF project is BSD licensed. Please read the LICENSE.txt file included with this binary distribution for licensing terms and conditions. Other software included in this distribution is provided under other licenses. Please visit "about:credits" in a CEF-based application for complete Chromium and third-party licensing information. /*****************************************************************************/ 我的尝试: 关于 CEF 的介绍 可以查看 本篇博客 https://www.cnblogs.com/lyj00912/p/11385654.html 关于编译过程 我参考了 github 这位帅哥的做法 万分感谢 https://github.com/GreatTux/CefMinGWQt 下面是 czz 具体通过修改 顶层 CMakeLists.txt 文件 以及各个子目录 CMakeLists.txt 等文件 以期通过 编译 生成一套 Qt5.9.8(MinGW5.3.0_32位 ) 编译通过的 CEF 静态库 以及 根目录./tests 目录下 示例工程编译通过 学习如何使用 CEF 所有的编译基于 google 的 cef_binary_80.0.8+gf96cd1d+chromium-80.0.3987.132_windows32.tar.bz2 这个版本的 CEF--------------Windows 32-bit Builds(官方已经编好的二进制库) http://opensource.spotify.com/cefbuilds/index.html#windows32_builds CMakeList.txt 文件的编译执行 利用了 Qt5.9.8(MinGW5.3.0_32位 )命令行终端 (一步步调试)看cmake文件哪里错误 然后修改 具体执行过程如下: 1、Create a build directory (名为 buildDir_czz) (为了第二部 编译通过 修改了 top level 层的CMakeLists.txt cmake文件夹下的 cmake\cef_variables.cmake) 2、Run cmake from your build directory pointing to the repository root CMakeLists.txt(修改过), ie cmake -G"MinGW Makefiles" .. (注意不要漏了 2点 表示上级目录 使用MinGW 编译系统) 第二步骤通过以后 我发现直接用命令行的方式编译 太痛苦 所以就结合 QtCreator 4.8.2 内部融合的cmake 在IDE中进行编译 修改内容如下 --> (编译成功) 1、 cef_binary_windows32\include\base\internal 下加入文件 cef_atomicops_x86_gcc.h 2、 cef_binary_windows32\include\internal\cef_string_wrappers.h 添加头文件 #include #tests\cefclient demo cmake例子编译 (未成功 MinGW5.3.0_32位环境下 中提示 osr_d3d11_win.cc:25: error: directxmath.h: No such file or directory) # mingw 下找不到 directx 相关库。。。。。 没找到解决办法 以后有空再研究 3、 cef_binary_windows32\tests\cefclient\cefclient_win.cc (测试例子中 ) 修改了 入口函数 wWinMain(注释 改为 main) 4、 cef_binary_windows32\tests\cefclient\browser\main_message_loop_multithreaded_win.cc const char kWndClass[] = "Client_MessageWindow"; const char kTaskMessageName[] = "Client_CustomTask"; 原本是 wchar_t 类型 转为 char #吸取了之前 编译 cefclient 的教训,将源代码转移到 QtCreator4.8.0 MinGW5.3.0_32位 环境下去编译 # 参考我 创建的 demo 工程 根目录下 的 Test_simpleCef # 拷贝 tests\cefsimple 下源码到 QtCreator 新建立的 QWidget工程中 pro 内容见我的 工程实例 修改如下(这里我只编译release 版本) (编译成功) # 注意观察下 5、 cef_binary_windows32\tests\cefsimple\cefsimple_win.cc (测试例子中 ) 修改了 入口函数 wWinMain(注释 改为 main) 6、 cef_binary_windows32\tests\cefsimple\simple_handler_win.cc ----- SetWindowText(hwnd, std::string(title).c_str()); //wstring 变成 string modified by czz 2020-04-09 7、 cef_binary_windows32\tests\cefsimple\simple_app.cc -----line 110 url = "http://www.baidu.com"; //原先是连接的 www.google.com 肯定连不上 手动改成 百度 测试 发布所需要的文件 以及各个文件含义 请自行参见 上面的英文说明 CONTENTS -------- USAGE ----- REDISTRIBUTION --------------