Skip to content

Commit

Permalink
Make *some* version of the Win GN build work.
Browse files Browse the repository at this point in the history
R=scottmg@chromium.org, brettw@chromium.org
BUG=354261

Review URL: https://codereview.chromium.org/709593004

Cr-Commit-Position: refs/heads/master@{#303366}
  • Loading branch information
dpranke authored and Commit bot committed Nov 8, 2014
1 parent 22e0435 commit 4376059
Show file tree
Hide file tree
Showing 7 changed files with 144 additions and 54 deletions.
63 changes: 63 additions & 0 deletions BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -255,4 +255,67 @@ group("root") {
"//device/usb",
]
}

if (is_win) {
# TODO(GYP): Make these work.
deps -= [
"//apps",
"//ash",
"//chrome/browser",
"//chrome/browser/devtools",
"//chrome/common",
"//chrome/plugin",
"//chrome/renderer",
"//chrome/utility",
"//components:all_components",
"//cc",
"//cc/blink",
"//content",
"//content/shell:content_shell",
"//content/test:test_support",
"//device/bluetooth",
"//extensions/browser",
"//extensions/common",
"//extensions/common/api",
"//extensions/renderer",
"//gpu",
"//google_apis",
"//google_apis/gcm",
"//jingle:notifier",
"//media",
"//media/blink",
"//media/cast",
"//media/mojo",
"//mojo",
"//pdf",
"//ppapi:ppapi_c",
"//printing",
"//remoting/client/plugin",
"//sandbox",
"//storage/browser",
"//sync",
"//third_party/WebKit/public:all_blink",
"//third_party/angle:translator",
"//third_party/leveldatabase",
"//third_party/libjingle",
"//third_party/usrsctp",
"//third_party/webrtc",
"//ui/accessibility",
"//ui/app_list",
"//ui/aura",
"//ui/base",
"//ui/display",
"//ui/events",
"//ui/gfx",
"//ui/gl",
"//ui/keyboard",
"//ui/native_theme",
"//ui/snapshot",
"//ui/surface",
"//ui/views",
"//ui/views/controls/webview",
"//ui/web_dialogs",
"//ui/wm",
]
}
}
2 changes: 1 addition & 1 deletion base/allocator/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ if (is_win) {
}
}

if (!is_android) {
if (use_allocator == "tcmalloc") {
# tcmalloc currently won't compile on Android.
source_set("tcmalloc") {
tcmalloc_dir = "//third_party/tcmalloc/chromium"
Expand Down
5 changes: 3 additions & 2 deletions build/config/allocator.gni
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

if (is_android || cpu_arch == "mipsel" || is_mac || is_asan) {

# TODO(GYP): Make tcmalloc work on win.
if (is_android || cpu_arch == "mipsel" || is_mac || is_asan || is_win) {
_default_allocator = "none"
} else {
_default_allocator = "tcmalloc"
Expand Down
25 changes: 19 additions & 6 deletions build/config/compiler/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -918,15 +918,28 @@ config("optimize_max") {
cflags = common_optimize_on_cflags
ldflags = common_optimize_on_ldflags
if (is_win) {
cflags -= [
"/Os",
]
cflags += [
"/Ot", # Favor speed over size.
"/GL", # Whole program optimization.
# Disable Warning 4702 ("Unreachable code") for the WPO/PGO builds.
# Probably anything that this would catch that wouldn't be caught in a
# normal build isn't going to actually be a bug, so the incremental value
# of C4702 for PGO builds is likely very small.
"/wd4702",
]
if (is_official_build) {
# TODO(GYP): TODO(dpranke): Should these only be on in an official
# build, or on all the time? For now we'll require official build so
# that the compile is clean.
cflags += [
"/GL", # Whole program optimization.
# Disable Warning 4702 ("Unreachable code") for the WPO/PGO builds.
# Probably anything that this would catch that wouldn't be caught in a
# normal build isn't going to actually be a bug, so the incremental
# value of C4702 for PGO builds is likely very small.
"/wd4702",
]
ldflags += [
"/LTCG",
]
}
} else {
cflags += [
"-O2",
Expand Down
4 changes: 4 additions & 0 deletions build/secondary/third_party/nss/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -1159,6 +1159,10 @@ if (is_linux) {
"USE_HW_AES",
"INTEL_GCM",
]
sources -= [
"nss/lib/freebl/mpi/mpi_amd64.c",
]

} else if (cpu_arch == "x64") {
sources -= [
"nss/lib/freebl/intel-aes-x86-masm.asm",
Expand Down
91 changes: 48 additions & 43 deletions crypto/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,9 @@ component("crypto") {
defines = [ "CRYPTO_IMPLEMENTATION" ]
}

if (is_win) {
# TODO(GYP): TODO(dpranke), fix the compile errors for this stuff
# and make it work.
if (false && is_win) {
# A minimal crypto subset for hmac-related stuff that small standalone
# targets can use to reduce code size on Windows. This does not depend on
# OpenSSL/NSS but will use Windows APIs for that functionality.
Expand Down Expand Up @@ -198,52 +200,55 @@ if (is_win) {
}
}

test("crypto_unittests") {
sources = [
# Tests.
"curve25519_unittest.cc",
"ec_private_key_unittest.cc",
"ec_signature_creator_unittest.cc",
"encryptor_unittest.cc",
"ghash_unittest.cc",
"hkdf_unittest.cc",
"hmac_unittest.cc",
"nss_util_unittest.cc",
"openssl_bio_string_unittest.cc",
"p224_unittest.cc",
"p224_spake_unittest.cc",
"random_unittest.cc",
"rsa_private_key_unittest.cc",
"rsa_private_key_nss_unittest.cc",
"secure_hash_unittest.cc",
"sha2_unittest.cc",
"signature_creator_unittest.cc",
"signature_verifier_unittest.cc",
"symmetric_key_unittest.cc",
]

if (use_openssl || !is_linux) {
sources -= [
# TODO(GYP): Make this link on win as well.
if (!is_win) {
test("crypto_unittests") {
sources = [
# Tests.
"curve25519_unittest.cc",
"ec_private_key_unittest.cc",
"ec_signature_creator_unittest.cc",
"encryptor_unittest.cc",
"ghash_unittest.cc",
"hkdf_unittest.cc",
"hmac_unittest.cc",
"nss_util_unittest.cc",
"openssl_bio_string_unittest.cc",
"p224_unittest.cc",
"p224_spake_unittest.cc",
"random_unittest.cc",
"rsa_private_key_unittest.cc",
"rsa_private_key_nss_unittest.cc",
"secure_hash_unittest.cc",
"sha2_unittest.cc",
"signature_creator_unittest.cc",
"signature_verifier_unittest.cc",
"symmetric_key_unittest.cc",
]
}

if (use_openssl) {
sources -= [ "nss_util_unittest.cc" ]
} else {
sources -= [ "openssl_bio_string_unittest.cc" ]
}
if (use_openssl || !is_linux) {
sources -= [
"rsa_private_key_nss_unittest.cc",
]
}

deps = [
":crypto",
":platform",
":test_support",
"//base",
"//base/test:run_all_unittests",
"//base/test:test_support",
"//testing/gmock",
"//testing/gtest",
]
if (use_openssl) {
sources -= [ "nss_util_unittest.cc" ]
} else {
sources -= [ "openssl_bio_string_unittest.cc" ]
}

deps = [
":crypto",
":platform",
":test_support",
"//base",
"//base/test:run_all_unittests",
"//base/test:test_support",
"//testing/gmock",
"//testing/gtest",
]
}
}

source_set("test_support") {
Expand Down
8 changes: 6 additions & 2 deletions third_party/zlib/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,15 @@ config("zlib_config") {
}

static_library("zlib_x86_simd") {
if (cpu_arch == "x86" || cpu_arch == "x64") {
if (!is_win && (cpu_arch == "x86" || cpu_arch == "x64")) {
sources = [ "crc_folding.c", "fill_window_sse.c" ]
cflags = [ "-msse2", "-msse4.2", "-mpclmul" ]
} else {
sources = [ "simd_stub.c"]
if (is_win) {
# TODO(GYP): crbug.com/431462 disable warning about structure padding.
cflags = [ "/wd4324" ]
}
}
}

Expand Down Expand Up @@ -52,7 +56,7 @@ static_library("zlib") {
"zutil.h",
]

if (cpu_arch == "x86" || cpu_arch == "x64") {
if (!is_win && (cpu_arch == "x86" || cpu_arch == "x64")) {
sources += [ "x86.c" ]
}

Expand Down

0 comments on commit 4376059

Please sign in to comment.