-
Notifications
You must be signed in to change notification settings - Fork 36
/
CreateSDK.cmake
221 lines (198 loc) · 8.77 KB
/
CreateSDK.cmake
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
INSTALL(TARGETS WebCore
RUNTIME DESTINATION "bin"
LIBRARY DESTINATION "bin"
ARCHIVE DESTINATION "lib"
)
if (UL_ENABLE_STATIC_BUILD)
INSTALL(TARGETS WTF JavaScriptCore PAL sqlite3
RUNTIME DESTINATION "bin"
LIBRARY DESTINATION "bin"
ARCHIVE DESTINATION "lib"
)
if(USE_MIMALLOC)
INSTALL(TARGETS mimalloc
RUNTIME DESTINATION "bin"
LIBRARY DESTINATION "bin"
ARCHIVE DESTINATION "lib"
)
endif ()
endif ()
INSTALL(DIRECTORY "${DERIVED_SOURCES_DIR}" DESTINATION "." FILES_MATCHING PATTERN "*.h" PATTERN "*.js")
INSTALL(DIRECTORY "${PROJECT_SOURCE_DIR}/Source/WebCore/platform/ultralight"
DESTINATION "DerivedSources/ForwardingHeaders/WebCore/platform" FILES_MATCHING PATTERN "*.h")
INSTALL(FILES "${PROJECT_SOURCE_DIR}/Source/WebCore/platform/graphics/ShadowBlur.h"
DESTINATION "DerivedSources/ForwardingHeaders/WebCore/platform/graphics/")
INSTALL(DIRECTORY "${PROJECT_SOURCE_DIR}/Source/WebCore/platform/graphics/ultralight"
DESTINATION "DerivedSources/ForwardingHeaders/WebCore/platform/graphics" FILES_MATCHING PATTERN "*.h")
INSTALL(DIRECTORY "${PROJECT_SOURCE_DIR}/Source/WebCore/platform/graphics/harfbuzz"
DESTINATION "DerivedSources/ForwardingHeaders/WebCore/platform/graphics" FILES_MATCHING PATTERN "*.h")
INSTALL(DIRECTORY "${PROJECT_SOURCE_DIR}/Source/WebCore/platform/graphics/texmap"
DESTINATION "DerivedSources/ForwardingHeaders/WebCore/platform/graphics" FILES_MATCHING PATTERN "*.h")
INSTALL(FILES "${PROJECT_SOURCE_DIR}/Source/WebCore/platform/MIMETypeRegistry.h"
DESTINATION "DerivedSources/ForwardingHeaders/WebCore/platform/")
INSTALL(FILES "${PROJECT_SOURCE_DIR}/Source/WebCore/platform/FileChooser.h"
DESTINATION "DerivedSources/ForwardingHeaders/WebCore/platform/")
INSTALL(DIRECTORY "${PROJECT_SOURCE_DIR}/Source/SQLite"
DESTINATION "DerivedSources/ForwardingHeaders" FILES_MATCHING PATTERN "*.h")
INSTALL(DIRECTORY "${PROJECT_SOURCE_DIR}/Source/WebCore/storage"
DESTINATION "DerivedSources/ForwardingHeaders/WebCore" FILES_MATCHING PATTERN "*.h")
INSTALL(FILES "${PROJECT_SOURCE_DIR}/Source/WebCore/config.h"
DESTINATION "DerivedSources/ForwardingHeaders/WebCore/")
set(JAVASCRIPTCORE_HEADERS
"${PROJECT_SOURCE_DIR}/Source/JavaScriptCore/API/JavaScript.h"
"${PROJECT_SOURCE_DIR}/Source/JavaScriptCore/API/JSBase.h"
"${PROJECT_SOURCE_DIR}/Source/JavaScriptCore/API/JSContextRef.h"
"${PROJECT_SOURCE_DIR}/Source/JavaScriptCore/API/JSStringRef.h"
"${PROJECT_SOURCE_DIR}/Source/JavaScriptCore/API/JSObjectRef.h"
"${PROJECT_SOURCE_DIR}/Source/JavaScriptCore/API/JSTypedArray.h"
"${PROJECT_SOURCE_DIR}/Source/JavaScriptCore/API/JSValueRef.h"
"${PROJECT_SOURCE_DIR}/Source/JavaScriptCore/API/WebKitAvailability.h"
"${PROJECT_SOURCE_DIR}/Source/JavaScriptCore/API/JSObjectRefPrivate.h"
"${PROJECT_SOURCE_DIR}/Source/JavaScriptCore/API/JSRetainPtr.h"
)
INSTALL(FILES ${JAVASCRIPTCORE_HEADERS} DESTINATION "include/JavaScriptCore/")
INSTALL(FILES "${CMAKE_SOURCE_DIR}/cacert.pem" DESTINATION "bin/resources/")
set(WEBINSPECTORUI_DIR "${CMAKE_SOURCE_DIR}/Source/WebInspectorUI")
INSTALL(DIRECTORY "${WEBINSPECTORUI_DIR}/UserInterface/" DESTINATION "inspector")
INSTALL(FILES "${WEBINSPECTORUI_DIR}/Localizations/en.lproj/localizedStrings.js"
DESTINATION "inspector")
INSTALL(FILES "${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/inspector/InspectorBackendCommands.js"
DESTINATION "inspector/Protocol")
if (PORT MATCHES "UltralightWin")
if (${CMAKE_BUILD_TYPE} MATCHES Debug OR ${CMAKE_BUILD_TYPE} MATCHES RelWithDebInfo)
INSTALL(FILES "${PROJECT_BINARY_DIR}/bin/WebCore.pdb" DESTINATION "bin")
endif ()
endif ()
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
set(ARCHITECTURE "x64")
else ()
set(ARCHITECTURE "x86")
endif ()
INSTALL(FILES "${WEBKIT_LIBRARIES_DIR}/bin/icudt67l.dat" DESTINATION "bin/resources/")
if (USE_GSTREAMER)
set(MEDIACONTROLS_ASSETS
"${PROJECT_SOURCE_DIR}/Source/WebCore/Modules/mediacontrols/mediaControls.css"
"${PROJECT_SOURCE_DIR}/Source/WebCore/Modules/mediacontrols/mediaControls.js"
"${PROJECT_SOURCE_DIR}/Source/WebCore/Modules/mediacontrols/mediaControlsLocalizedStrings.js"
)
INSTALL(FILES ${MEDIACONTROLS_ASSETS} DESTINATION "bin/resources/")
if (PORT MATCHES "UltralightLinux")
set(GSTREAMER_FILES
"${GSTREAMER_DIR}/lib/libgstreamer-full-1.0.so"
"${GSTREAMER_DIR}/lib/libgio-2.0.so"
"${GSTREAMER_DIR}/lib/libgio-2.0.so.0"
"${GSTREAMER_DIR}/lib/libgio-2.0.so.0.6800.3"
"${GSTREAMER_DIR}/lib/libglib-2.0.so"
"${GSTREAMER_DIR}/lib/libglib-2.0.so.0"
"${GSTREAMER_DIR}/lib/libglib-2.0.so.0.6800.3"
"${GSTREAMER_DIR}/lib/libgmodule-2.0.so"
"${GSTREAMER_DIR}/lib/libgmodule-2.0.so.0"
"${GSTREAMER_DIR}/lib/libgmodule-2.0.so.0.6800.3"
"${GSTREAMER_DIR}/lib/libgobject-2.0.so"
"${GSTREAMER_DIR}/lib/libgobject-2.0.so.0"
"${GSTREAMER_DIR}/lib/libgobject-2.0.so.0.6800.3"
"${GSTREAMER_DIR}/lib/libgthread-2.0.so"
"${GSTREAMER_DIR}/lib/libgthread-2.0.so.0"
"${GSTREAMER_DIR}/lib/libgthread-2.0.so.0.6800.3"
)
elseif (PORT MATCHES "UltralightMac")
set(GSTREAMER_FILES
"${GSTREAMER_DIR}/lib/libgstreamer-full-1.0.dylib"
"${GSTREAMER_DIR}/lib/libgio-2.0.dylib"
"${GSTREAMER_DIR}/lib/libgio-2.0.0.dylib"
"${GSTREAMER_DIR}/lib/libglib-2.0.dylib"
"${GSTREAMER_DIR}/lib/libglib-2.0.0.dylib"
"${GSTREAMER_DIR}/lib/libgmodule-2.0.dylib"
"${GSTREAMER_DIR}/lib/libgmodule-2.0.0.dylib"
"${GSTREAMER_DIR}/lib/libgobject-2.0.dylib"
"${GSTREAMER_DIR}/lib/libgobject-2.0.0.dylib"
"${GSTREAMER_DIR}/lib/libgthread-2.0.dylib"
"${GSTREAMER_DIR}/lib/libgthread-2.0.0.dylib"
)
elseif (PORT MATCHES "UltralightWin")
set(GSTREAMER_FILES
"${GSTREAMER_DIR}/bin/gstreamer-full-1.0.dll"
"${GSTREAMER_DIR}/bin/gio-2.0-0.dll"
"${GSTREAMER_DIR}/bin/glib-2.0-0.dll"
"${GSTREAMER_DIR}/bin/gmodule-2.0-0.dll"
"${GSTREAMER_DIR}/bin/gobject-2.0-0.dll"
"${GSTREAMER_DIR}/bin/gthread-2.0-0.dll"
)
endif ()
INSTALL(FILES ${GSTREAMER_FILES} DESTINATION "bin/")
endif ()
if (PORT MATCHES "UltralightLinux")
set(PLATFORM "linux")
elseif (PORT MATCHES "UltralightMac")
set(PLATFORM "mac")
elseif (PORT MATCHES "UltralightWin")
if (UWP_PLATFORM)
set(PLATFORM "win-uwp")
else ()
set(PLATFORM "win")
endif ()
endif ()
set(INSTALL_DIR ${PROJECT_BINARY_DIR}/out)
add_custom_target(create_sdk ALL "${CMAKE_COMMAND}"
-D CMAKE_INSTALL_PREFIX:string=${INSTALL_DIR}
-P "${CMAKE_CURRENT_BINARY_DIR}/cmake_install.cmake"
DEPENDS WebCore)
# Get name of current branch
execute_process(
COMMAND git rev-parse --abbrev-ref HEAD
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
OUTPUT_VARIABLE GIT_BRANCH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
# Get status of current branch
execute_process(
COMMAND git status --untracked-files=no --porcelain
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
OUTPUT_VARIABLE GIT_STATUS
OUTPUT_STRIP_TRAILING_WHITESPACE
)
# Get abbreviated commit hash of current branch
execute_process(
COMMAND git rev-parse --short=8 HEAD
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
OUTPUT_VARIABLE GIT_COMMIT_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
# Get list of local, unpushed commits
execute_process(
COMMAND git cherry -v
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
OUTPUT_VARIABLE GIT_CHERRY
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if (APPLE)
if (NOT ${BUILD_DBG})
# Strip non-essential symbols from dylib in release build on macOS
add_custom_command(TARGET create_sdk POST_BUILD
COMMAND strip -u -r bin/libWebCore.dylib
WORKING_DIRECTORY ${INSTALL_DIR}
)
endif ()
endif ()
set(PKG_FILENAME "webcore-bin-${GIT_COMMIT_HASH}-${PLATFORM}-${ARCHITECTURE}.7z")
if (NOT UL_GENERATE_SDK)
add_custom_command(TARGET create_sdk POST_BUILD
COMMAND ${CMAKE_COMMAND} -E echo "NOTE: No release archive created, SDK generation was disabled."
)
elseif (NOT GIT_STATUS STREQUAL "")
add_custom_command(TARGET create_sdk POST_BUILD
COMMAND ${CMAKE_COMMAND} -E echo "NOTE: No release archive created, working directory has been modified."
)
elseif (NOT GIT_CHERRY STREQUAL "")
add_custom_command(TARGET create_sdk POST_BUILD
COMMAND ${CMAKE_COMMAND} -E echo "NOTE: No release archive created, branch needs to be pushed to remote repository."
)
else ()
add_custom_command(TARGET create_sdk POST_BUILD
COMMAND ${CMAKE_COMMAND} -E tar "cf" ${PROJECT_BINARY_DIR}/${PKG_FILENAME} --format=7zip -- .
WORKING_DIRECTORY ${INSTALL_DIR}
)
add_custom_command(TARGET create_sdk POST_BUILD
COMMAND ${CMAKE_COMMAND} -E echo "Created release archive: ${PROJECT_BINARY_DIR}/${PKG_FILENAME}"
)
endif ()