简体   繁体   English

CEF - 使用 MDd 构建测试

[英]CEF - Build tests with MDd

I'm currently trying to implement a software that is based on the Chromium Embedded Framework (CEF).我目前正在尝试实施基于 Chromium 嵌入式框架 (CEF) 的软件。

The platform I'm aiming at is windows and I'm using the latest version from the CEF Automated builds (as of the date of this post).我的目标平台是 windows,我使用的是 CEF 自动构建的最新版本(截至本文发布之日)。

Due to compatibility reasons with other projects, I need to specify the runtime library as /MDd and /MD for Debug and Release , respectively and decided to test-build the provided examples.由于与其他项目的兼容性原因,我需要为DebugRelease分别指定运行时库为/MDd/MD并决定测试构建提供的示例。 I've also used the make routines as indicated in the CEF guide.我还使用了 CEF 指南中指示的 make 例程。

To do so, I've changed the file cef_variables.cmake .为此,我更改了文件cef_variables.cmake In particular, I've changed the CEF_COMPILER_FLAGS_DEBUG and CEF_COMPILER_FLAGS_RELEASE to特别是,我已将CEF_COMPILER_FLAGS_DEBUGCEF_COMPILER_FLAGS_RELEASE更改为

list(APPEND CEF_COMPILER_FLAGS_DEBUG
     /MDd          # Multithreaded debug runtime
     /RTC1         # Disable optimizations
     /Od           # Enable basic run-time checks
)
list(APPEND CEF_COMPILER_FLAGS_RELEASE
     /MD           # Multithreaded release runtime
     /O2           # Optimize for maximum speed
     /Ob2          # Inline any suitable function
     /GF           # Enable string pooling
)

The default flags are /MTd and /MT .默认标志是/MTd/MT

When using the default flags there seems to be no issue and both the libcef_dll_wrapper and the cefclient projects compile just fine.使用默认标志时,似乎没有问题, libcef_dll_wrappercefclient项目都编译得很好。

However, when using the altered flags, I'm only able to build the libcef_dll_wrapper while building cefclient throws the following linker error但是,当使用更改的标志时,我只能构建libcef_dll_wrapper而构建cefclient会引发以下链接器错误

Severity    Code    Description Project File    Line    Suppression State
Error   LNK2038 mismatch detected for 'RuntimeLibrary': value 'MTd_StaticDebug' doesn't match value 'MDd_DynamicDebug' in binding_test.obj  cefclient   D:\Workspace\CEF\build\tests\cefclient\cef_sandbox.lib(at_exit.obj) 

The output from the cmake command is cmake 命令的输出是

-- The C compiler identification is MSVC 19.0.24215.1
-- The CXX compiler identification is MSVC 19.0.24215.1
-- Check for working C compiler: D:/Program Files (x86)/Microsoft Visual Studio                                                                                                                                                                                                14.0/VC/bin/cl.exe
-- Check for working C compiler: D:/Program Files (x86)/Microsoft Visual Studio                                                                                                                                                                                                14.0/VC/bin/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: D:/Program Files (x86)/Microsoft Visual Studi                                                                                                                                                                                               o 14.0/VC/bin/cl.exe
-- Check for working CXX compiler: D:/Program Files (x86)/Microsoft Visual Studi                                                                                                                                                                                               o 14.0/VC/bin/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- *** CEF CONFIGURATION SETTINGS ***
-- Generator:                    Visual Studio 14 2015
-- Platform:                     Windows
-- Project architecture:         x86
-- Binary distribution root:     D:/Workspace/CEF
-- CEF Windows sandbox:          ON
-- Visual Studio ATL support:    ON
-- Standard libraries:           comctl32.lib;rpcrt4.lib;shlwapi.lib;ws2_32.lib;                                                                                                                                                                                               dbghelp.lib;psapi.lib;version.lib;winmm.lib
-- Compile defines:              __STDC_CONSTANT_MACROS;__STDC_FORMAT_MACROS;WIN                                                                                                                                                                                               32;_WIN32;_WINDOWS;UNICODE;_UNICODE;WINVER=0x0601;_WIN32_WINNT=0x601;NOMINMAX;WI                                                                                                                                                                                               N32_LEAN_AND_MEAN;_HAS_EXCEPTIONS=0;PSAPI_VERSION=1;CEF_USE_SANDBOX;CEF_USE_ATL
-- Compile defines (Debug):
-- Compile defines (Release):    NDEBUG;_NDEBUG
-- C compile flags:              /MP;/Gy;/GR-;/W4;/WX;/wd4100;/wd4127;/wd4244;/w                                                                                                                                                                                               d4481;/wd4512;/wd4701;/wd4702;/wd4996;/Zi
-- C compile flags (Debug):      /MDd;/RTC1;/Od
-- C compile flags (Release):    /MD;/O2;/Ob2;/GF
-- C++ compile flags:            /MP;/Gy;/GR-;/W4;/WX;/wd4100;/wd4127;/wd4244;/w                                                                                                                                                                                               d4481;/wd4512;/wd4701;/wd4702;/wd4996;/Zi
-- C++ compile flags (Debug):    /MDd;/RTC1;/Od
-- C++ compile flags (Release):  /MD;/O2;/Ob2;/GF
-- Exe link flags:                /MANIFEST:NO;/LARGEADDRESSAWARE
-- Exe link flags (Debug):       /DEBUG
-- Exe link flags (Release):
-- Shared link flags:
-- Shared link flags (Debug):    /DEBUG
-- Shared link flags (Release):
-- CEF Binary files:             chrome_elf.dll;d3dcompiler_43.dll;d3dcompiler_4                                                                                                                                                                                               7.dll;libcef.dll;libEGL.dll;libGLESv2.dll;natives_blob.bin;snapshot_blob.bin
-- CEF Resource files:           cef.pak;cef_100_percent.pak;cef_200_percent.pak                                                                                                                                                                                               ;cef_extensions.pak;devtools_resources.pak;icudtl.dat;locales
-- Configuring done
-- Generating done
-- Build files have been written to: D:/Workspace/CEF/build

What am I missing here?我在这里缺少什么? I thought that if I altered the macro variables, all the projects would be built using the same settings and thus compile without errors.我认为如果我更改了宏变量,所有项目都将使用相同的设置构建,因此编译时不会出错。

I've continued researching and I've found that when using the automated builds, it uses the official cef_sandbox.lib , which uses the /MTd and /MT runtime.我继续研究,我发现在使用自动构建时,它使用官方的cef_sandbox.lib ,它使用/MTd/MT运行时。

My fix was to change the macro_variables and set USE_SANDBOX as OFF .我的解决方法是更改macro_variables并将USE_SANDBOX设置为OFF I've still have some errors but now the cefclient compile correctly我仍然有一些错误,但现在cefclient编译正确

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM