-
Notifications
You must be signed in to change notification settings - Fork 68
/
CMakeLists.txt
147 lines (122 loc) · 4.23 KB
/
CMakeLists.txt
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# Copyright (c) 2017 The Chromium Embedded Framework Authors. All rights
# reserved. Use of this source code is governed by a BSD-style license that
# can be found in the LICENSE file.
#
# Source files.
#
# Sources shared by all executables.
set(SHARED_COMMON_SRCS
app_factory.h
main_util.cc
main_util.h
)
# Main executable sources.
set(SHARED_SRCS
${SHARED_COMMON_SRCS}
client_manager.cc
client_manager.h
client_util.cc
client_util.h
browser_util.cc
browser_util.h
main.h
resource_util.cc
resource_util.h
)
set(SHARED_SRCS_LINUX
client_util_linux.cc
main_linux.cc
resource_util_linux.cc
resource_util_posix.cc
)
set(SHARED_SRCS_MAC
client_util_mac.mm
main_mac.mm
resource_util_mac.mm
resource_util_posix.cc
)
set(SHARED_SRCS_WINDOWS
client_util_win.cc
main_win.cc
resource_util_win.cc
)
APPEND_PLATFORM_SOURCES(SHARED_SRCS)
if(OS_MAC)
# On macOS a separate helper executable is used for subprocesses.
set(SHARED_HELPER_SRCS
${SHARED_COMMON_SRCS}
process_helper_mac.cc
process_helper_mac.h
)
endif()
#
# Shared configuration.
#
# Target static library names.
set(SHARED_TARGET "shared")
if(OS_MAC)
set(SHARED_HELPER_TARGET "shared_helper")
endif()
if(OS_LINUX OR OS_WINDOWS)
# Logical target used to link the libcef library on Linux and Windows.
# On macOS the CEF framework is loaded dynamically at startup.
ADD_LOGICAL_TARGET("libcef_lib" "${CEF_LIB_DEBUG}" "${CEF_LIB_RELEASE}")
endif()
#
# Linux configuration.
#
if(OS_LINUX)
# Static library target.
add_library(${SHARED_TARGET} STATIC ${SHARED_SRCS})
SET_EXAMPLE_LIBRARY_TARGET_PROPERTIES(${SHARED_TARGET})
add_dependencies(${SHARED_TARGET} libcef_dll_wrapper)
target_link_libraries(${SHARED_TARGET} libcef_lib libcef_dll_wrapper ${CEF_STANDARD_LIBS})
# Copy binary and resource files to the target output directory.
COPY_FILES("${SHARED_TARGET}" "${CEF_BINARY_FILES}" "${CEF_BINARY_DIR}" "${EXAMPLE_TARGET_OUT_DIR}")
COPY_FILES("${SHARED_TARGET}" "${CEF_RESOURCE_FILES}" "${CEF_RESOURCE_DIR}" "${EXAMPLE_TARGET_OUT_DIR}")
# Output a message about setting SUID permissions on the chrome-sandbox target.
SET_LINUX_SUID_PERMISSIONS("${SHARED_TARGET}" "${EXAMPLE_TARGET_OUT_DIR}/chrome-sandbox")
endif()
#
# Mac OS X configuration.
#
if(OS_MAC)
# Create source groups for Xcode.
SET_EXAMPLE_SOURCE_GROUPS("${SHARED_SRCS}")
SET_EXAMPLE_SOURCE_GROUPS("${SHARED_HELPER_SRCS}")
# Helper static library target.
add_library(${SHARED_HELPER_TARGET} STATIC ${SHARED_HELPER_SRCS})
SET_EXAMPLE_LIBRARY_TARGET_PROPERTIES(${SHARED_HELPER_TARGET})
add_dependencies(${SHARED_HELPER_TARGET} libcef_dll_wrapper)
target_link_libraries(${SHARED_HELPER_TARGET} libcef_dll_wrapper ${CEF_STANDARD_LIBS})
if(USE_SANDBOX)
# Logical target used to link the cef_sandbox library.
ADD_LOGICAL_TARGET("cef_sandbox_lib" "${CEF_SANDBOX_LIB_DEBUG}" "${CEF_SANDBOX_LIB_RELEASE}")
target_link_libraries(${SHARED_HELPER_TARGET} cef_sandbox_lib)
endif()
# Main static library target.
add_library(${SHARED_TARGET} STATIC ${SHARED_SRCS})
SET_EXAMPLE_LIBRARY_TARGET_PROPERTIES(${SHARED_TARGET})
add_dependencies(${SHARED_TARGET} libcef_dll_wrapper "${SHARED_HELPER_TARGET}")
target_link_libraries(${SHARED_TARGET} libcef_dll_wrapper ${CEF_STANDARD_LIBS})
endif()
#
# Windows configuration.
#
if(OS_WINDOWS)
# Create source groups for Visual Studio.
SET_EXAMPLE_SOURCE_GROUPS("${SHARED_SRCS}")
# Executable target.
add_library(${SHARED_TARGET} STATIC ${SHARED_SRCS})
SET_EXAMPLE_LIBRARY_TARGET_PROPERTIES(${SHARED_TARGET})
add_dependencies(${SHARED_TARGET} libcef_dll_wrapper)
target_link_libraries(${SHARED_TARGET} libcef_lib libcef_dll_wrapper ${CEF_STANDARD_LIBS})
if(USE_SANDBOX)
# Logical target used to link the cef_sandbox library.
ADD_LOGICAL_TARGET("cef_sandbox_lib" "${CEF_SANDBOX_LIB_DEBUG}" "${CEF_SANDBOX_LIB_RELEASE}")
target_link_libraries(${SHARED_TARGET} cef_sandbox_lib ${CEF_SANDBOX_STANDARD_LIBS})
endif()
# Copy binary and resource files to the target output directory.
COPY_FILES("${SHARED_TARGET}" "${CEF_BINARY_FILES}" "${CEF_BINARY_DIR}" "${EXAMPLE_TARGET_OUT_DIR}")
COPY_FILES("${SHARED_TARGET}" "${CEF_RESOURCE_FILES}" "${CEF_RESOURCE_DIR}" "${EXAMPLE_TARGET_OUT_DIR}")
endif()