Port https://codereview.chromium.org/398163006 to gn.
[pdfium.git] / BUILD.gn
index dd6a64e..288365d 100644 (file)
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -38,8 +38,22 @@ config("pdfium_config") {
       "/wd4146",
       "/wd4333",
       "/wd4345",
+      "/wd4267",
+      # TODO(thestig): Fix all instances, remove this, pdfium:29
+      "/wd4245",
+      "/wd4310",
+      "/wd4389",
+      "/wd4701",
+      "/wd4702",
+      "/wd4706",
+      "/wd4800",
     ]
   }
+
+  if (is_clang) {
+    # TODO(thestig): Fix all instances, remove this, pdfium:29
+    cflags += [ "-Wno-sign-compare" ]
+  }
 }
 
 static_library("pdfium") {
@@ -87,11 +101,7 @@ static_library("pdfium") {
   ]
 
   libs = []
-  configs -= [ "//build/config/compiler:chromium_code" ]
-  configs += [
-    ":pdfium_config",
-    "//build/config/compiler:no_chromium_code",
-  ]
+  configs += [ ":pdfium_config" ]
 
   deps = [
     "third_party:bigint",
@@ -157,11 +167,7 @@ source_set("test_support") {
       "//v8/include",
     ]
   }
-  configs -= [ "//build/config/compiler:chromium_code" ]
-  configs += [
-    ":pdfium_config",
-    "//build/config/compiler:no_chromium_code",
-  ]
+  configs += [ ":pdfium_config" ]
 }
 
 # Targets below this are only visible within this file (and to the
@@ -178,11 +184,7 @@ static_library("fdrm") {
     "core/src/fdrm/crypto/fx_crypt_aes.cpp",
     "core/src/fdrm/crypto/fx_crypt_sha.cpp",
   ]
-  configs -= [ "//build/config/compiler:chromium_code" ]
-  configs += [
-    ":pdfium_config",
-    "//build/config/compiler:no_chromium_code",
-  ]
+  configs += [ ":pdfium_config" ]
 }
 
 static_library("fpdfdoc") {
@@ -211,11 +213,7 @@ static_library("fpdfdoc") {
     "core/src/fpdfdoc/pdf_vt.h",
     "core/src/fpdfdoc/tagged_int.h",
   ]
-  configs -= [ "//build/config/compiler:chromium_code" ]
-  configs += [
-    ":pdfium_config",
-    "//build/config/compiler:no_chromium_code",
-  ]
+  configs += [ ":pdfium_config" ]
 }
 
 static_library("fpdfapi") {
@@ -331,11 +329,7 @@ static_library("fpdfapi") {
     "core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp",
     "core/src/fpdfapi/fpdf_render/render_int.h",
   ]
-  configs -= [ "//build/config/compiler:chromium_code" ]
-  configs += [
-    ":pdfium_config",
-    "//build/config/compiler:no_chromium_code",
-  ]
+  configs += [ ":pdfium_config" ]
 }
 
 static_library("fpdftext") {
@@ -350,11 +344,7 @@ static_library("fpdftext") {
     "core/src/fpdftext/unicodenormalizationdata.cpp",
     "core/src/fpdftext/unicodenormalizationdata.h",
   ]
-  configs -= [ "//build/config/compiler:chromium_code" ]
-  configs += [
-    ":pdfium_config",
-    "//build/config/compiler:no_chromium_code",
-  ]
+  configs += [ ":pdfium_config" ]
 }
 
 static_library("fxcodec") {
@@ -368,7 +358,6 @@ static_library("fxcodec") {
     "core/include/fxcodec/fx_codec.h",
     "core/include/fxcodec/fx_codec_def.h",
     "core/include/fxcodec/fx_codec_flate.h",
-    "core/include/fxcodec/fx_codec_provider.h",
     "core/src/fxcodec/codec/codec_int.h",
     "core/src/fxcodec/codec/fx_codec.cpp",
     "core/src/fxcodec/codec/fx_codec_fax.cpp",
@@ -417,17 +406,13 @@ static_library("fxcodec") {
     "core/src/fxcodec/jbig2/JBig2_TrdProc.cpp",
     "core/src/fxcodec/jbig2/JBig2_TrdProc.h",
   ]
-  configs -= [ "//build/config/compiler:chromium_code" ]
 
   if (is_posix) {
     # core/src/fxcodec/fx_libopenjpeg/src/fx_mct.c does an pointer-to-int
     # conversion to check that an address is 16-bit aligned (benign).
     cflags_c = [ "-Wno-pointer-to-int-cast" ]
   }
-  configs += [
-    ":pdfium_config",
-    "//build/config/compiler:no_chromium_code",
-  ]
+  configs += [ ":pdfium_config" ]
 }
 
 config("fxge_warnings") {
@@ -480,11 +465,7 @@ static_library("fxcrt") {
     "core/src/fxcrt/plex.h",
     "core/src/fxcrt/xml_int.h",
   ]
-  configs -= [ "//build/config/compiler:chromium_code" ]
-  configs += [
-    ":pdfium_config",
-    "//build/config/compiler:no_chromium_code",
-  ]
+  configs += [ ":pdfium_config" ]
 }
 
 static_library("fxge") {
@@ -550,13 +531,9 @@ static_library("fxge") {
     "core/src/fxge/ge/text_int.h",
   ]
 
-  configs -= [ "//build/config/compiler:chromium_code" ]
   configs += [
-    ":pdfium_config",
-    "//build/config/compiler:no_chromium_code",
-    # As of this writing, this needs to be last to suppress a -Wswitch warning.
-    # https://crbug.com/547906
     ":fxge_warnings",
+    ":pdfium_config",
   ]
 
   if (pdf_use_skia) {
@@ -603,11 +580,7 @@ static_library("fxedit") {
     "fpdfsdk/src/fxedit/fxet_module.cpp",
     "fpdfsdk/src/fxedit/fxet_pageobjs.cpp",
   ]
-  configs -= [ "//build/config/compiler:chromium_code" ]
-  configs += [
-    ":pdfium_config",
-    "//build/config/compiler:no_chromium_code",
-  ]
+  configs += [ ":pdfium_config" ]
 }
 
 static_library("pdfwindow") {
@@ -649,11 +622,7 @@ static_library("pdfwindow") {
     "fpdfsdk/src/pdfwindow/PWL_Utils.cpp",
     "fpdfsdk/src/pdfwindow/PWL_Wnd.cpp",
   ]
-  configs -= [ "//build/config/compiler:chromium_code" ]
-  configs += [
-    ":pdfium_config",
-    "//build/config/compiler:no_chromium_code",
-  ]
+  configs += [ ":pdfium_config" ]
 }
 
 static_library("javascript") {
@@ -714,11 +683,7 @@ static_library("javascript") {
   } else {
     sources += [ "fpdfsdk/src/javascript/JS_Runtime_Stub.cpp" ]
   }
-  configs -= [ "//build/config/compiler:chromium_code" ]
-  configs += [
-    ":pdfium_config",
-    "//build/config/compiler:no_chromium_code",
-  ]
+  configs += [ ":pdfium_config" ]
 }
 
 static_library("formfiller") {
@@ -743,11 +708,7 @@ static_library("formfiller") {
     "fpdfsdk/src/formfiller/FFL_RadioButton.cpp",
     "fpdfsdk/src/formfiller/FFL_TextField.cpp",
   ]
-  configs -= [ "//build/config/compiler:chromium_code" ]
-  configs += [
-    ":pdfium_config",
-    "//build/config/compiler:no_chromium_code",
-  ]
+  configs += [ ":pdfium_config" ]
 }
 
 test("pdfium_unittests") {
@@ -767,17 +728,14 @@ test("pdfium_unittests") {
     ":test_support",
   ]
   include_dirs = [ "." ]
-  configs -= [ "//build/config/compiler:chromium_code" ]
-  configs += [
-    ":pdfium_config",
-    "//build/config/compiler:no_chromium_code",
-  ]
+  configs += [ ":pdfium_config" ]
 }
 
 test("pdfium_embeddertests") {
   sources = [
     "core/src/fpdfapi/fpdf_parser/fpdf_parser_decode_embeddertest.cpp",
     "core/src/fpdfapi/fpdf_parser/fpdf_parser_parser_embeddertest.cpp",
+    "core/src/fpdfapi/fpdf_render/fpdf_render_pattern_embeddertest.cpp",
     "fpdfsdk/src/fpdf_dataavail_embeddertest.cpp",
     "fpdfsdk/src/fpdfdoc_embeddertest.cpp",
     "fpdfsdk/src/fpdfformfill_embeddertest.cpp",
@@ -812,9 +770,5 @@ test("pdfium_embeddertests") {
       "//v8/include",
     ]
   }
-  configs -= [ "//build/config/compiler:chromium_code" ]
-  configs += [
-    ":pdfium_config",
-    "//build/config/compiler:no_chromium_code",
-  ]
+  configs += [ ":pdfium_config" ]
 }