forked from CefView/CefViewCore
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCefConfig.cmake
More file actions
92 lines (79 loc) · 2.73 KB
/
CefConfig.cmake
File metadata and controls
92 lines (79 loc) · 2.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#
# The link for downloading the CEF binary sdk
#
set(CEF_SDK_VERSION
# Old version (deprecated and incompatible)
# "89.0.12+g2b76680+chromium-89.0.4389.90"
# Current version
"95.7.12+g99c4ac0+chromium-95.0.4638.54"
# Newer version (need to adpat)
# --
)
#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# Generally, there is NO NEED to modify the following config
#
# Download CEF binary package
#
if(OS_WINDOWS)
set(CEF_SDK_PLATFORM "windows")
elseif (OS_LINUX)
set(CEF_SDK_PLATFORM "linux")
elseif(OS_MACOS)
set(CEF_SDK_PLATFORM "macos")
else()
message(FATAL_ERROR "Unsupported Operating System")
endif()
if(PROJECT_ARCH STREQUAL "x86_64")
set(CEF_SDK_ARCH "64")
elseif(PROJECT_ARCH STREQUAL "x86")
set(CEF_SDK_ARCH "32")
elseif(PROJECT_ARCH STREQUAL "arm64")
set(CEF_SDK_ARCH "arm64")
elseif(PROJECT_ARCH STREQUAL "arm")
set(CEF_SDK_ARCH "arm")
else()
message(FATAL_ERROR "Unsupported Processor Architecture")
endif()
# set cef sdk package name
set(CEF_SDK_WORKSPACE "${CMAKE_CURRENT_SOURCE_DIR}/dep")
if (OS_MACOS AND PROJECT_ARCH STREQUAL "x86_64")
# macosx64
set(CEF_SDK_PACKAGE_NAME "cef_binary_${CEF_SDK_VERSION}_${CEF_SDK_PLATFORM}x${CEF_SDK_ARCH}")
else()
set(CEF_SDK_PACKAGE_NAME "cef_binary_${CEF_SDK_VERSION}_${CEF_SDK_PLATFORM}${CEF_SDK_ARCH}")
endif()
# Scan extracted sdk dir
set(CEF_SDK_EXTRACTED_DIR "${CEF_SDK_WORKSPACE}/${CEF_SDK_PACKAGE_NAME}")
file(GLOB CEF_SDK_DIR "${CEF_SDK_EXTRACTED_DIR}")
# Extract CEF binary package
if (NOT EXISTS ${CEF_SDK_DIR})
set(CEF_LOCAL_PACKAGE_PATH "${CEF_SDK_WORKSPACE}/${CEF_SDK_PACKAGE_NAME}.tar.bz2")
# if no local cef sdk package file then download it
if(NOT EXISTS "${CEF_LOCAL_PACKAGE_PATH}")
set(CEF_SDK_DOWNLOAD_URL "https://cef-builds.spotifycdn.com/${CEF_SDK_PACKAGE_NAME}.tar.bz2")
message(STATUS "Downloading CEF binary SDK from ${CEF_SDK_DOWNLOAD_URL}")
file(DOWNLOAD
"${CEF_SDK_DOWNLOAD_URL}" # URL
"${CEF_LOCAL_PACKAGE_PATH}" # Local Path
SHOW_PROGRESS
TLS_VERIFY ON
STATUS DOWNLOAD_RESULT
)
list(GET DOWNLOAD_RESULT 0 DOWNLOAD_RESULT_CODE)
list(GET DOWNLOAD_RESULT 1 DOWNLOAD_RESULT_MESSAGE)
if (NOT DOWNLOAD_RESULT_CODE EQUAL 0)
file(REMOVE "${CEF_LOCAL_PACKAGE_PATH}")
message(FATAL_ERROR "Failed to download CEF binary SDK, ERROR:[${DOWNLOAD_RESULT_CODE}]${DOWNLOAD_RESULT_MESSAGE}")
endif()
endif()
message(STATUS "Extracting CEF binary SDK from ${CEF_LOCAL_PACKAGE_PATH}")
# Extract
file(ARCHIVE_EXTRACT
INPUT "${CEF_LOCAL_PACKAGE_PATH}"
DESTINATION "${CEF_SDK_WORKSPACE}"
)
# Capture the dir name
file(GLOB CEF_SDK_DIR "${CEF_SDK_EXTRACTED_DIR}")
endif()
# output
message(STATUS "CEF SDK dir: ${CEF_SDK_DIR}")