Skip to content

Commit 4919e35

Browse files
committed
feat: optimize CEF version file generating and unify interface parameter types
1 parent 03eb7d5 commit 4919e35

13 files changed

+321
-159
lines changed

CMakeLists.txt

Lines changed: 20 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ if(NOT CEFVIEW_WING_NAME)
8686
endif()
8787

8888
configure_file(
89-
"${CMAKE_CURRENT_SOURCE_DIR}/include/CefViewCoreProtocol.h.in"
89+
"${CMAKE_CURRENT_SOURCE_DIR}/src/CefViewCoreProtocol.h.in"
9090
"${CMAKE_CURRENT_SOURCE_DIR}/include/CefViewCoreProtocol.h"
9191
@ONLY
9292
)
@@ -145,53 +145,8 @@ if(NOT CEF_SDK_VERSION)
145145
set(CEF_SDK_VERSION ${DEFAULT_CEF_SDK_VERSION} CACHE STRING "Cef binary SDK version" FORCE)
146146
endif()
147147

148-
include(DownloadCef)
149-
150-
if(${CMAKE_VERSION} GREATER "3.11")
151-
cmake_policy(SET CMP0074 NEW)
152-
endif()
153-
154-
if(${CMAKE_VERSION} GREATER "3.12")
155-
cmake_policy(SET CMP0077 NEW)
156-
endif()
157-
158-
if(OS_WINDOWS)
159-
add_link_options(/DEBUG)
160-
161-
if(USE_SANDBOX)
162-
# cef_sandbox.lib is MT already, must keep the same with it
163-
set(CEF_RUNTIME_LIBRARY_FLAG "/MT" CACHE STRING "Use static runtime")
164-
add_compile_options("/MT$<$<CONFIG:Debug>:d>")
165-
else()
166-
# either MT or MD is supported
167-
set(CEF_RUNTIME_LIBRARY_FLAG "/M$<IF:$<BOOL:${STATIC_CRT}>,T,D>" CACHE STRING "Use static runtime" FORCE)
168-
add_compile_options("/M$<IF:$<BOOL:${STATIC_CRT}>,T,D>$<$<CONFIG:Debug>:d>")
169-
endif()
170-
else()
171-
add_compile_options(
172-
"-g"
173-
"$<$<CONFIG:DEBUG>:-O0>"
174-
"$<$<CONFIG:RELEASE>:-O3>"
175-
)
176-
endif()
177-
178-
# Append CEF root dir to CMAKE_MODULE_PATH
179-
set(CEF_ROOT "${CEF_SDK_DIR}")
180-
list(APPEND CMAKE_MODULE_PATH "${CEF_ROOT}/cmake")
181-
find_package(CEF REQUIRED)
182-
183-
# Add libcef dll wrapper
184-
add_subdirectory(${CEF_LIBCEF_DLL_WRAPPER_PATH} libcef_dll_wrapper)
185-
186-
if(USE_SANDBOX AND(OS_WINDOWS OR OS_MACOS))
187-
add_definitions(-DCEF_USE_SANDBOX)
188-
189-
# message(STATUS "cef_sandbox_lib path:" "${CEF_SANDBOX_LIB_DEBUG}," "${CEF_SANDBOX_LIB_RELEASE}" )
190-
# Logical target used to link the cef_sandbox library.
191-
ADD_LOGICAL_TARGET("cef_sandbox_lib" "${CEF_SANDBOX_LIB_DEBUG}" "${CEF_SANDBOX_LIB_RELEASE}")
192-
endif()
193-
194-
PRINT_CEF_CONFIG()
148+
# setup CEF
149+
include(SetupCef)
195150

196151
# ##############################################################
197152
set(CMAKE_SUPPRESS_REGENERATION TRUE)
@@ -230,3 +185,20 @@ if(IS_CURRENT_IN_SUBDIRECTORY)
230185
set(CefViewCore_CEF_RESOURCE_DIR ${CEF_RESOURCE_DIR} PARENT_SCOPE)
231186
set(CefViewCore_CEF_INCLUDE_DIR ${CEF_ROOT}/include PARENT_SCOPE)
232187
endif()
188+
189+
install(
190+
DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/output/$<CONFIG>/lib"
191+
DESTINATION "$<CONFIG>"
192+
)
193+
install(
194+
DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/output/$<CONFIG>/bin"
195+
DESTINATION "$<CONFIG>"
196+
)
197+
install(
198+
DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include/"
199+
DESTINATION "include/CefViewCore"
200+
)
201+
install(
202+
DIRECTORY "${CEF_SDK_DIR}/include"
203+
DESTINATION "include/cef"
204+
)

cmake/DownloadCef.cmake

Lines changed: 0 additions & 90 deletions
This file was deleted.

0 commit comments

Comments
 (0)