summaryrefslogtreecommitdiff
path: root/third_party/yasm/BUILD.gn
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/yasm/BUILD.gn')
-rw-r--r--third_party/yasm/BUILD.gn76
1 files changed, 49 insertions, 27 deletions
diff --git a/third_party/yasm/BUILD.gn b/third_party/yasm/BUILD.gn
index b2dcb57c65..94dbf9131c 100644
--- a/third_party/yasm/BUILD.gn
+++ b/third_party/yasm/BUILD.gn
@@ -29,10 +29,38 @@
import("//build/config/compiler/compiler.gni")
+configs_to_delete = []
+configs_to_add = []
+if (is_debug) {
+ configs_to_delete += [
+ # Build with full optimizations even on debug configurations, because some
+ # yasm build steps (highbd_sad4d_sse2.asm) can take ~33 seconds or more in
+ # debug component builds on Windows. Enabling compiler optimizations saves
+ # ~5 seconds.
+ "//build/config/compiler:default_optimization",
+
+ # Don't define _DEBUG. Modest savings, but good for consistency.
+ "//build/config:debug",
+ ]
+ configs_to_add += [
+ "//build/config:release",
+ "//build/config/compiler:optimize_max",
+ ]
+ if (is_win) {
+ # This switches to using the release CRT. On debug component builds of
+ # highbd_sad4d_sse2.asm on Windows this saves about 15 s.
+ configs_to_delete += [ "//build/config/win:default_crt" ]
+ configs_to_add += [ "//build/config/win:release_crt" ]
+ }
+}
+
if (current_toolchain == host_toolchain) {
- # Various files referenced by multiple targets.
- yasm_gen_include_dir = "$target_gen_dir/include"
- config_makefile = "source/config/$host_os/Makefile"
+ # Various files referenced by multiple targets. yasm_gen_include_dir was moved
+ # from $target_gen_dir/include to avoid conflicts with x86insn_gas.c and
+ # x86insn_nasm.c. These files were previously generated during the build but
+ # are now shipped pre-generated by yasm.
+ yasm_gen_include_dir = "$target_gen_dir/gen_include"
+ config_makefile = "source/config/Makefile"
version_file = "version.mac"
import("//build/compiled_action.gni")
@@ -94,6 +122,10 @@ if (current_toolchain == host_toolchain) {
"//build/config/compiler:no_chromium_code",
]
+ # Must be compatible with yasm_utils/yasm
+ configs -= configs_to_delete
+ configs += configs_to_add
+
deps = [
":yasm_utils",
"//build/config:exe_and_shlib_deps",
@@ -116,6 +148,10 @@ if (current_toolchain == host_toolchain) {
":yasm_config",
"//build/config/compiler:no_chromium_code",
]
+
+ # Must be compatible with yasm
+ configs -= configs_to_delete
+ configs += configs_to_add
}
executable("genstring") {
@@ -261,6 +297,7 @@ if (current_toolchain == host_toolchain) {
"source/patched-yasm/modules/objfmts/dbg/dbg-objfmt.c",
"source/patched-yasm/modules/objfmts/elf/elf-objfmt.c",
"source/patched-yasm/modules/objfmts/elf/elf-x86-amd64.c",
+ "source/patched-yasm/modules/objfmts/elf/elf-x86-x32.c",
"source/patched-yasm/modules/objfmts/elf/elf-x86-x86.c",
"source/patched-yasm/modules/objfmts/elf/elf.c",
"source/patched-yasm/modules/objfmts/macho/macho-objfmt.c",
@@ -272,6 +309,8 @@ if (current_toolchain == host_toolchain) {
"source/patched-yasm/modules/parsers/nasm/nasm-parse.c",
"source/patched-yasm/modules/parsers/nasm/nasm-parser.c",
"source/patched-yasm/modules/preprocs/cpp/cpp-preproc.c",
+ "source/patched-yasm/modules/preprocs/gas/gas-eval.c",
+ "source/patched-yasm/modules/preprocs/gas/gas-preproc.c",
"source/patched-yasm/modules/preprocs/nasm/nasm-eval.c",
"source/patched-yasm/modules/preprocs/nasm/nasm-pp.c",
"source/patched-yasm/modules/preprocs/nasm/nasm-preproc.c",
@@ -308,12 +347,13 @@ if (current_toolchain == host_toolchain) {
if (is_official_build && full_wpo_on_official) {
configs -= [ "//build/config/compiler:default_optimization" ]
configs += [ "//build/config/compiler:optimize_no_wpo" ]
+ } else {
+ configs -= configs_to_delete
+ configs += configs_to_add
}
- # Yasm generates a bunch of .c files which its source file #include.
- # Add the |target_gen_dir| into the include path so it can find them.
- # Ideally, these generated .c files would be placed into a separate
- # directory, but the gen_x86_insn.py script does not make this easy.
+ # Yasm generates a bunch of .c files which its source file #include. These
+ # are placed in |yasm_gen_include_dir|.
include_dirs = [ yasm_gen_include_dir ]
if (!is_win) {
@@ -359,9 +399,6 @@ if (current_toolchain == host_toolchain) {
"{{source}}",
rebase_path(target_gen_dir, root_build_dir) + "/{{source_name_part}}.c",
]
- deps = [
- ":generate_x86_insn",
- ]
}
# This differs from |compile_gperf| in where it places it output files.
@@ -374,8 +411,8 @@ if (current_toolchain == host_toolchain) {
#
# The output for these two are #included by
# source/patched-yasm/modules/arch/x86/x86id.c
- "$yasm_gen_include_dir/x86insn_gas.gperf",
- "$yasm_gen_include_dir/x86insn_nasm.gperf",
+ "source/patched-yasm/x86insn_gas.gperf",
+ "source/patched-yasm/x86insn_nasm.gperf",
]
outputs = [
@@ -386,9 +423,6 @@ if (current_toolchain == host_toolchain) {
rebase_path(yasm_gen_include_dir, root_build_dir) +
"/{{source_name_part}}.c",
]
- deps = [
- ":generate_x86_insn",
- ]
}
template("compile_macro") {
@@ -532,16 +566,4 @@ if (current_toolchain == host_toolchain) {
]
args = [ rebase_path(outputs[0], root_build_dir) ]
}
-
- action("generate_x86_insn") {
- script = "source/patched-yasm/modules/arch/x86/gen_x86_insn.py"
-
- # Output eventually #included by source/patched-yasm/frontends/yasm/x86id.c
- outputs = [
- "$yasm_gen_include_dir/x86insns.c",
- "$yasm_gen_include_dir/x86insn_gas.gperf",
- "$yasm_gen_include_dir/x86insn_nasm.gperf",
- ]
- args = [ rebase_path(yasm_gen_include_dir, root_build_dir) ]
- }
}