Add gn plumbing for mdbviz tool
Change-Id: I06e6b63c2742da069f48ff5d7defafc63a485af7
Reviewed-on: https://skia-review.googlesource.com/41842
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/BUILD.gn b/BUILD.gn
index 845feef..e4384d7 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -43,6 +43,7 @@
skia_enable_tools = is_skia_dev_build
skia_enable_vulkan_debug_layers = is_skia_dev_build && is_debug
skia_vulkan_sdk = getenv("VULKAN_SDK")
+ skia_qt_path = getenv("QT_PATH")
skia_compile_processors = false
skia_jumper_clang = ""
@@ -1666,6 +1667,68 @@
}
}
+ if (skia_qt_path != "" && (is_win || is_linux || is_mac)) {
+ action_foreach("generate_mocs") {
+ script = "gn/call.py"
+ sources = [
+ "tools/mdbviz/MainWindow.h",
+ ]
+ outputs = [
+ "$target_gen_dir/mdbviz/{{source_name_part}}_moc.cpp",
+ ]
+ args = [
+ "$skia_qt_path" + "/bin/moc",
+ "{{source}}",
+ "-o",
+ "gen/mdbviz/{{source_name_part}}_moc.cpp",
+ ]
+ }
+ action_foreach("generate_resources") {
+ script = "gn/call.py"
+ sources = [
+ "tools/mdbviz/resources.qrc",
+ ]
+ outputs = [
+ "$target_gen_dir/mdbviz/{{source_name_part}}_res.cpp",
+ ]
+ args = [
+ "$skia_qt_path" + "/bin/rcc",
+ "{{source}}",
+ "-o",
+ "gen/mdbviz/{{source_name_part}}_res.cpp",
+ ]
+ }
+ test_app("mdbviz") {
+ if (is_win) {
+ # on Windows we need to disable some exception handling warnings due to the Qt headers
+ cflags = [ "/Wv:18" ] # 18 -> VS2013, 19 -> VS2015, 1910 -> VS2017
+ }
+ sources = [
+ "tools/mdbviz/MainWindow.cpp",
+ "tools/mdbviz/main.cpp",
+
+ # generated files
+ "$target_gen_dir/mdbviz/MainWindow_moc.cpp",
+ "$target_gen_dir/mdbviz/resources_res.cpp",
+ ]
+ lib_dirs = [ "$skia_qt_path/lib" ]
+ libs = [
+ "Qt5Core.lib",
+ "Qt5Gui.lib",
+ "Qt5Widgets.lib",
+ ]
+ include_dirs = [
+ "$skia_qt_path/include",
+ "$skia_qt_path/include/QtWidgets",
+ ]
+ deps = [
+ ":generate_mocs",
+ ":generate_resources",
+ ":skia",
+ ]
+ }
+ }
+
if (is_android && defined(ndk) && ndk != "") {
copy("gdbserver") {
sources = [