Skip to content

Commit 07b1c11

Browse files
committed
feat: remove sandbox switch for CEF 138+ on Windows and macOS
1 parent 9ff931f commit 07b1c11

File tree

4 files changed

+37
-29
lines changed

4 files changed

+37
-29
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
cmake_minimum_required(VERSION 3.19.1)
55
project(CefViewCore)
66

7-
option(USE_SANDBOX "Enable CEF Sandbox" OFF)
7+
option(USE_SANDBOX "Enable CEF Sandbox (Deprecated since CEF 138)" OFF)
88

99
option(STATIC_CRT "Use MultiThreaded linkage for MSVC" OFF)
1010

cmake/SetupCef.cmake

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -105,16 +105,8 @@ endif()
105105

106106
if(OS_WINDOWS)
107107
add_link_options(/DEBUG)
108-
109-
if(USE_SANDBOX)
110-
# cef_sandbox.lib is MT already, must keep the same with it
111-
set(CEF_RUNTIME_LIBRARY_FLAG "/MT" CACHE STRING "Use static runtime")
112-
add_compile_options("/MT$<$<CONFIG:Debug>:d>")
113-
else()
114-
# either MT or MD is supported
115-
set(CEF_RUNTIME_LIBRARY_FLAG "/M$<IF:$<BOOL:${STATIC_CRT}>,T,D>" CACHE STRING "Use static runtime" FORCE)
116-
add_compile_options("/M$<IF:$<BOOL:${STATIC_CRT}>,T,D>$<$<CONFIG:Debug>:d>")
117-
endif()
108+
set(CEF_RUNTIME_LIBRARY_FLAG "/M$<IF:$<BOOL:${STATIC_CRT}>,T,D>" CACHE STRING "Use static runtime" FORCE)
109+
add_compile_options("/M$<IF:$<BOOL:${STATIC_CRT}>,T,D>$<$<CONFIG:Debug>:d>")
118110
else()
119111
add_compile_options(
120112
"-g"
@@ -131,14 +123,6 @@ find_package(CEF REQUIRED)
131123
# Add libcef dll wrapper
132124
add_subdirectory(${CEF_LIBCEF_DLL_WRAPPER_PATH} libcef_dll_wrapper)
133125

134-
if(USE_SANDBOX AND(OS_WINDOWS OR OS_MACOS))
135-
add_definitions(-DCEF_USE_SANDBOX)
136-
137-
# message(STATUS "cef_sandbox_lib path:" "${CEF_SANDBOX_LIB_DEBUG}," "${CEF_SANDBOX_LIB_RELEASE}" )
138-
# Logical target used to link the cef_sandbox library.
139-
ADD_LOGICAL_TARGET("cef_sandbox_lib" "${CEF_SANDBOX_LIB_DEBUG}" "${CEF_SANDBOX_LIB_RELEASE}")
140-
endif()
141-
142126
PRINT_CEF_CONFIG()
143127

144128
# #################################################################################
@@ -189,3 +173,27 @@ if(${Need_Config_CefVersion_File})
189173
else()
190174
message(STATUS "No need to configure CefVersion.h file")
191175
endif()
176+
177+
# config CEF sandbox
178+
if(CEF_VERSION_MAJOR LESS 138 AND USE_SANDBOX)
179+
if(OS_WINDOWS)
180+
if(STATIC_CRT)
181+
# sandbox enabled
182+
add_definitions(-DCEF_USE_SANDBOX)
183+
message(STATUS "cef_sandbox_lib path:" "${CEF_SANDBOX_LIB_DEBUG}," "${CEF_SANDBOX_LIB_RELEASE}")
184+
ADD_LOGICAL_TARGET("cef_sandbox_lib" "${CEF_SANDBOX_LIB_DEBUG}" "${CEF_SANDBOX_LIB_RELEASE}")
185+
else()
186+
# error, on windows platform CEF sandbox is only supported when:
187+
# 1. Static CRT linkage (MT/MTd)
188+
# 2. CEF version less than 138
189+
message(FATAL_ERROR "CEF sandbox feature on windows requires: CEF version < 138 and STATIC CRT linkage")
190+
endif()
191+
endif()
192+
193+
if(OS_MACOS)
194+
# sandbox enabled
195+
add_definitions(-DCEF_USE_SANDBOX)
196+
message(STATUS "cef_sandbox_lib path:" "${CEF_SANDBOX_LIB_DEBUG}," "${CEF_SANDBOX_LIB_RELEASE}")
197+
ADD_LOGICAL_TARGET("cef_sandbox_lib" "${CEF_SANDBOX_LIB_DEBUG}" "${CEF_SANDBOX_LIB_RELEASE}")
198+
endif()
199+
endif()

include/CefVersion.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@
1313
#pragma once
1414

1515
// clang-format off
16-
#define CEF_VERSION "127.3.5+g114ea2a+chromium-127.0.6533.120"
17-
#define CEF_VERSION_MAJOR 127
18-
#define CEF_VERSION_MINOR 3
19-
#define CEF_VERSION_PATCH 5
20-
#define CEF_COMMIT_NUMBER 3037
21-
#define CEF_COMMIT_HASH "114ea2af1ba9da18c4ac5e599ccdbb17d01ba75a"
16+
#define CEF_VERSION "142.0.15+g6dfdb28+chromium-142.0.7444.176"
17+
#define CEF_VERSION_MAJOR 142
18+
#define CEF_VERSION_MINOR 0
19+
#define CEF_VERSION_PATCH 15
20+
#define CEF_COMMIT_NUMBER 3314
21+
#define CEF_COMMIT_HASH "6dfdb28d752a47e189d7a23b01f368ab0bdb378d"
2222
// clang-format on
2323

2424
#endif // CefVersion

src/CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ if(OS_WINDOWS)
7070
${CEF_STANDARD_LIBS}
7171
)
7272

73-
if(USE_SANDBOX)
73+
if(USE_SANDBOX AND(CEF_VERSION_MAJOR LESS 138))
7474
list(APPEND CefViewCore_LIBS cef_sandbox_lib)
7575
endif()
7676

@@ -135,7 +135,7 @@ if(OS_MACOS)
135135
${CEF_STANDARD_LIBS}
136136
)
137137

138-
if(USE_SANDBOX)
138+
if(USE_SANDBOX AND(CEF_VERSION_MAJOR LESS 138))
139139
list(APPEND CefViewCore_LIBS cef_sandbox_lib)
140140
endif()
141141

@@ -230,7 +230,7 @@ if(OS_WINDOWS)
230230
${CEF_SANDBOX_STANDARD_LIBS}
231231
)
232232

233-
if(USE_SANDBOX AND CEF_VERSION_MAJOR LESS 138)
233+
if(USE_SANDBOX AND(CEF_VERSION_MAJOR LESS 138))
234234
list(APPEND _helper_libs cef_sandbox_lib)
235235
endif()
236236

@@ -367,7 +367,7 @@ if(OS_MACOS)
367367
${CEF_STANDARD_LIBS}
368368
)
369369

370-
if(USE_SANDBOX)
370+
if(USE_SANDBOX AND(CEF_VERSION_MAJOR LESS 138))
371371
list(APPEND CefViewWing_LIBS cef_sandbox_lib)
372372
endif()
373373

0 commit comments

Comments
 (0)