Merge branch 'cef-docs'

CEF-related documentation and build improvements.

See #24230.
This commit is contained in:
Vadim Zeitlin 2024-01-24 17:44:01 +01:00
commit 5e1890c068
5 changed files with 62 additions and 12 deletions

View file

@ -510,11 +510,46 @@ if(wxUSE_GUI)
message(WARNING "WebviewChromium libcef_dll_wrapper can only be built with MSVC... disabled")
wx_option_force_value(wxUSE_WEBVIEW_CHROMIUM OFF)
endif()
if(wxUSE_WEBVIEW_CHROMIUM AND CMAKE_CXX_STANDARD LESS 14)
# We shouldn't disable this option as it's disabled by default and
# if it is on, it means that CEF is meant to be used, but we can't
# continue neither as libcef_dll_wrapper will fail to build.
message(FATAL_ERROR "WebviewChromium requires at least C++14 but configured to use C++${CMAKE_CXX_STANDARD}")
if(wxUSE_WEBVIEW_CHROMIUM)
# Check for C++17 support as it's required by CEF: we trust
# CMAKE_CXX_STANDARD if it is defined, but we need to compile a
# test program if it is not because the compiler could be
# supporting C++17 anyway.
if (DEFINED CMAKE_CXX_STANDARD)
if (CMAKE_CXX_STANDARD GREATER_EQUAL 17)
set(wxHAVE_CXX17 ON)
endif()
else()
check_cxx_source_compiles("
#if defined(_MSVC_LANG)
#if _MSVC_LANG < 201703L
#error C++17 support is required
#endif
#elif __cplusplus < 201703L
#error C++17 support is required
#endif
int main() {
[[maybe_unused]] auto unused = 17;
}"
wxHAVE_CXX17)
endif()
if (NOT wxHAVE_CXX17)
# We shouldn't disable this option as it's disabled by default and
# if it is on, it means that CEF is meant to be used, but we can't
# continue neither as libcef_dll_wrapper will fail to build
# (actually it may still succeed with CEF v116 which provided
# its own stand-in for std::in_place used in CEF headers, but
# not with the later versions, so just fail instead of trying
# to detect CEF version here, as even v116 officially only
# supports C++17 anyhow).
if (DEFINED CMAKE_CXX_STANDARD)
set(cxx17_error_details "configured to use C++${CMAKE_CXX_STANDARD}")
else()
set(cxx17_error_details "the compiler doesn't support C++17 by default and CMAKE_CXX_STANDARD is not set")
endif()
message(FATAL_ERROR "WebviewChromium requires at least C++17 but ${cxx17_error_details}")
endif()
endif()
endif()

View file

@ -59,7 +59,6 @@ set(USE_SANDBOX OFF) # Disable usage of sandbox on windows
add_subdirectory(${CEF_ROOT} ${CEF_BUILD_DIR} EXCLUDE_FROM_ALL)
set_target_properties(libcef_dll_wrapper PROPERTIES
FOLDER "Third Party Libraries"
COMPILE_FLAGS "-Wno-extra"
OUTPUT_NAME "libcef_dll_wrapper"
)
@ -68,6 +67,8 @@ if(MSVC)
get_target_property(cef_compile_options libcef_dll_wrapper COMPILE_OPTIONS)
string(REGEX REPLACE "/MTd?;" "" cef_compile_options "${cef_compile_options}")
set_target_properties(libcef_dll_wrapper PROPERTIES COMPILE_OPTIONS "${cef_compile_options}")
else()
set_target_properties(libcef_dll_wrapper PROPERTIES COMPILE_OPTIONS "-Wno-extra")
endif()
add_library(libcef SHARED IMPORTED GLOBAL)

View file

@ -613,7 +613,8 @@ check_type_size(ssize_t SSIZE_T)
test_big_endian(WORDS_BIGENDIAN)
if(wxUSE_WEBVIEW_CHROMIUM)
# For generators using build type, ensure that wxHAVE_CEF_DEBUG matches it.
if(wxUSE_WEBVIEW_CHROMIUM AND DEFINED CMAKE_BUILD_TYPE)
string(TOUPPER ${CMAKE_BUILD_TYPE} build_type)
if(${build_type} STREQUAL DEBUG)
set(wxHAVE_CEF_DEBUG ON)

View file

@ -152,6 +152,7 @@
<WarningLevel>Level4</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>_DEBUG;_CRT_SECURE_NO_DEPRECATE=1;_CRT_NON_CONFORMING_SWPRINTFS=1;_SCL_SECURE_NO_WARNINGS=1;__WXMSW__;_UNICODE;WXBUILDING;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@ -187,6 +188,7 @@
<WarningLevel>Level4</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>_DEBUG;_CRT_SECURE_NO_DEPRECATE=1;_CRT_NON_CONFORMING_SWPRINTFS=1;_SCL_SECURE_NO_WARNINGS=1;__WXMSW__;_UNICODE;WXBUILDING;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@ -225,6 +227,7 @@
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<StringPooling>true</StringPooling>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE=1;_CRT_NON_CONFORMING_SWPRINTFS=1;_SCL_SECURE_NO_WARNINGS=1;__WXMSW__;NDEBUG;_UNICODE;WXBUILDING;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@ -262,6 +265,7 @@
<IntrinsicFunctions>true</IntrinsicFunctions>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE=1;_CRT_NON_CONFORMING_SWPRINTFS=1;_SCL_SECURE_NO_WARNINGS=1;__WXMSW__;NDEBUG;_UNICODE;WXBUILDING;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@ -298,6 +302,7 @@
<WarningLevel>Level4</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>_DEBUG;_CRT_SECURE_NO_DEPRECATE=1;_CRT_NON_CONFORMING_SWPRINTFS=1;_SCL_SECURE_NO_WARNINGS=1;__WXMSW__;_UNICODE;WXBUILDING;WXDLLNAME=$(TargetName);WXUSINGDLL;WXMAKINGDLL_WEBVIEW;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@ -339,6 +344,7 @@
<WarningLevel>Level4</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>_DEBUG;_CRT_SECURE_NO_DEPRECATE=1;_CRT_NON_CONFORMING_SWPRINTFS=1;_SCL_SECURE_NO_WARNINGS=1;__WXMSW__;_UNICODE;WXBUILDING;WXDLLNAME=$(TargetName);WXUSINGDLL;WXMAKINGDLL_WEBVIEW;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@ -380,6 +386,7 @@
<IntrinsicFunctions>true</IntrinsicFunctions>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE=1;_CRT_NON_CONFORMING_SWPRINTFS=1;_SCL_SECURE_NO_WARNINGS=1;__WXMSW__;NDEBUG;_UNICODE;WXBUILDING;WXDLLNAME=$(TargetName);WXUSINGDLL;WXMAKINGDLL_WEBVIEW;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@ -424,6 +431,7 @@
<IntrinsicFunctions>true</IntrinsicFunctions>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE=1;_CRT_NON_CONFORMING_SWPRINTFS=1;_SCL_SECURE_NO_WARNINGS=1;__WXMSW__;NDEBUG;_UNICODE;WXBUILDING;WXDLLNAME=$(TargetName);WXUSINGDLL;WXMAKINGDLL_WEBVIEW;%(PreprocessorDefinitions)</PreprocessorDefinitions>