Skip to content

Instantly share code, notes, and snippets.

@Zubnix
Created May 22, 2018 21:04
Show Gist options
  • Save Zubnix/8e63ee2e0f1ceffc9ad266596d5f5197 to your computer and use it in GitHub Desktop.
Save Zubnix/8e63ee2e0f1ceffc9ad266596d5f5197 to your computer and use it in GitHub Desktop.
Patch for the skia build to create an llvm bitcode archive usable for compilation to wasm using emscripten
diff --git a/BUILD.gn b/BUILD.gn
index 69bcb6835b..32f0bf5c0f 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -375,7 +375,7 @@ optional("fontmgr_android") {
}
optional("fontmgr_custom") {
- enabled = is_linux && skia_use_freetype && !skia_use_fontconfig
+ enabled = (is_linux || is_wasm) && skia_use_freetype && !skia_use_fontconfig
deps = [
":typeface_freetype",
@@ -1773,164 +1773,6 @@ if (skia_enable_tools) {
}
}
- if (skia_enable_gpu) {
- test_lib("sk_app") {
- public_include_dirs = [ "tools/sk_app" ]
- sources = [
- "tools/sk_app/CommandSet.cpp",
- "tools/sk_app/GLWindowContext.cpp",
- "tools/sk_app/Window.cpp",
- ]
- libs = []
-
- if (is_android) {
- sources += [
- "tools/sk_app/android/GLWindowContext_android.cpp",
- "tools/sk_app/android/RasterWindowContext_android.cpp",
- "tools/sk_app/android/Window_android.cpp",
- "tools/sk_app/android/main_android.cpp",
- "tools/sk_app/android/surface_glue_android.cpp",
- ]
- libs += [ "android" ]
- } else if (is_linux) {
- sources += [
- "tools/sk_app/unix/GLWindowContext_unix.cpp",
- "tools/sk_app/unix/RasterWindowContext_unix.cpp",
- "tools/sk_app/unix/Window_unix.cpp",
- "tools/sk_app/unix/keysym2ucs.c",
- "tools/sk_app/unix/main_unix.cpp",
- ]
- libs += [
- "GL",
- "X11",
- ]
- } else if (is_win) {
- sources += [
- "tools/sk_app/win/GLWindowContext_win.cpp",
- "tools/sk_app/win/RasterWindowContext_win.cpp",
- "tools/sk_app/win/Window_win.cpp",
- "tools/sk_app/win/main_win.cpp",
- ]
- if (skia_use_angle) {
- sources += [ "tools/sk_app/win/ANGLEWindowContext_win.cpp" ]
- }
- } else if (is_mac) {
- sources += [
- "tools/sk_app/mac/GLWindowContext_mac.cpp",
- "tools/sk_app/mac/RasterWindowContext_mac.cpp",
- "tools/sk_app/mac/Window_mac.cpp",
- "tools/sk_app/mac/main_mac.cpp",
- ]
- libs += [
- "QuartzCore.framework",
- "Cocoa.framework",
- "Foundation.framework",
- ]
- } else if (is_ios) {
- sources += [
- "tools/sk_app/ios/GLWindowContext_ios.cpp",
- "tools/sk_app/ios/RasterWindowContext_ios.cpp",
- "tools/sk_app/ios/Window_ios.cpp",
- "tools/sk_app/ios/main_ios.cpp",
- ]
- }
-
- if (skia_use_vulkan) {
- sources += [ "tools/sk_app/VulkanWindowContext.cpp" ]
- if (is_android) {
- sources += [ "tools/sk_app/android/VulkanWindowContext_android.cpp" ]
- } else if (is_linux) {
- sources += [ "tools/sk_app/unix/VulkanWindowContext_unix.cpp" ]
- libs += [ "X11-xcb" ]
- } else if (is_win) {
- sources += [ "tools/sk_app/win/VulkanWindowContext_win.cpp" ]
- }
- }
-
- deps = [
- ":gpu_tool_utils",
- ":skia",
- ":tool_utils",
- ":views",
- ]
- if (is_android) {
- deps += [ "//third_party/native_app_glue" ]
- } else if (is_mac || is_ios) {
- deps += [ "//third_party/libsdl" ]
- }
- if (skia_use_angle) {
- deps += [ "//third_party/angle2" ]
- }
- }
- }
-
- if (skia_enable_gpu) {
- test_app("viewer") {
- is_shared_library = is_android
- if (is_ios) {
- bundle_ios_data = true
- }
- sources = [
- "tools/viewer/GMSlide.cpp",
- "tools/viewer/ImGuiLayer.cpp",
- "tools/viewer/ImageSlide.cpp",
- "tools/viewer/SKPSlide.cpp",
- "tools/viewer/SampleSlide.cpp",
- "tools/viewer/StatsLayer.cpp",
- "tools/viewer/Viewer.cpp",
- ]
- libs = []
-
- include_dirs = []
- deps = [
- ":flags",
- ":gm",
- ":gpu_tool_utils",
- ":samples",
- ":sk_app",
- ":skia",
- ":tool_utils",
- ":views",
- "//third_party/imgui",
- "//third_party/jsoncpp",
- ]
- }
- }
-
- if (skia_enable_gpu && !skia_use_angle && (is_linux || is_win || is_mac)) {
- test_app("HelloWorld") {
- sources = [
- "example/HelloWorld.cpp",
- ]
- libs = []
-
- include_dirs = []
- deps = [
- ":flags",
- ":gpu_tool_utils",
- ":sk_app",
- ":skia",
- ":tool_utils",
- ":views",
- ]
- }
- }
-
- if (skia_enable_gpu && (is_linux || is_mac || is_ios)) {
- test_app("SkiaSDLExample") {
- sources = [
- "example/SkiaSDLExample.cpp",
- ]
- libs = []
- include_dirs = []
- deps = [
- ":gpu_tool_utils",
- ":skia",
- "//third_party/libsdl",
- ]
- }
- }
-
if (skia_qt_path != "" && (is_win || is_linux || is_mac)) {
action_foreach("generate_mocs") {
script = "gn/call.py"
diff --git a/gn/BUILDCONFIG.gn b/gn/BUILDCONFIG.gn
index 0e93f0a6b6..31eaab8b1a 100644
--- a/gn/BUILDCONFIG.gn
+++ b/gn/BUILDCONFIG.gn
@@ -61,6 +61,7 @@ is_tvos = current_os == "tvos"
is_linux = current_os == "linux"
is_mac = current_os == "mac"
is_win = current_os == "win"
+is_wasm = current_os == "wasm"
if (target_cpu == "") {
target_cpu = host_cpu
@msdmazarei
Copy link

which version of skia should be patched by these file, a lot of changed happen in BUILD.gn and this patch does not work properly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment