blob: 05b3336d3063871f71b110d6a9165293b8014855 [file] [log] [blame]
Dale Curtis9596cc02018-10-31 14:25:55 -07001# Copyright 2018 The Chromium Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5import("//build/config/compiler/compiler.gni")
6import("nasm_sources.gni")
7
8configs_to_delete = [
9 # Don't enable sanitizers for build tools. They slow down the overall build.
10 "//build/config/sanitizers:default_sanitizer_flags",
11]
12
13configs_to_add = []
14if (is_debug) {
15 configs_to_delete += [
16 # Build with full optimizations even on debug configurations, because some
17 # yasm build steps (highbd_sad4d_sse2.asm) can take ~33 seconds or more in
18 # debug component builds on Windows. Enabling compiler optimizations saves
19 # ~5 seconds.
20 "//build/config/compiler:default_optimization",
21
22 # Don't define _DEBUG. Modest savings, but good for consistency.
23 "//build/config:debug",
24 ]
25
26 configs_to_add += [
27 "//build/config:release",
28 "//build/config/compiler:optimize_max",
29 ]
30 if (is_win) {
31 # This switches to using the release CRT. For yasm debug component builds
32 # of highbd_sad4d_sse2.asm on Windows this saved about 15 s.
33 configs_to_delete += [ "//build/config/win:default_crt" ]
34 configs_to_add += [ "//build/config/win:release_crt" ]
35 }
36}
37
38config("nasm_config") {
39 include_dirs = [
40 ".",
41 "asm",
Dale Curtis9596cc02018-10-31 14:25:55 -070042 "disasm",
43 "include",
44 "output",
45 "x86",
46 ]
47
Dale Curtis9596cc02018-10-31 14:25:55 -070048 defines = [ "HAVE_CONFIG_H" ]
49
50 if (is_clang) {
51 cflags = [
52 # The inline functions in NASM's headers flag this.
53 "-Wno-unused-function",
54
55 # NASM writes nasm_assert(!"some string literal").
56 "-Wno-string-conversion",
57
58 # NASM sometimes redefines macros from its config.h.
59 "-Wno-macro-redefined",
Dale Curtis20920a82018-11-01 17:26:45 -070060
61 # NASM sometimes compares enums to unsigned integers.
62 "-Wno-sign-compare",
Dale Curtis9596cc02018-10-31 14:25:55 -070063 ]
64 }
65}
66
67if (current_toolchain == host_toolchain) {
68 executable("nasm") {
69 sources = nasmlib_sources + nasm_sources
Dale Curtis3dacc5e2018-11-01 10:48:41 -070070 sources += [
71 "config/config.h",
72 "config/config-mac.h",
73 "config/config-linux.h",
74 "config/config-win.h",
75 ]
Dale Curtis9596cc02018-10-31 14:25:55 -070076
77 configs -= configs_to_delete
78 configs += configs_to_add
79 configs += [ ":nasm_config" ]
80
81 deps = [
82 # Default manifest on Windows (a no-op elsewhere).
83 "//build/win:default_exe_manifest",
84 ]
85 }
86}