Differentiate GN config settings for core vs third party code

Have different settings for core source code vs third_party code so
it is a bit easier to fine tune settings.

Review-Url: https://codereview.chromium.org/2041053003
diff --git a/BUILD.gn b/BUILD.gn
index 5d25890..6757316 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -6,7 +6,7 @@
 import("//testing/test.gni")
 import("pdfium.gni")
 
-config("pdfium_config") {
+config("pdfium_common_config") {
   cflags = []
   include_dirs = [
     ".",
@@ -17,7 +17,6 @@
     "OPJ_STATIC",
     "PNG_PREFIX",
     "PNG_USE_READ_MACROS",
-    "V8_DEPRECATION_WARNINGS",
   ]
 
   if (pdf_use_skia) {
@@ -31,7 +30,12 @@
   if (pdf_enable_xfa) {
     defines += [ "PDF_ENABLE_XFA" ]
   }
+}
 
+config("pdfium_core_config") {
+  cflags = []
+  configs = [":pdfium_common_config"]
+  defines = ["V8_DEPRECATION_WARNINGS"]
   if (is_linux) {
     if (current_cpu == "x64") {
       defines += [ "_FX_CPU_=_FX_X64_" ]
@@ -40,7 +44,6 @@
       defines += [ "_FX_CPU_=_FX_X86_" ]
     }
   }
-
   if (is_win) {
     cflags += [ "/wd4267" ]
   }
@@ -100,7 +103,7 @@
   ]
 
   libs = []
-  configs += [ ":pdfium_config" ]
+  configs += [ ":pdfium_core_config" ]
 
   deps = [
     ":fdrm",
@@ -170,7 +173,7 @@
     ]
     configs += [ "//v8:external_startup_data" ]
   }
-  configs += [ ":pdfium_config" ]
+  configs += [ ":pdfium_core_config" ]
 }
 
 # Targets below this are only visible within this file (and to the
@@ -187,7 +190,7 @@
     "core/fdrm/crypto/fx_crypt_sha.cpp",
     "core/fdrm/crypto/include/fx_crypt.h",
   ]
-  configs += [ ":pdfium_config" ]
+  configs += [ ":pdfium_core_config" ]
 }
 
 static_library("fpdfdoc") {
@@ -237,7 +240,7 @@
     "core/fpdfdoc/pdf_vt.h",
     "core/fpdfdoc/tagged_int.h",
   ]
-  configs += [ ":pdfium_config" ]
+  configs += [ ":pdfium_core_config" ]
 }
 
 static_library("fpdfapi") {
@@ -464,7 +467,7 @@
     "core/fpdfapi/fpdf_render/render_int.h",
     "core/fpdfapi/include/cpdf_modulemgr.h",
   ]
-  configs += [ ":pdfium_config" ]
+  configs += [ ":pdfium_core_config" ]
 }
 
 static_library("fpdftext") {
@@ -477,7 +480,7 @@
     "core/fpdftext/unicodenormalizationdata.cpp",
     "core/fpdftext/unicodenormalizationdata.h",
   ]
-  configs += [ ":pdfium_config" ]
+  configs += [ ":pdfium_core_config" ]
 }
 
 static_library("fxcodec") {
@@ -577,7 +580,7 @@
     # conversion to check that an address is 16-bit aligned (benign).
     cflags_c = [ "-Wno-pointer-to-int-cast" ]
   }
-  configs += [ ":pdfium_config" ]
+  configs += [ ":pdfium_core_config" ]
 }
 
 config("fxge_warnings") {
@@ -639,7 +642,7 @@
       "core/fxcrt/include/fx_arb.h",
     ]
   }
-  configs += [ ":pdfium_config" ]
+  configs += [ ":pdfium_core_config" ]
 }
 
 static_library("fxge") {
@@ -700,7 +703,7 @@
 
   configs += [
     ":fxge_warnings",
-    ":pdfium_config",
+    ":pdfium_core_config",
   ]
 
   if (pdf_use_skia) {
@@ -743,7 +746,7 @@
     "fpdfsdk/fxedit/include/fxet_edit.h",
     "fpdfsdk/fxedit/include/fxet_list.h",
   ]
-  configs += [ ":pdfium_config" ]
+  configs += [ ":pdfium_core_config" ]
 }
 
 static_library("pdfwindow") {
@@ -781,7 +784,7 @@
     "fpdfsdk/pdfwindow/PWL_Wnd.cpp",
     "fpdfsdk/pdfwindow/PWL_Wnd.h",
   ]
-  configs += [ ":pdfium_config" ]
+  configs += [ ":pdfium_core_config" ]
 }
 
 static_library("javascript") {
@@ -844,7 +847,7 @@
   } else {
     sources += [ "fpdfsdk/javascript/JS_Runtime_Stub.cpp" ]
   }
-  configs += [ ":pdfium_config" ]
+  configs += [ ":pdfium_core_config" ]
 }
 
 static_library("formfiller") {
@@ -868,7 +871,7 @@
     "fpdfsdk/formfiller/cffl_textfield.cpp",
     "fpdfsdk/formfiller/cffl_textfield.h",
   ]
-  configs += [ ":pdfium_config" ]
+  configs += [ ":pdfium_core_config" ]
 }
 
 if (pdf_enable_xfa) {
@@ -886,7 +889,7 @@
     deps = [
       ":xfa",
     ]
-    configs += [ ":pdfium_config" ]
+    configs += [ ":pdfium_core_config" ]
   }
 
   static_library("xfa") {
@@ -1587,7 +1590,7 @@
       ]
     }
     configs += [
-      ":pdfium_config",
+      ":pdfium_core_config",
       ":xfa_warnings",
     ]
   }
@@ -1642,7 +1645,7 @@
       "//v8/include",
     ]
   }
-  configs += [ ":pdfium_config" ]
+  configs += [ ":pdfium_core_config" ]
 }
 
 test("pdfium_embeddertests") {
@@ -1695,7 +1698,7 @@
     ]
     configs += [ "//v8:external_startup_data" ]
   }
-  configs += [ ":pdfium_config" ]
+  configs += [ ":pdfium_core_config" ]
 }
 
 if (pdf_is_standalone) {
diff --git a/third_party/BUILD.gn b/third_party/BUILD.gn
index 6a070f7..1564a97 100644
--- a/third_party/BUILD.gn
+++ b/third_party/BUILD.gn
@@ -12,11 +12,15 @@
   ]
 }
 
+config("pdfium_third_party_config") {
+  configs = ["..:pdfium_common_config"]
+}
+
 source_set("bigint") {
   configs -= [ "//build/config/compiler:chromium_code" ]
   configs += [
     "//build/config/compiler:no_chromium_code",
-    "../:pdfium_config",
+    ":pdfium_third_party_config",
   ]
   sources = [
     "bigint/BigInteger.cc",
@@ -47,7 +51,7 @@
   configs -= [ "//build/config/compiler:chromium_code" ]
   configs += [
     "//build/config/compiler:no_chromium_code",
-    "../:pdfium_config",
+    ":pdfium_third_party_config",
 
     # Must be after no_chromium_code for warning flags to be ordered correctly.
     ":fx_freetype_warnings",
@@ -99,7 +103,7 @@
     configs -= [ "//build/config/compiler:chromium_code" ]
     configs += [
       "//build/config/compiler:no_chromium_code",
-      "../:pdfium_config",
+      ":pdfium_third_party_config",
 
       # Must be after no_chromium_code for warning flags to be ordered correctly.
       ":fx_agg_warnings",
@@ -142,7 +146,7 @@
   configs -= [ "//build/config/compiler:chromium_code" ]
   configs += [
     "//build/config/compiler:no_chromium_code",
-    "../:pdfium_config",
+    ":pdfium_third_party_config",
 
     # Must be after no_chromium_code for warning flags to be ordered correctly.
     ":fx_lcms2_warnings",
@@ -190,7 +194,7 @@
   configs -= [ "//build/config/compiler:chromium_code" ]
   configs += [
     "//build/config/compiler:no_chromium_code",
-    "../:pdfium_config",
+    ":pdfium_third_party_config",
 
     # Must be after no_chromium_code for warning flags to be ordered correctly.
     ":jpeg_warnings",
@@ -268,7 +272,7 @@
   configs -= [ "//build/config/compiler:chromium_code" ]
   configs += [
     "//build/config/compiler:no_chromium_code",
-    "../:pdfium_config",
+    ":pdfium_third_party_config",
 
     # Must be after no_chromium_code for warning flags to be ordered correctly.
     ":fx_libopenjpeg_warnings",
@@ -300,7 +304,7 @@
   configs -= [ "//build/config/compiler:chromium_code" ]
   configs += [
     "//build/config/compiler:no_chromium_code",
-    "../:pdfium_config",
+    ":pdfium_third_party_config",
   ]
   sources = [
     "libpng16/png.c",
@@ -334,7 +338,7 @@
     configs -= [ "//build/config/compiler:chromium_code" ]
     configs += [
       "//build/config/compiler:no_chromium_code",
-      "../:pdfium_config",
+      ":pdfium_third_party_config",
     ]
     if (is_win) {
       # Need to undefine the macro since it is redefined in
@@ -398,7 +402,7 @@
   configs -= [ "//build/config/compiler:chromium_code" ]
   configs += [
     "//build/config/compiler:no_chromium_code",
-    "../:pdfium_config",
+    ":pdfium_third_party_config",
 
     # Must be after no_chromium_code for warning flags to be ordered correctly.
     ":fx_zlib_warnings",
@@ -426,7 +430,7 @@
   configs -= [ "//build/config/compiler:chromium_code" ]
   configs += [
     "//build/config/compiler:no_chromium_code",
-    "../:pdfium_config",
+    ":pdfium_third_party_config",
   ]
   sources = [
     "base/logging.h",