Build Skia with C++17.
Skia has decided to go with C++17 upstream, so follow along and make the
same build configuration changes as Chromium's skia/BUILD.gn. Update
README.md to make a note of this.
Bug: pdfium:11
Change-Id: Ia3405529d2eb215687183cab28f6c3bf05f8f92c
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/63230
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/README.md b/README.md
index 3d18613..a79e18d 100644
--- a/README.md
+++ b/README.md
@@ -117,6 +117,10 @@
temporary and will go away in the future when PDFium fully transitions to C++14.
See [this bug](https://crbug.com/pdfium/1407) for details.
+When building with the experimental Skia backend, Skia itself it built with
+C++17. There is no configuration for this. One just has to use a build toolchain
+that supports C++17.
+
When complete the arguments will be stored in `<directory>/args.gn`, and
GN will automatically use the new arguments to generate build files.
Should your files fail to generate, please double-check that you have set
diff --git a/skia/BUILD.gn b/skia/BUILD.gn
index 6b315d9..fb0573e 100644
--- a/skia/BUILD.gn
+++ b/skia/BUILD.gn
@@ -124,7 +124,14 @@
"/wd4554", # 'operator' : check operator precedence for possible error
"/wd4748", # compiler will disable optimizations if a function has inline
# assembly code contains flow control(jmp or jcc) statements.
+
+ "/wd4800", # forcing value to bool 'true/false'(assigning int to bool).
+ "/wd5041", # out-of-line definition for constexpr static data member is not needed and is deprecated in C++17
]
+ cflags_cc = [ "/std:c++17" ]
+ } else {
+ cflags_cc = [ "-std=c++17" ]
+ cflags_objcc = [ "-std=c++17" ]
}
}
@@ -360,6 +367,15 @@
"//build/config/compiler:no_chromium_code",
]
public_configs = [ ":skia_config" ]
+
+ if (is_win) {
+ cflags_cc = [
+ "/std:c++17",
+ "/wd5041", # out-of-line definition for constexpr static data member is not needed and is deprecated in C++17
+ ]
+ } else {
+ cflags_cc = [ "-std=c++17" ]
+ }
}
}