Skip to content

Commit

Permalink
Work on Mac GN build.
Browse files Browse the repository at this point in the history
This fixes a lot of minor mistakes (mostly missing/extra files and flags) for the Mac GN build.

I separated out some clang flags into a config for extra clang warnings. Several of the third party libraries needed to remove this.

Removes the use_nss flag and uses !use_openssl. This is a result of discussion with rsleevi.

Removes extra duplicate net build file from secondary tree.

ui/gesture_events seems to be getting compiled in GN with more strict warnings than in GYP. Rather than fix this, I fixed the warning in the gesture recognizer unit test. It was returning a const copy (the const is pointless when you're copying).

This also removes a bunch of old GYP integration stuff that was left in the GN build.

R=scottmg@chromium.org

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@264626 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
brettw@chromium.org committed Apr 17, 2014
1 parent 64e53aa commit ab9ce6e
Show file tree
Hide file tree
Showing 25 changed files with 229 additions and 1,583 deletions.
5 changes: 2 additions & 3 deletions build/config/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,10 @@ config("feature_flags") {
if (use_glib) {
defines += [ "USE_GLIB=1" ]
}
if (use_nss) {
defines += [ "USE_NSS=1" ]
}
if (use_openssl) {
defines += [ "USE_OPENSSL=1" ]
} else {
defines += [ "USE_NSS=1" ]
}
if (use_ozone) {
defines += [ "USE_OZONE=1" ]
Expand Down
16 changes: 4 additions & 12 deletions build/config/BUILDCONFIG.gn
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,6 @@ declare_args() {
# the default toolchain to 64-bit.
force_win64 = false

# Set to true on the command line when invoked by GYP. Build files can key
# off of this to make any GYP-output-specific changes to the build.
is_gyp = false

# Selects the desired build flavor. Official builds get additional
# processing to prepare for release. Normally you will want to develop and
# test with this flag off.
Expand All @@ -67,13 +63,6 @@ declare_args() {

# Compile for Thread Sanitizer to find threading bugs.
is_tsan = false

# When running in gyp-generating mode, this is the root of the build tree.
gyp_output_dir = "out"

# When running in gyp-generating mode, this flag indicates if the current GYP
# generator is xcode. Can only be true when building for iOS).
is_gyp_xcode_generator = false
}

# =============================================================================
Expand Down Expand Up @@ -365,7 +354,10 @@ if (!is_win) {
native_compiler_configs += [ "//build/config/gcc:symbol_visibility_hidden" ]
}
if (is_clang) {
native_compiler_configs += [ "//build/config/clang:find_bad_constructs" ]
native_compiler_configs += [
"//build/config/clang:find_bad_constructs",
"//build/config/clang:extra_warnings",
]
}

# Optimizations and debug checking.
Expand Down
11 changes: 11 additions & 0 deletions build/config/clang/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,14 @@ config("find_bad_constructs") {
]
}
}

# Enables some extra Clang-specific warnings. Some third-party code won't
# compile with these so may want to remove this config.
config("extra_warnings") {
cflags = [
"-Wheader-hygiene"

# Warns when a const char[] is converted to bool.
"-Wstring-conversion",
]
}
7 changes: 0 additions & 7 deletions build/config/compiler/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -517,12 +517,8 @@ config("default_warnings") {
]
}

# TODO(brettw) Ones below here should be clang-only when we have a flag
# for it.
if (is_clang) {
cflags += [
"-Wheader-hygiene",

# This warns on using ints as initializers for floats in
# initializer lists (e.g. |int a = f(); CGSize s = { a, a };|),
# which happens in several places in chrome code. Not sure if
Expand All @@ -545,9 +541,6 @@ config("default_warnings") {

# Clang spots more unused functions.
"-Wno-unused-function",

# Warns when a const char[] is converted to bool.
"-Wstring-conversion",
]
}

Expand Down
6 changes: 0 additions & 6 deletions build/config/crypto.gni
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,3 @@ declare_args() {
# code, and is experimental in other cases (see http://crbug.com/62803).
use_openssl = is_android || is_nacl
}

if (is_linux && !use_openssl) {
use_nss = true
} else {
use_nss = false
}
9 changes: 1 addition & 8 deletions build/config/ios/ios_sdk.gni
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,12 @@ declare_args() {
# target is for running on the device. The default value is to use the
# Simulator except when targeting GYP's Xcode builds (for compat with the
# existing GYP build).
use_ios_simulator = !is_gyp_xcode_generator
use_ios_simulator = true

# Version of iOS that we're targeting.
ios_deployment_target = "6.0"
}

# Simulator flag explicitly passed in.
if (!is_gyp_xcode_generator) {
# The Ninja build currently only targets the simulator.
assert(use_ios_simulator,
"You can't do an iOS device build using Ninja yet.")
}

if (ios_sdk_path == "") {
# Compute default target.
if (use_ios_simulator) {
Expand Down
58 changes: 0 additions & 58 deletions build/toolchain/android/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -16,64 +16,6 @@ if (build_cpu_arch == "x64") {
assert(false, "Need Android toolchain support for your build OS.")
}

if (is_gyp) {
# Set the compilers for GYP to use. This logic is only relevant to GYP where
# there is "a" target compiler. In native GN builds, we have separate
# compilers for the toolchains below, any or all of which could be active in
# any given build.
if (is_clang) {
# Set the GYP header for all toolchains when running under Clang.
make_global_settings = make_clang_global_settings
} else {
# Find the compiler for GYP for non-Clang Android.
if (cpu_arch == "x86") {
android_toolchain_arch = "x86-4.6"
} else if (cpu_arch == "arm") {
android_toolchain_arch = "arm-linux-androideabi-4.6"
} else if (cpu_arch == "mipsel") {
android_toolchain_arch = "mipsel-linux-android-4.6"
} else {
assert(false, "Need Android toolchain support for your platform.")
}

# The extra slash before "toolchains" is because GYP generates this and we
# have to match the make_global_settings character-for-character,
# TODO(brettw) remove extra slash before toolchains when GYP compat is no
# longer necessary.
android_toolchain =
"$android_ndk_root//toolchains/$android_toolchain_arch/prebuilt/$build_os-$android_host_arch/bin"

# This script will find the compilers for the given Android toolchain
# directory.
android_compilers = exec_script("find_android_compiler.py",
[android_toolchain], "value")
make_global_settings =
"['CC', '" + android_compilers[0] + "']," +
"['CXX', '" + android_compilers[1] + "']," +
"['CC.host', '" + android_compilers[2] + "']," +
"['CXX.host', '" + android_compilers[3] + "'],"
}

if (use_goma) {
# There is a TODO(yyanagisawa) in common.gypi about the make generator not
# supporting CC_wrapper without CC. As a result, we must add a condition
# when on the generator when we're not explicitly setting the variables
# above (which happens when gyp_header is empty at this point).
#
# GYP will interpret the file once for each generator, so we have to write
# this condition into the GYP file since the user could have more than one
# generator set.
gyp_header =
"'conditions': [" +
"['\"<(GENERATOR)\"==\"ninja\"', { 'make_global_settings': [" +
make_global_settings +
make_goma_global_settings +
"]}]],"
} else {
gyp_header = "'make_global_settings': [" + make_global_settings + "],"
}
}

gcc_toolchain("x86") {
prefix = "$android_ndk_root/toolchains/x86-4.6/prebuilt/$build_os-$android_host_arch/bin/i686-linux-android-"
cc = prefix + "gcc"
Expand Down
27 changes: 0 additions & 27 deletions build/toolchain/clang.gni
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,3 @@ declare_args() {
# with the allocation type.
use_clang_type_profiler = false
}

if (is_clang) {
# Define "make_clang_dir" which is the directory relative to the source root
# of the clang directory we're using. This is used for defining the header
# for GYP so it must match the directory format of GYP (rather than using
# GN-style "//..." paths).
if (is_linux && use_clang_type_profiler) {
if (cpu_arch == "x64") {
make_clang_dir = "third_party/llvm-allocated-type/Linux_x64"
} else {
# 32-bit Clang is unsupported. It may not build. Put your 32-bit Clang in
# this directory at your own risk if needed for some purpose (e.g. to
# compare 32-bit and 64-bit behavior like memory usage). Any failure by
# this compiler should not close the tree.
make_clang_dir = "third_party/llvm-allocated-type/Linux_ia32"
}
} else {
make_clang_dir = "third_party/llvm-build/Release+Asserts"
}

# This includes the array values but not the 'make_global_settings' name.
make_clang_global_settings =
"['CC', '$make_clang_dir/bin/clang']," +
"['CXX', '$make_clang_dir/bin/clang++']," +
"['CC.host', '\$(CC)']," +
"['CXX.host', '\$(CXX)'],"
}
40 changes: 0 additions & 40 deletions build/toolchain/linux/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -7,46 +7,6 @@ import("//build/toolchain/clang.gni")
import("//build/toolchain/gcc_toolchain.gni")
import("//build/toolchain/goma.gni")

if (is_gyp) {
# Set the compilers for GYP to use. This logic is only relevant to GYP where
# there is "a" target compiler. In native GN builds, we have separate
# compilers for the toolchains below, any or all of which could be active in
# any given build.
if (is_clang) {
# Set the GYP header for all toolchains when running under Clang.
make_global_settings = make_clang_global_settings
} else {
if (cpu_arch == "mipsel") {
make_global_settings =
"['CC', '$sysroot/../bin/mipsel-linux-gnu-gcc']," +
"['CXX', '$sysroot/../bin/mipsel-linux-gnu-g++']," +
"['CC.host', '/usr/bin/gcc']," +
"['CXX.host', '/usr/bin/g++'],"
} else {
make_global_settings = ""
}
}

if (use_goma) {
# There is a TODO(yyanagisawa) in common.gypi about the make generator not
# supporting CC_wrapper without CC. As a result, we must add a condition
# when on the generator when we're not explicitly setting the variables
# above (which happens when gyp_header is empty at this point).
#
# GYP will interpret the file once for each generator, so we have to write
# this condition into the GYP file since the user could have more than one
# generator set.
gyp_header =
"'conditions':" +
"[['\"<(GENERATOR)\"==\"ninja\"', { 'make_global_settings': [" +
make_global_settings +
make_goma_global_settings +
"]}]],"
} else {
gyp_header = "'make_global_settings': [" + make_global_settings + "],"
}
}

gcc_toolchain("arm") {
cc = "arm-linux-gnueabi-gcc"
cxx = "arm-linux-gnueabi-g++"
Expand Down
24 changes: 0 additions & 24 deletions build/toolchain/mac/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -19,30 +19,6 @@ if (is_clang) {
root_build_dir)
cxx = rebase_path("//third_party/llvm-build/Release+Asserts/bin/clang++",
root_build_dir)

# Set the GYP header for all toolchains when running under Clang.
if (is_gyp) {
make_global_settings = make_clang_global_settings

if (use_goma) {
# There is a TODO(yyanagisawa) in common.gypi about the make generator not
# supporting CC_wrapper without CC. As a result, we must add a condition
# when on the generator when we're not explicitly setting the variables
# above (which happens when gyp_header is empty at this point).
#
# GYP will interpret the file once for each generator, so we have to write
# this condition into the GYP file since the user could have more than one
# generator set.
gyp_header =
"'conditions':" +
"[['\"<(GENERATOR)\"==\"ninja\"', { 'make_global_settings': [" +
make_global_settings +
make_goma_global_settings +
"]}]],"
} else {
gyp_header = "'make_global_settings': [" + make_global_settings + "],"
}
}
} else {
cc = "gcc"
cxx = "g++"
Expand Down
5 changes: 0 additions & 5 deletions build/toolchain/win/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@ exec_script("setup_toolchain.py",
stamp_command = "$python_path gyp-win-tool stamp \$out"
copy_command = "$python_path gyp-win-tool recursive-mirror \$in \$out"

if (use_goma) {
# Add the Goma compiler prefixes to the GYP file.
gyp_header = "'make_global_settings': [ $make_goma_global_settings ],"
}

# 32-bit toolchain -------------------------------------------------------------

toolchain("32") {
Expand Down
15 changes: 5 additions & 10 deletions crypto/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -106,17 +106,11 @@ component("crypto") {
]
}

if (!is_linux) {
if (use_openssl || !is_linux) {
sources -= [
"openpgp_symmetric_encryption.cc",
"openpgp_symmetric_encryption.h",
]
if (use_nss) { # Removed for non-NSS in all cases below.
sources -= [
"openpgp_symmetric_encryption.cc",
"openpgp_symmetric_encryption.h",
]
}
}
if (!is_mac) {
sources -= [
Expand All @@ -133,7 +127,8 @@ component("crypto") {
]
}

if (!use_nss) {
if (use_openssl) {
# Remove NSS files when using OpenSSL
sources -= [
"ec_private_key_nss.cc",
"ec_signature_creator_nss.cc",
Expand All @@ -153,8 +148,8 @@ component("crypto") {
"third_party/nss/rsawrapr.c",
"third_party/nss/secsign.cc",
]
}
if (!use_openssl) {
} else {
# Remove OpenSSL when using NSS.
sources -= [
"ec_private_key_openssl.cc",
"ec_signature_creator_openssl.cc",
Expand Down
24 changes: 10 additions & 14 deletions net/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ component("net") {
]
}

if (!use_nss) {
if (use_openssl) {
sources -= [
"cert/cert_verify_proc_nss.cc",
"cert/cert_verify_proc_nss.h",
Expand Down Expand Up @@ -396,19 +396,15 @@ component("net") {
}

if (is_mac) {
sources -= [
"ssl/client_cert_store_nss.cc",
"ssl/client_cert_store_nss.h",
]
deps += [
"//third_party/nss:nspr",
"//third_party/nss",
]
libs = [
"$SDKROOT/System/Library/Frameworks/Foundation.framework",
"$SDKROOT/System/Library/Frameworks/Security.framework",
"$SDKROOT/System/Library/Frameworks/SystemConfiguration.framework",
"$SDKROOT/usr/lib/libresolv.dylib",
"Foundation.framework",
"Security.framework",
"SystemConfiguration.framework",
"resolv",
]
}

Expand All @@ -418,11 +414,11 @@ component("net") {
"//third_party/nss",
]
libs = [
"$SDKROOT/System/Library/Frameworks/CFNetwork.framework",
"$SDKROOT/System/Library/Frameworks/MobileCoreServices.framework",
"$SDKROOT/System/Library/Frameworks/Security.framework",
"$SDKROOT/System/Library/Frameworks/SystemConfiguration.framework",
"$SDKROOT/usr/lib/libresolv.dylib",
"CFNetwork.framework",
"MobileCoreServices.framework",
"Security.framework",
"SystemConfiguration.framework",
"resolv",
]
}

Expand Down
Loading

0 comments on commit ab9ce6e

Please sign in to comment.