diff options
author | Mike Klein <mtklein@chromium.org> | 2016-10-04 17:09:13 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2016-10-04 21:57:31 +0000 |
commit | 121563eb4a0203a8b85ea5fe7caedf6fb35f04bf (patch) | |
tree | f68daaf6384103336fe7f6ea831202df01b44955 | |
parent | 433b306a705e026c93335a90bd056b6e8121bfac (diff) |
Fold extra_*_flags into GN as a config.
This should make them visible to things like gn_to_cmake.py.
I'm not exactly sure what this implies about ordering and overriding.
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2938
Change-Id: I0740613993fb5bbfb8363cfa126d1f59768abf60
Reviewed-on: https://skia-review.googlesource.com/2938
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>
8 files changed, 30 insertions, 22 deletions
diff --git a/gn/BUILD.gn b/gn/BUILD.gn index 0c60ac8e1f..5622149d0c 100644 --- a/gn/BUILD.gn +++ b/gn/BUILD.gn @@ -16,10 +16,10 @@ declare_args() { windk = "" - extra_cflags = "" - extra_cflags_c = "" - extra_cflags_cc = "" - extra_ldflags = "" + extra_cflags = [] + extra_cflags_c = [] + extra_cflags_cc = [] + extra_ldflags = [] cc_wrapper = "" } @@ -228,6 +228,13 @@ config("default") { } } +config("extra_flags") { + cflags = extra_cflags + cflags_c = extra_cflags_c + cflags_cc = extra_cflags_cc + ldflags = extra_ldflags +} + config("debug_symbols") { # It's annoying to wait for full debug symbols to push over # to Android devices. -gline-tables-only is a lot slimmer. @@ -365,24 +372,22 @@ toolchain("gcc_like") { tool("cc") { depfile = "{{output}}.d" - command = "$cc_wrapper $cc -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_c}} $extra_cflags $extra_cflags_c -c {{source}} -o {{output}}" + command = "$cc_wrapper $cc -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_c}} -c {{source}} -o {{output}}" depsformat = "gcc" outputs = [ "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o", ] - description = - "$cc_wrapper $cc ... $extra_cflags $extra_cflags_c -o {{output}}" + description = "$cc_wrapper $cc ... -o {{output}}" } tool("cxx") { depfile = "{{output}}.d" - command = "$cc_wrapper $cxx -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_cc}} $extra_cflags $extra_cflags_cc -c {{source}} -o {{output}}" + command = "$cc_wrapper $cxx -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_cc}} -c {{source}} -o {{output}}" depsformat = "gcc" outputs = [ "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o", ] - description = - "$cc_wrapper $cxx ... $extra_cflags $extra_cflags_cc -o {{output}}" + description = "$cc_wrapper $cxx ... -o {{output}}" } tool("asm") { @@ -413,21 +418,21 @@ toolchain("gcc_like") { rpath = "-Wl,-install_name,@rpath/$soname" } - command = "$cc_wrapper $cxx -shared {{ldflags}} {{inputs}} {{solibs}} {{libs}} $rpath $extra_ldflags -o {{output}}" + command = "$cc_wrapper $cxx -shared {{ldflags}} {{inputs}} {{solibs}} {{libs}} $rpath -o {{output}}" outputs = [ "{{root_out_dir}}/$soname", ] output_prefix = "lib" default_output_extension = ".so" - description = "$cc_wrapper $cxx -shared ... $extra_ldflags -o {{output}}" + description = "$cc_wrapper $cxx -shared ... -o {{output}}" } tool("link") { - command = "$cc_wrapper $cxx {{ldflags}} {{inputs}} {{solibs}} {{libs}} $extra_ldflags -o {{output}}" + command = "$cc_wrapper $cxx {{ldflags}} {{inputs}} {{solibs}} {{libs}} -o {{output}}" outputs = [ "{{root_out_dir}}/{{target_output_name}}{{output_extension}}", ] - description = "$cc_wrapper $cxx ... $extra_ldflags -o {{output}}" + description = "$cc_wrapper $cxx ... -o {{output}}" } tool("stamp") { diff --git a/gn/BUILDCONFIG.gn b/gn/BUILDCONFIG.gn index 84e092426b..2f8670a563 100644 --- a/gn/BUILDCONFIG.gn +++ b/gn/BUILDCONFIG.gn @@ -125,9 +125,10 @@ if (!is_debug) { if (!is_official_build) { default_configs += [ "//gn:debug_symbols" ] } +default_configs += [ "//gn:extra_flags" ] set_defaults("executable") { - configs = default_configs + [ "//gn:executable" ] + configs = [ "//gn:executable" ] + default_configs } set_defaults("source_set") { diff --git a/infra/bots/recipe_modules/flavor/gn_flavor.py b/infra/bots/recipe_modules/flavor/gn_flavor.py index 44131eb3ce..a4d5fca05d 100644 --- a/infra/bots/recipe_modules/flavor/gn_flavor.py +++ b/infra/bots/recipe_modules/flavor/gn_flavor.py @@ -89,13 +89,15 @@ class GNFlavorUtils(default_flavor.DefaultFlavorUtils): for (k,v) in { 'cc': cc, 'cxx': cxx, - 'extra_cflags': ' '.join(extra_cflags), - 'extra_ldflags': ' '.join(extra_ldflags), 'sanitize': extra_config if 'SAN' in extra_config else '', 'target_cpu': 'x86' if target_arch == 'x86' else '', }.iteritems(): if v: args[k] = '"%s"' % v + if extra_cflags: + args['extra_cflags'] = repr(extra_cflags).replace("'", '"') + if extra_ldflags: + args['extra_ldflags'] = repr(extra_ldflags).replace("'", '"') gn_args = ' '.join('%s=%s' % (k,v) for (k,v) in sorted(args.iteritems())) diff --git a/infra/bots/recipes/swarm_compile.expected/Build-Ubuntu-Clang-x86_64-Debug-ASAN.json b/infra/bots/recipes/swarm_compile.expected/Build-Ubuntu-Clang-x86_64-Debug-ASAN.json index 827ad8a49b..8d0c0cbd7c 100644 --- a/infra/bots/recipes/swarm_compile.expected/Build-Ubuntu-Clang-x86_64-Debug-ASAN.json +++ b/infra/bots/recipes/swarm_compile.expected/Build-Ubuntu-Clang-x86_64-Debug-ASAN.json @@ -134,7 +134,7 @@ "gn", "gen", "[CUSTOM_/_B_WORK]/skia/out/Build-Ubuntu-Clang-x86_64-Debug-ASAN/Debug", - "--args=cc=\"[SLAVE_BUILD]/clang_linux/bin/clang\" cxx=\"[SLAVE_BUILD]/clang_linux/bin/clang++\" extra_ldflags=\"-fuse-ld=lld\" sanitize=\"ASAN\"" + "--args=cc=\"[SLAVE_BUILD]/clang_linux/bin/clang\" cxx=\"[SLAVE_BUILD]/clang_linux/bin/clang++\" extra_ldflags=[\"-fuse-ld=lld\"] sanitize=\"ASAN\"" ], "cwd": "[CUSTOM_/_B_WORK]/skia", "env": { diff --git a/infra/bots/recipes/swarm_compile.expected/Build-Ubuntu-Clang-x86_64-Debug-GN.json b/infra/bots/recipes/swarm_compile.expected/Build-Ubuntu-Clang-x86_64-Debug-GN.json index 10141387e4..f3a6c826f0 100644 --- a/infra/bots/recipes/swarm_compile.expected/Build-Ubuntu-Clang-x86_64-Debug-GN.json +++ b/infra/bots/recipes/swarm_compile.expected/Build-Ubuntu-Clang-x86_64-Debug-GN.json @@ -134,7 +134,7 @@ "gn", "gen", "[CUSTOM_/_B_WORK]/skia/out/Build-Ubuntu-Clang-x86_64-Debug-GN/Debug", - "--args=cc=\"[SLAVE_BUILD]/clang_linux/bin/clang\" cxx=\"[SLAVE_BUILD]/clang_linux/bin/clang++\" extra_ldflags=\"-fuse-ld=lld\"" + "--args=cc=\"[SLAVE_BUILD]/clang_linux/bin/clang\" cxx=\"[SLAVE_BUILD]/clang_linux/bin/clang++\" extra_ldflags=[\"-fuse-ld=lld\"]" ], "cwd": "[CUSTOM_/_B_WORK]/skia", "env": { diff --git a/infra/bots/recipes/swarm_compile.expected/Build-Ubuntu-GCC-x86_64-Debug-MSAN.json b/infra/bots/recipes/swarm_compile.expected/Build-Ubuntu-GCC-x86_64-Debug-MSAN.json index eb18746e4c..febfd4390f 100644 --- a/infra/bots/recipes/swarm_compile.expected/Build-Ubuntu-GCC-x86_64-Debug-MSAN.json +++ b/infra/bots/recipes/swarm_compile.expected/Build-Ubuntu-GCC-x86_64-Debug-MSAN.json @@ -134,7 +134,7 @@ "gn", "gen", "[CUSTOM_/_B_WORK]/skia/out/Build-Ubuntu-GCC-x86_64-Debug-MSAN/Debug", - "--args=cc=\"gcc\" cxx=\"g++\" extra_ldflags=\"-L[SLAVE_BUILD]/clang_linux/msan\" sanitize=\"MSAN\" skia_use_fontconfig=false" + "--args=cc=\"gcc\" cxx=\"g++\" extra_ldflags=[\"-L[SLAVE_BUILD]/clang_linux/msan\"] sanitize=\"MSAN\" skia_use_fontconfig=false" ], "cwd": "[CUSTOM_/_B_WORK]/skia", "env": { diff --git a/infra/bots/recipes/swarm_compile.expected/Build-Ubuntu-GCC-x86_64-Debug-SK_USE_DISCARDABLE_SCALEDIMAGECACHE.json b/infra/bots/recipes/swarm_compile.expected/Build-Ubuntu-GCC-x86_64-Debug-SK_USE_DISCARDABLE_SCALEDIMAGECACHE.json index 32331bdac8..b668f31e93 100644 --- a/infra/bots/recipes/swarm_compile.expected/Build-Ubuntu-GCC-x86_64-Debug-SK_USE_DISCARDABLE_SCALEDIMAGECACHE.json +++ b/infra/bots/recipes/swarm_compile.expected/Build-Ubuntu-GCC-x86_64-Debug-SK_USE_DISCARDABLE_SCALEDIMAGECACHE.json @@ -134,7 +134,7 @@ "gn", "gen", "[CUSTOM_/_B_WORK]/skia/out/Build-Ubuntu-GCC-x86_64-Debug-SK_USE_DISCARDABLE_SCALEDIMAGECACHE/Debug", - "--args=cc=\"gcc\" cxx=\"g++\" extra_cflags=\"-DSK_USE_DISCARDABLE_SCALEDIMAGECACHE\"" + "--args=cc=\"gcc\" cxx=\"g++\" extra_cflags=[\"-DSK_USE_DISCARDABLE_SCALEDIMAGECACHE\"]" ], "cwd": "[CUSTOM_/_B_WORK]/skia", "env": { diff --git a/infra/bots/recipes/swarm_compile.expected/Build-Ubuntu-GCC-x86_64-Release-Fast.json b/infra/bots/recipes/swarm_compile.expected/Build-Ubuntu-GCC-x86_64-Release-Fast.json index 2880ae25bf..5b57b34bd1 100644 --- a/infra/bots/recipes/swarm_compile.expected/Build-Ubuntu-GCC-x86_64-Release-Fast.json +++ b/infra/bots/recipes/swarm_compile.expected/Build-Ubuntu-GCC-x86_64-Release-Fast.json @@ -134,7 +134,7 @@ "gn", "gen", "[CUSTOM_/_B_WORK]/skia/out/Build-Ubuntu-GCC-x86_64-Release-Fast/Release", - "--args=cc=\"gcc\" cxx=\"g++\" extra_cflags=\"-march=native -fomit-frame-pointer -O3 -ffp-contract=off\" is_debug=false" + "--args=cc=\"gcc\" cxx=\"g++\" extra_cflags=[\"-march=native\", \"-fomit-frame-pointer\", \"-O3\", \"-ffp-contract=off\"] is_debug=false" ], "cwd": "[CUSTOM_/_B_WORK]/skia", "env": { |