Skip to content

Commit 17d9e36

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

File tree

4 files changed

+42
-39
lines changed

4 files changed

+42
-39
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: 31 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -103,26 +103,6 @@ if(${CMAKE_VERSION} GREATER "3.12")
103103
cmake_policy(SET CMP0077 NEW)
104104
endif()
105105

106-
if(OS_WINDOWS)
107-
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()
118-
else()
119-
add_compile_options(
120-
"-g"
121-
"$<$<CONFIG:DEBUG>:-O0>"
122-
"$<$<CONFIG:RELEASE>:-O3>"
123-
)
124-
endif()
125-
126106
# Append CEF root dir to CMAKE_MODULE_PATH
127107
set(CEF_ROOT "${CEF_SDK_DIR}")
128108
list(APPEND CMAKE_MODULE_PATH "${CEF_ROOT}/cmake")
@@ -131,14 +111,6 @@ find_package(CEF REQUIRED)
131111
# Add libcef dll wrapper
132112
add_subdirectory(${CEF_LIBCEF_DLL_WRAPPER_PATH} libcef_dll_wrapper)
133113

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-
142114
PRINT_CEF_CONFIG()
143115

144116
# #################################################################################
@@ -189,3 +161,34 @@ if(${Need_Config_CefVersion_File})
189161
else()
190162
message(STATUS "No need to configure CefVersion.h file")
191163
endif()
164+
165+
# config CEF sandbox
166+
if(OS_MACOS OR OS_WINDOWS)
167+
if(CEF_VERSION_MAJOR LESS 138)
168+
if(USE_SANDBOX)
169+
add_definitions(-DCEF_USE_SANDBOX)
170+
message(STATUS "cef_sandbox_lib path:" "${CEF_SANDBOX_LIB_DEBUG}," "${CEF_SANDBOX_LIB_RELEASE}")
171+
ADD_LOGICAL_TARGET("cef_sandbox_lib" "${CEF_SANDBOX_LIB_DEBUG}" "${CEF_SANDBOX_LIB_RELEASE}")
172+
endif()
173+
endif()
174+
endif()
175+
176+
if(OS_WINDOWS)
177+
add_link_options(/DEBUG)
178+
179+
if(USE_SANDBOX AND(CEF_VERSION_MAJOR LESS 138))
180+
# cef_sandbox.lib is MT already, must keep the same with it
181+
set(CEF_RUNTIME_LIBRARY_FLAG "/MT" CACHE STRING "Use static runtime")
182+
add_compile_options("/MT$<$<CONFIG:Debug>:d>")
183+
else()
184+
# either MT or MD is supported
185+
set(CEF_RUNTIME_LIBRARY_FLAG "/M$<IF:$<BOOL:${STATIC_CRT}>,T,D>" CACHE STRING "Use static runtime" FORCE)
186+
add_compile_options("/M$<IF:$<BOOL:${STATIC_CRT}>,T,D>$<$<CONFIG:Debug>:d>")
187+
endif()
188+
else()
189+
add_compile_options(
190+
"-g"
191+
"$<$<CONFIG:DEBUG>:-O0>"
192+
"$<$<CONFIG:RELEASE>:-O3>"
193+
)
194+
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)