Skip to content

Commit 43d4d2f

Browse files
authored
fix(🐛): set -fexceptions and -frtti flag in the Skia build (#3595)
1 parent 5b84602 commit 43d4d2f

File tree

5 files changed

+48
-20
lines changed

5 files changed

+48
-20
lines changed

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[submodule "externals/skia"]
22
path = externals/skia
33
url = https://chromium.googlesource.com/skia/
4-
branch = chrome/m142
4+
branch = chrome/m144
55
[submodule "externals/depot_tools"]
66
path = externals/depot_tools
77
url = https://chromium.googlesource.com/chromium/tools/depot_tools.git

externals/depot_tools

Submodule depot_tools updated from 8a1ec6a to a6671ce

externals/skia

Submodule skia updated from f4ed99d to ee20d56

packages/skia/scripts/build-skia.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -294,12 +294,6 @@ const buildXCFrameworks = () => {
294294
`sed -i '' 's/uint32(bindingInfo\\.binding)/uint32_t(bindingInfo.binding)/g' ${shaderModuleFile}`
295295
);
296296

297-
// Remove partition_alloc line from dawn.gni
298-
const dawnGniFile = `${SkiaSrc}/build_overrides/dawn.gni`;
299-
$(
300-
`sed -i '' '/dawn_partition_alloc_dir = "\\/\\/third_party\\/externals\\/partition_alloc"/d' ${dawnGniFile}`
301-
);
302-
303297
console.log("Patches applied successfully");
304298
}
305299
$(`rm -rf ${PackageRoot}/libs`);

packages/skia/scripts/skia-configuration.ts

Lines changed: 45 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ const DEBUG = false;
77
export const GRAPHITE = !!process.env.SK_GRAPHITE;
88
export const MACCATALYST = !GRAPHITE;
99
const BUILD_WITH_PARAGRAPH = true;
10+
// Re-enable mutable SkPath methods (addPath, moveTo, lineTo, etc.)
11+
// Skia is transitioning to immutable SkPath with SkPathBuilder
12+
// Set to false once we migrate to SkPathBuilder
13+
const ENABLE_SKPATH_EDIT_METHODS = true;
14+
const PATH_EDIT_FLAG = ENABLE_SKPATH_EDIT_METHODS
15+
? "-USK_HIDE_PATH_EDIT_METHODS"
16+
: "";
1017

1118
export const SkiaSrc = path.join(__dirname, "../../../externals/skia");
1219
export const ProjectRoot = path.join(__dirname, "../../..");
@@ -85,7 +92,6 @@ export const commonArgs = [
8592
//["skia_enable_ganesh", !GRAPHITE],
8693
["skia_enable_graphite", GRAPHITE],
8794
["skia_use_dawn", GRAPHITE],
88-
["skia_use_cpp20", GRAPHITE],
8995
];
9096

9197
export type PlatformName = "apple" | "android";
@@ -120,7 +126,7 @@ const tvosTargets: { [key: string]: Target } = GRAPHITE
120126
args: [
121127
[
122128
"extra_cflags",
123-
`["-target", "arm64-apple-tvos", "-mappletvos-version-min=${appleMinTarget}"]`,
129+
`["-fexceptions", "-frtti"${PATH_EDIT_FLAG ? `, "${PATH_EDIT_FLAG}"` : ""}, "-target", "arm64-apple-tvos", "-mappletvos-version-min=${appleMinTarget}"]`,
124130
],
125131
[
126132
"extra_asmflags",
@@ -139,7 +145,7 @@ const tvosTargets: { [key: string]: Target } = GRAPHITE
139145
["ios_use_simulator", true],
140146
[
141147
"extra_cflags",
142-
`["-target", "arm64-apple-tvos-simulator", "-mappletvsimulator-version-min=${appleSimulatorMinTarget}"]`,
148+
`["-fexceptions", "-frtti"${PATH_EDIT_FLAG ? `, "${PATH_EDIT_FLAG}"` : ""}, "-target", "arm64-apple-tvos-simulator", "-mappletvsimulator-version-min=${appleSimulatorMinTarget}"]`,
143149
],
144150
[
145151
"extra_asmflags",
@@ -158,15 +164,15 @@ const tvosTargets: { [key: string]: Target } = GRAPHITE
158164
["ios_use_simulator", true],
159165
[
160166
"extra_cflags",
161-
`["-target", "arm64-apple-tvos-simulator", "-mappletvsimulator-version-min=${appleSimulatorMinTarget}"]`,
167+
`["-fexceptions", "-frtti"${PATH_EDIT_FLAG ? `, "${PATH_EDIT_FLAG}"` : ""}, "-target", "x86_64-apple-tvos-simulator", "-mappletvsimulator-version-min=${appleSimulatorMinTarget}"]`,
162168
],
163169
[
164170
"extra_asmflags",
165-
`["-target", "arm64-apple-tvos-simulator", "-mappletvsimulator-version-min=${appleSimulatorMinTarget}"]`,
171+
`["-target", "x86_64-apple-tvos-simulator", "-mappletvsimulator-version-min=${appleSimulatorMinTarget}"]`,
166172
],
167173
[
168174
"extra_ldflags",
169-
`["-target", "arm64-apple-tvos-simulator", "-mappletvsimulator-version-min=${appleSimulatorMinTarget}"]`,
175+
`["-target", "x86_64-apple-tvos-simulator", "-mappletvsimulator-version-min=${appleSimulatorMinTarget}"]`,
170176
],
171177
],
172178
},
@@ -184,7 +190,7 @@ const maccatalystTargets: { [key: string]: Target } = MACCATALYST
184190
["target_cpu", `"arm64"`],
185191
[
186192
"extra_cflags",
187-
`["-target","arm64-apple-ios14.0-macabi",` +
193+
`["-fexceptions","-frtti"${PATH_EDIT_FLAG ? `,"${PATH_EDIT_FLAG}"` : ""},"-target","arm64-apple-ios14.0-macabi",` +
188194
`"-isysroot","${appleSdkRoot}",` +
189195
`"-isystem","${appleSdkRoot}/System/iOSSupport/usr/include",` +
190196
`"-iframework","${appleSdkRoot}/System/iOSSupport/System/Library/Frameworks"]`,
@@ -206,7 +212,7 @@ const maccatalystTargets: { [key: string]: Target } = MACCATALYST
206212
["target_cpu", `"x64"`],
207213
[
208214
"extra_cflags",
209-
`["-target","x86_64-apple-ios14.0-macabi",` +
215+
`["-fexceptions","-frtti"${PATH_EDIT_FLAG ? `,"${PATH_EDIT_FLAG}"` : ""},"-target","x86_64-apple-ios14.0-macabi",` +
210216
`"-isysroot","${appleSdkRoot}",` +
211217
`"-isystem","${appleSdkRoot}/System/iOSSupport/usr/include",` +
212218
`"-iframework","${appleSdkRoot}/System/iOSSupport/System/Library/Frameworks"]`,
@@ -256,7 +262,7 @@ export const configurations = {
256262
["cxx", '"clang++"'],
257263
[
258264
"extra_cflags",
259-
'["-DSKIA_C_DLL", "-DHAVE_SYSCALL_GETRANDOM", "-DXML_DEV_URANDOM"]',
265+
`["-DSKIA_C_DLL", "-DHAVE_SYSCALL_GETRANDOM", "-DXML_DEV_URANDOM"${PATH_EDIT_FLAG ? `, "${PATH_EDIT_FLAG}"` : ""}]`,
260266
],
261267
...ParagraphArgsAndroid,
262268
],
@@ -276,32 +282,60 @@ export const configurations = {
276282
"arm64-iphoneos": {
277283
cpu: "arm64",
278284
platform: "ios",
279-
args: [["ios_min_target", `"${appleMinTarget}"`]],
285+
args: [
286+
["ios_min_target", `"${appleMinTarget}"`],
287+
[
288+
"extra_cflags",
289+
`["-fexceptions", "-frtti"${PATH_EDIT_FLAG ? `, "${PATH_EDIT_FLAG}"` : ""}]`,
290+
],
291+
],
280292
},
281293
"arm64-iphonesimulator": {
282294
cpu: "arm64",
283295
platform: "ios",
284296
args: [
285297
["ios_min_target", `"${appleSimulatorMinTarget}"`],
286298
["ios_use_simulator", true],
299+
[
300+
"extra_cflags",
301+
`["-fexceptions", "-frtti"${PATH_EDIT_FLAG ? `, "${PATH_EDIT_FLAG}"` : ""}]`,
302+
],
287303
],
288304
},
289305
"x64-iphonesimulator": {
290306
cpu: "x64",
291307
platform: "ios",
292-
args: [["ios_min_target", `"${appleSimulatorMinTarget}"`]],
308+
args: [
309+
["ios_min_target", `"${appleSimulatorMinTarget}"`],
310+
[
311+
"extra_cflags",
312+
`["-fexceptions", "-frtti"${PATH_EDIT_FLAG ? `, "${PATH_EDIT_FLAG}"` : ""}]`,
313+
],
314+
],
293315
},
294316
...tvosTargets,
295317
...maccatalystTargets,
296318
"arm64-macosx": {
297319
platformGroup: "macosx",
298320
cpu: "arm64",
299321
platform: "mac",
322+
args: [
323+
[
324+
"extra_cflags",
325+
`["-fexceptions", "-frtti"${PATH_EDIT_FLAG ? `, "${PATH_EDIT_FLAG}"` : ""}]`,
326+
],
327+
],
300328
},
301329
"x64-macosx": {
302330
platformGroup: "macosx",
303331
cpu: "x64",
304332
platform: "mac",
333+
args: [
334+
[
335+
"extra_cflags",
336+
`["-fexceptions", "-frtti"${PATH_EDIT_FLAG ? `, "${PATH_EDIT_FLAG}"` : ""}]`,
337+
],
338+
],
305339
},
306340
},
307341
args: [

0 commit comments

Comments
 (0)