2022-02-14 20:08:12 +00:00
|
|
|
if (is_wasm) {
|
|
|
|
import("wasm.gni")
|
|
|
|
}
|
2019-09-25 21:14:35 +00:00
|
|
|
if (is_fuchsia) {
|
2019-11-18 16:01:05 +00:00
|
|
|
import("//build/fuchsia/sdk.gni")
|
2019-09-25 21:14:35 +00:00
|
|
|
}
|
|
|
|
|
2017-06-29 14:03:38 +00:00
|
|
|
declare_args() {
|
|
|
|
host_ar = ar
|
|
|
|
host_cc = cc
|
|
|
|
host_cxx = cxx
|
|
|
|
|
|
|
|
if (is_android) {
|
2019-07-03 15:44:21 +00:00
|
|
|
_prefix = "$ndk/toolchains/llvm/prebuilt/$ndk_host/bin"
|
2017-06-29 14:03:38 +00:00
|
|
|
if (host_os == "win") {
|
2019-07-03 15:44:21 +00:00
|
|
|
target_ar = "$_prefix/llvm-ar.exe"
|
|
|
|
target_cc = "$_prefix/clang.exe --target=$ndk_target$ndk_api -fno-addrsig"
|
|
|
|
target_cxx =
|
|
|
|
"$_prefix/clang++.exe --target=$ndk_target$ndk_api -fno-addrsig"
|
2017-06-29 14:03:38 +00:00
|
|
|
} else {
|
2019-07-03 15:44:21 +00:00
|
|
|
target_ar = "$_prefix/llvm-ar"
|
|
|
|
target_cc = "$_prefix/$ndk_target$ndk_api-clang"
|
|
|
|
target_cxx = "$_prefix/$ndk_target$ndk_api-clang++"
|
2017-06-29 14:03:38 +00:00
|
|
|
}
|
2019-09-25 21:14:35 +00:00
|
|
|
} else if (is_fuchsia && using_fuchsia_sdk) {
|
|
|
|
target_ar = rebase_path("$fuchsia_toolchain_path/bin/llvm-ar")
|
|
|
|
target_cc = rebase_path("$fuchsia_toolchain_path/bin/clang")
|
|
|
|
target_cxx = rebase_path("$fuchsia_toolchain_path/bin/clang++")
|
2019-11-18 16:01:05 +00:00
|
|
|
cflags = "--sysroot=" +
|
|
|
|
rebase_path("$fuchsia_toolchain_path/$target_cpu/sysroot")
|
2019-09-25 21:14:35 +00:00
|
|
|
link = rebase_path("$fuchsia_toolchain_path/bin/ld.lld")
|
2017-06-29 14:03:38 +00:00
|
|
|
} else {
|
|
|
|
target_ar = ar
|
|
|
|
target_cc = cc
|
|
|
|
target_cxx = cxx
|
|
|
|
}
|
|
|
|
|
|
|
|
cc_wrapper = ""
|
2019-09-02 20:50:20 +00:00
|
|
|
|
|
|
|
# dsymutil seems to kill the machine when too many processes are run in
|
|
|
|
# parallel, so we need to use a pool to limit the concurrency when passing
|
|
|
|
# large -j to Ninja (e.g. Goma build). Unfortunately this is also one of the
|
|
|
|
# slowest steps in a build, so we don't want to limit too much. Use the number
|
|
|
|
# of CPUs as a default.
|
|
|
|
dlsymutil_pool_depth = exec_script("num_cpus.py", [], "value")
|
2020-07-29 19:02:48 +00:00
|
|
|
|
|
|
|
# Too many linkers running at once causes issues for some builders. Allow
|
|
|
|
# such builders to limit the number of concurrent link steps.
|
|
|
|
# link_pool_depth < 0 means no pool, 0 means cpu count, > 0 sets pool size.
|
|
|
|
link_pool_depth = -1
|
2017-06-29 14:03:38 +00:00
|
|
|
}
|
|
|
|
|
2020-11-05 17:10:57 +00:00
|
|
|
declare_args() {
|
|
|
|
host_link = host_cxx
|
|
|
|
target_link = target_cxx
|
|
|
|
}
|
|
|
|
|
2020-06-10 22:07:40 +00:00
|
|
|
# For 'shell' see https://ninja-build.org/manual.html#ref_rule_command
|
2017-06-29 14:03:38 +00:00
|
|
|
if (host_os == "win") {
|
2020-06-10 22:07:40 +00:00
|
|
|
shell = "cmd.exe /c "
|
|
|
|
stamp = "$shell echo >"
|
2017-06-29 14:03:38 +00:00
|
|
|
} else {
|
2020-06-10 22:07:40 +00:00
|
|
|
shell = ""
|
2017-06-29 14:03:38 +00:00
|
|
|
stamp = "touch"
|
|
|
|
}
|
|
|
|
|
2019-09-02 20:50:20 +00:00
|
|
|
if (current_toolchain == default_toolchain) {
|
|
|
|
pool("dsymutil_pool") {
|
|
|
|
depth = dlsymutil_pool_depth
|
|
|
|
}
|
2020-07-29 19:02:48 +00:00
|
|
|
if (0 <= link_pool_depth) {
|
|
|
|
pool("link_pool") {
|
|
|
|
if (link_pool_depth == 0) {
|
|
|
|
depth = exec_script("num_cpus.py", [], "value")
|
|
|
|
} else {
|
|
|
|
depth = link_pool_depth
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-09-02 20:50:20 +00:00
|
|
|
}
|
|
|
|
|
2017-06-29 14:03:38 +00:00
|
|
|
toolchain("msvc") {
|
2020-03-06 18:45:55 +00:00
|
|
|
lib_switch = ""
|
2017-06-29 14:03:38 +00:00
|
|
|
lib_dir_switch = "/LIBPATH:"
|
|
|
|
|
2019-07-10 15:24:52 +00:00
|
|
|
bin = "$win_vc/Tools/MSVC/$win_toolchain_version/bin/HostX64/$target_cpu"
|
Updated MSVC toolchain to 2017, and further refactored GN
'windk' is no longer a thing. There are two separate variables to point
at your compiler (win_vc), and SDK (win_sdk).
'msvc' is no longer a thing, either. By default, we look for 2017 and
then 2015 (in the default locations). If neither is located, use an
assert to let users know they should set win_vc. Then, detect if win_vc
points at a 2017 or 2015 installation, and configure it automatically.
Because the toolchain is now 2017, update the GN files to handle building
x86 in that configuration. In fact, we only support x86 builds (with 2017
or 2015) using the toolchain assets. Keep a 2015 toolchain around as a
new asset, so we can add bot coverage.
Docs-Preview: https://skia.org/?cl=81841
Bug: skia:
Change-Id: I8c68a6f949e54c0e798a219450bbb9406f8dc6ac
Reviewed-on: https://skia-review.googlesource.com/81841
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Brian Osman <brianosman@google.com>
2017-12-07 21:16:21 +00:00
|
|
|
|
|
|
|
env_setup = ""
|
|
|
|
if (target_cpu == "x86") {
|
|
|
|
# Toolchain asset includes a script that configures for x86 building.
|
|
|
|
# We don't support x86 builds with local MSVC installations.
|
2020-06-10 22:07:40 +00:00
|
|
|
env_setup = "$shell $win_sdk/bin/SetEnv.cmd /x86 && "
|
2018-12-07 20:30:43 +00:00
|
|
|
} else if (target_cpu == "arm64") {
|
|
|
|
# ARM64 compiler is incomplete - it relies on DLLs located in the host toolchain directory.
|
2020-06-10 22:07:40 +00:00
|
|
|
env_setup = "$shell set \"PATH=%PATH%;$win_vc\\Tools\\MSVC\\$win_toolchain_version\\bin\\HostX64\\x64\" && "
|
2017-06-29 14:03:38 +00:00
|
|
|
}
|
|
|
|
|
2018-03-13 19:11:14 +00:00
|
|
|
cl_m32_flag = ""
|
2018-12-10 12:51:54 +00:00
|
|
|
|
2017-07-31 15:57:21 +00:00
|
|
|
if (clang_win != "") {
|
2018-03-13 19:11:14 +00:00
|
|
|
if (target_cpu == "x86") {
|
|
|
|
# cl.exe knows implicitly by the choice of executable that it's targeting
|
|
|
|
# x86, but clang-cl.exe needs to be told when targeting non-host
|
|
|
|
# platforms. (All our builders are x86-64, so x86 is always non-host.)
|
|
|
|
cl_m32_flag = "-m32"
|
|
|
|
}
|
2018-12-10 12:51:54 +00:00
|
|
|
if (host_os == "win") {
|
2018-12-10 13:48:03 +00:00
|
|
|
cl = "\"$clang_win/bin/clang-cl.exe\""
|
|
|
|
lib = "\"$clang_win/bin/lld-link.exe\" /lib"
|
|
|
|
link = "\"$clang_win/bin/lld-link.exe\""
|
2018-12-10 12:51:54 +00:00
|
|
|
} else {
|
2018-12-10 15:10:55 +00:00
|
|
|
cl = "\"$clang_win/bin/clang-cl\""
|
|
|
|
lib = "\"$clang_win/bin/lld-link\" /lib"
|
|
|
|
link = "\"$clang_win/bin/lld-link\""
|
2018-12-10 12:51:54 +00:00
|
|
|
}
|
2017-07-31 15:57:21 +00:00
|
|
|
} else {
|
2018-12-10 13:48:03 +00:00
|
|
|
cl = "\"$bin/cl.exe\""
|
|
|
|
lib = "\"$bin/lib.exe\""
|
|
|
|
link = "\"$bin/link.exe\""
|
2017-07-31 15:57:21 +00:00
|
|
|
}
|
|
|
|
|
2017-06-29 14:03:38 +00:00
|
|
|
tool("asm") {
|
|
|
|
_ml = "ml"
|
|
|
|
if (target_cpu == "x64") {
|
|
|
|
_ml += "64"
|
|
|
|
}
|
2018-12-07 20:30:43 +00:00
|
|
|
command = "$env_setup \"$bin/$_ml.exe\" {{asmflags}} /nologo /c /Fo {{output}} {{source}}"
|
2020-04-01 18:47:34 +00:00
|
|
|
outputs =
|
|
|
|
[ "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.obj" ]
|
2017-06-29 14:03:38 +00:00
|
|
|
description = "assemble {{source}}"
|
|
|
|
}
|
|
|
|
|
|
|
|
tool("cc") {
|
|
|
|
precompiled_header_type = "msvc"
|
|
|
|
pdbname = "{{target_out_dir}}/{{label_name}}_c.pdb"
|
|
|
|
|
|
|
|
# Label names may have spaces so pdbname must be quoted.
|
2018-12-10 13:48:03 +00:00
|
|
|
command = "$env_setup $cc_wrapper $cl /nologo /showIncludes /FC {{defines}} {{include_dirs}} {{cflags}} $cl_m32_flag {{cflags_c}} /c {{source}} /Fo{{output}} /Fd\"$pdbname\""
|
2017-06-29 14:03:38 +00:00
|
|
|
depsformat = "msvc"
|
2020-04-01 18:47:34 +00:00
|
|
|
outputs =
|
|
|
|
[ "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.obj" ]
|
2017-06-29 14:03:38 +00:00
|
|
|
description = "compile {{source}}"
|
|
|
|
}
|
|
|
|
|
|
|
|
tool("cxx") {
|
|
|
|
precompiled_header_type = "msvc"
|
|
|
|
pdbname = "{{target_out_dir}}/{{label_name}}_c.pdb"
|
|
|
|
|
|
|
|
# Label names may have spaces so pdbname must be quoted.
|
2018-12-10 13:48:03 +00:00
|
|
|
command = "$env_setup $cc_wrapper $cl /nologo /showIncludes /FC {{defines}} {{include_dirs}} {{cflags}} $cl_m32_flag {{cflags_cc}} /c {{source}} /Fo{{output}} /Fd\"$pdbname\""
|
2017-06-29 14:03:38 +00:00
|
|
|
depsformat = "msvc"
|
2020-04-01 18:47:34 +00:00
|
|
|
outputs =
|
|
|
|
[ "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.obj" ]
|
2017-06-29 14:03:38 +00:00
|
|
|
description = "compile {{source}}"
|
|
|
|
}
|
|
|
|
|
|
|
|
tool("alink") {
|
|
|
|
rspfile = "{{output}}.rsp"
|
|
|
|
|
2018-12-10 12:51:54 +00:00
|
|
|
command = "$env_setup $lib /nologo /ignore:4221 {{arflags}} /OUT:{{output}} @$rspfile"
|
2017-06-29 14:03:38 +00:00
|
|
|
outputs = [
|
|
|
|
# Ignore {{output_extension}} and always use .lib, there's no reason to
|
|
|
|
# allow targets to override this extension on Windows.
|
|
|
|
"{{root_out_dir}}/{{target_output_name}}{{output_extension}}",
|
|
|
|
]
|
|
|
|
default_output_extension = ".lib"
|
|
|
|
default_output_dir = "{{target_out_dir}}"
|
|
|
|
|
|
|
|
# inputs_newline works around a fixed per-line buffer size in the linker.
|
|
|
|
rspfile_content = "{{inputs_newline}}"
|
|
|
|
description = "link {{output}}"
|
2020-07-29 19:02:48 +00:00
|
|
|
if (0 <= link_pool_depth) {
|
|
|
|
pool = ":link_pool($default_toolchain)"
|
|
|
|
}
|
2017-06-29 14:03:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
tool("solink") {
|
|
|
|
dllname = "{{output_dir}}/{{target_output_name}}{{output_extension}}"
|
|
|
|
libname = "${dllname}.lib"
|
|
|
|
pdbname = "${dllname}.pdb"
|
|
|
|
rspfile = "${dllname}.rsp"
|
|
|
|
|
2018-12-10 12:51:54 +00:00
|
|
|
command = "$env_setup $link /nologo /IMPLIB:$libname /DLL /OUT:$dllname /PDB:$pdbname @$rspfile"
|
2017-06-29 14:03:38 +00:00
|
|
|
outputs = [
|
|
|
|
dllname,
|
|
|
|
libname,
|
|
|
|
pdbname,
|
|
|
|
]
|
|
|
|
default_output_extension = ".dll"
|
|
|
|
default_output_dir = "{{root_out_dir}}"
|
|
|
|
|
|
|
|
link_output = libname
|
|
|
|
depend_output = libname
|
|
|
|
runtime_outputs = [
|
|
|
|
dllname,
|
|
|
|
pdbname,
|
|
|
|
]
|
|
|
|
|
|
|
|
# I don't quite understand this. Aping Chrome's toolchain/win/BUILD.gn.
|
|
|
|
restat = true
|
|
|
|
|
|
|
|
# inputs_newline works around a fixed per-line buffer size in the linker.
|
|
|
|
rspfile_content = "{{inputs_newline}} {{libs}} {{solibs}} {{ldflags}}"
|
|
|
|
description = "link {{output}}"
|
2020-07-29 19:02:48 +00:00
|
|
|
if (0 <= link_pool_depth) {
|
|
|
|
pool = ":link_pool($default_toolchain)"
|
|
|
|
}
|
2017-06-29 14:03:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
tool("link") {
|
|
|
|
exename = "{{root_out_dir}}/{{target_output_name}}{{output_extension}}"
|
|
|
|
pdbname = "$exename.pdb"
|
|
|
|
rspfile = "$exename.rsp"
|
|
|
|
|
2018-12-10 12:51:54 +00:00
|
|
|
command = "$env_setup $link /nologo /OUT:$exename /PDB:$pdbname @$rspfile"
|
2017-06-29 14:03:38 +00:00
|
|
|
default_output_extension = ".exe"
|
|
|
|
default_output_dir = "{{root_out_dir}}"
|
2020-04-01 18:47:34 +00:00
|
|
|
outputs = [ exename ]
|
2017-06-29 14:03:38 +00:00
|
|
|
|
|
|
|
# inputs_newline works around a fixed per-line buffer size in the linker.
|
|
|
|
rspfile_content = "{{inputs_newline}} {{libs}} {{solibs}} {{ldflags}}"
|
|
|
|
description = "link {{output}}"
|
2020-07-29 19:02:48 +00:00
|
|
|
if (0 <= link_pool_depth) {
|
|
|
|
pool = ":link_pool($default_toolchain)"
|
|
|
|
}
|
2017-06-29 14:03:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
tool("stamp") {
|
|
|
|
command = "$stamp {{output}}"
|
|
|
|
description = "stamp {{output}}"
|
|
|
|
}
|
|
|
|
|
|
|
|
tool("copy") {
|
|
|
|
cp_py = rebase_path("../cp.py")
|
2022-04-19 21:19:40 +00:00
|
|
|
command = "$shell python3 \"$cp_py\" {{source}} {{output}}"
|
2017-06-29 14:03:38 +00:00
|
|
|
description = "copy {{source}} {{output}}"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
template("gcc_like_toolchain") {
|
|
|
|
toolchain(target_name) {
|
|
|
|
ar = invoker.ar
|
|
|
|
cc = invoker.cc
|
|
|
|
cxx = invoker.cxx
|
2020-11-05 17:10:57 +00:00
|
|
|
link = invoker.link
|
2017-06-29 14:03:38 +00:00
|
|
|
lib_switch = "-l"
|
|
|
|
lib_dir_switch = "-L"
|
|
|
|
|
|
|
|
tool("cc") {
|
|
|
|
depfile = "{{output}}.d"
|
2019-08-06 20:40:01 +00:00
|
|
|
command = "$cc_wrapper $cc -MD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_c}} -c {{source}} -o {{output}}"
|
2017-06-29 14:03:38 +00:00
|
|
|
depsformat = "gcc"
|
2020-04-01 18:47:34 +00:00
|
|
|
outputs =
|
|
|
|
[ "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o" ]
|
2017-06-29 14:03:38 +00:00
|
|
|
description = "compile {{source}}"
|
|
|
|
}
|
|
|
|
|
|
|
|
tool("cxx") {
|
|
|
|
depfile = "{{output}}.d"
|
2019-08-06 20:40:01 +00:00
|
|
|
command = "$cc_wrapper $cxx -MD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_cc}} -c {{source}} -o {{output}}"
|
2017-06-29 14:03:38 +00:00
|
|
|
depsformat = "gcc"
|
2020-04-01 18:47:34 +00:00
|
|
|
outputs =
|
|
|
|
[ "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o" ]
|
2017-06-29 14:03:38 +00:00
|
|
|
description = "compile {{source}}"
|
|
|
|
}
|
|
|
|
|
|
|
|
tool("objc") {
|
|
|
|
depfile = "{{output}}.d"
|
2020-08-03 15:01:00 +00:00
|
|
|
command = "$cc_wrapper $cc -MD -MF $depfile {{defines}} {{include_dirs}} {{framework_dirs}} {{cflags}} {{cflags_objc}} -c {{source}} -o {{output}}"
|
2017-06-29 14:03:38 +00:00
|
|
|
depsformat = "gcc"
|
2020-04-01 18:47:34 +00:00
|
|
|
outputs =
|
|
|
|
[ "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o" ]
|
2017-06-29 14:03:38 +00:00
|
|
|
description = "compile {{source}}"
|
|
|
|
}
|
|
|
|
|
|
|
|
tool("objcxx") {
|
|
|
|
depfile = "{{output}}.d"
|
2022-04-27 20:20:27 +00:00
|
|
|
command = "$cc_wrapper $cxx -MD -MF $depfile {{defines}} {{include_dirs}} {{framework_dirs}} {{cflags}} {{cflags_objcc}} -c {{source}} -o {{output}}"
|
2017-06-29 14:03:38 +00:00
|
|
|
depsformat = "gcc"
|
2020-04-01 18:47:34 +00:00
|
|
|
outputs =
|
|
|
|
[ "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o" ]
|
2017-06-29 14:03:38 +00:00
|
|
|
description = "compile {{source}}"
|
|
|
|
}
|
|
|
|
|
|
|
|
tool("asm") {
|
|
|
|
depfile = "{{output}}.d"
|
2019-08-06 20:40:01 +00:00
|
|
|
command = "$cc_wrapper $cc -MD -MF $depfile {{defines}} {{include_dirs}} {{asmflags}} -c {{source}} -o {{output}}"
|
2017-06-29 14:03:38 +00:00
|
|
|
depsformat = "gcc"
|
2020-04-01 18:47:34 +00:00
|
|
|
outputs =
|
|
|
|
[ "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o" ]
|
2017-06-29 14:03:38 +00:00
|
|
|
description = "assemble {{source}}"
|
|
|
|
}
|
|
|
|
|
2019-10-24 18:38:03 +00:00
|
|
|
if (is_mac || is_ios) {
|
|
|
|
not_needed([ "ar" ]) # We use libtool instead.
|
|
|
|
}
|
|
|
|
|
2017-06-29 14:03:38 +00:00
|
|
|
tool("alink") {
|
2019-10-23 20:24:33 +00:00
|
|
|
if (is_mac || is_ios) {
|
2019-10-24 18:38:03 +00:00
|
|
|
command = "libtool -static -o {{output}} -no_warning_for_no_symbols {{inputs}}"
|
2019-10-23 20:24:33 +00:00
|
|
|
} else {
|
|
|
|
rspfile = "{{output}}.rsp"
|
|
|
|
rspfile_content = "{{inputs}}"
|
2020-06-10 22:07:40 +00:00
|
|
|
rm_py = rebase_path("../rm.py")
|
2022-04-19 21:19:40 +00:00
|
|
|
command = "$shell python3 \"$rm_py\" \"{{output}}\" && $ar rcs {{output}} @$rspfile"
|
2019-10-23 20:24:33 +00:00
|
|
|
}
|
|
|
|
|
2020-04-01 18:47:34 +00:00
|
|
|
outputs =
|
|
|
|
[ "{{root_out_dir}}/{{target_output_name}}{{output_extension}}" ]
|
2017-06-29 14:03:38 +00:00
|
|
|
default_output_extension = ".a"
|
|
|
|
output_prefix = "lib"
|
|
|
|
description = "link {{output}}"
|
2020-07-29 19:02:48 +00:00
|
|
|
if (0 <= link_pool_depth) {
|
|
|
|
pool = ":link_pool($default_toolchain)"
|
|
|
|
}
|
2017-06-29 14:03:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
tool("solink") {
|
|
|
|
soname = "{{target_output_name}}{{output_extension}}"
|
|
|
|
|
|
|
|
rpath = "-Wl,-soname,$soname"
|
2019-09-02 14:11:08 +00:00
|
|
|
if (is_mac || is_ios) {
|
2017-06-29 14:03:38 +00:00
|
|
|
rpath = "-Wl,-install_name,@rpath/$soname"
|
|
|
|
}
|
|
|
|
|
2018-02-09 19:45:09 +00:00
|
|
|
rspfile = "{{output}}.rsp"
|
|
|
|
rspfile_content = "{{inputs}}"
|
2019-02-28 16:05:01 +00:00
|
|
|
|
|
|
|
# --start-group/--end-group let us link multiple .a {{inputs}}
|
|
|
|
# without worrying about their relative order on the link line.
|
|
|
|
#
|
|
|
|
# This is mostly important for traditional linkers like GNU ld and Gold.
|
|
|
|
# The Mac/iOS linker neither needs nor accepts these flags.
|
|
|
|
# LLD doesn't need these flags, but accepts and ignores them.
|
|
|
|
_start_group = "-Wl,--start-group"
|
|
|
|
_end_group = "-Wl,--end-group"
|
2019-09-25 21:14:35 +00:00
|
|
|
if (is_mac || is_ios || is_fuchsia) {
|
2019-02-28 16:05:01 +00:00
|
|
|
_start_group = ""
|
|
|
|
_end_group = ""
|
|
|
|
}
|
|
|
|
|
2020-11-05 17:10:57 +00:00
|
|
|
command = "$link -shared {{ldflags}} $_start_group @$rspfile {{frameworks}} {{solibs}} $_end_group {{libs}} $rpath -o {{output}}"
|
2020-04-01 18:47:34 +00:00
|
|
|
outputs = [ "{{root_out_dir}}/$soname" ]
|
2017-06-29 14:03:38 +00:00
|
|
|
output_prefix = "lib"
|
2022-04-27 13:26:59 +00:00
|
|
|
if (is_mac || is_ios) {
|
|
|
|
default_output_extension = ".dylib"
|
|
|
|
} else {
|
|
|
|
default_output_extension = ".so"
|
|
|
|
}
|
2017-06-29 14:03:38 +00:00
|
|
|
description = "link {{output}}"
|
2020-07-29 19:02:48 +00:00
|
|
|
if (0 <= link_pool_depth) {
|
|
|
|
pool = ":link_pool($default_toolchain)"
|
|
|
|
}
|
2017-06-29 14:03:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
tool("link") {
|
2019-04-02 15:59:34 +00:00
|
|
|
exe_name = "{{root_out_dir}}/{{target_output_name}}{{output_extension}}"
|
|
|
|
rspfile = "$exe_name.rsp"
|
2018-02-09 19:45:09 +00:00
|
|
|
rspfile_content = "{{inputs}}"
|
2018-08-06 19:19:19 +00:00
|
|
|
|
|
|
|
# --start-group/--end-group let us link multiple .a {{inputs}}
|
|
|
|
# without worrying about their relative order on the link line.
|
|
|
|
#
|
|
|
|
# This is mostly important for traditional linkers like GNU ld and Gold.
|
|
|
|
# The Mac/iOS linker neither needs nor accepts these flags.
|
|
|
|
# LLD doesn't need these flags, but accepts and ignores them.
|
|
|
|
_start_group = "-Wl,--start-group"
|
|
|
|
_end_group = "-Wl,--end-group"
|
2019-09-25 21:14:35 +00:00
|
|
|
if (is_mac || is_ios || is_fuchsia) {
|
2018-08-06 19:19:19 +00:00
|
|
|
_start_group = ""
|
|
|
|
_end_group = ""
|
|
|
|
}
|
2020-11-05 17:10:57 +00:00
|
|
|
command = "$link {{ldflags}} $_start_group @$rspfile {{frameworks}} {{solibs}} $_end_group {{libs}} -o $exe_name"
|
2019-04-02 15:59:34 +00:00
|
|
|
|
2020-04-01 18:47:34 +00:00
|
|
|
outputs = [ "$exe_name" ]
|
2017-06-29 14:03:38 +00:00
|
|
|
description = "link {{output}}"
|
2020-07-29 19:02:48 +00:00
|
|
|
if (0 <= link_pool_depth) {
|
|
|
|
pool = ":link_pool($default_toolchain)"
|
|
|
|
}
|
2017-06-29 14:03:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
tool("stamp") {
|
|
|
|
command = "$stamp {{output}}"
|
|
|
|
description = "stamp {{output}}"
|
|
|
|
}
|
|
|
|
|
|
|
|
tool("copy") {
|
|
|
|
cp_py = rebase_path("../cp.py")
|
2022-04-19 21:19:40 +00:00
|
|
|
command = "python3 \"$cp_py\" {{source}} {{output}}"
|
2017-06-29 14:03:38 +00:00
|
|
|
description = "copy {{source}} {{output}}"
|
|
|
|
}
|
|
|
|
|
2017-11-28 14:45:26 +00:00
|
|
|
tool("copy_bundle_data") {
|
|
|
|
cp_py = rebase_path("../cp.py")
|
2022-04-19 21:19:40 +00:00
|
|
|
command = "python3 \"$cp_py\" {{source}} {{output}}"
|
2017-11-28 14:45:26 +00:00
|
|
|
description = "copy_bundle_data {{source}} {{output}}"
|
|
|
|
}
|
|
|
|
|
|
|
|
# We don't currently have any xcasset files so make this a NOP
|
|
|
|
tool("compile_xcassets") {
|
|
|
|
command = "true"
|
|
|
|
description = "compile_xcassets {{output}}"
|
|
|
|
}
|
|
|
|
|
2017-06-29 14:03:38 +00:00
|
|
|
toolchain_args = {
|
|
|
|
current_cpu = invoker.cpu
|
|
|
|
current_os = invoker.os
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
gcc_like_toolchain("gcc_like") {
|
|
|
|
cpu = current_cpu
|
|
|
|
os = current_os
|
|
|
|
ar = target_ar
|
|
|
|
cc = target_cc
|
|
|
|
cxx = target_cxx
|
2020-11-05 17:10:57 +00:00
|
|
|
link = target_link
|
2017-06-29 14:03:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
gcc_like_toolchain("gcc_like_host") {
|
|
|
|
cpu = host_cpu
|
|
|
|
os = host_os
|
|
|
|
ar = host_ar
|
|
|
|
cc = host_cc
|
|
|
|
cxx = host_cxx
|
2020-11-05 17:10:57 +00:00
|
|
|
link = host_link
|
2017-06-29 14:03:38 +00:00
|
|
|
}
|
2022-02-14 20:08:12 +00:00
|
|
|
|
|
|
|
# Only define this toolchain if actually building for wasm.
|
|
|
|
if (is_wasm) {
|
|
|
|
gcc_like_toolchain("wasm") {
|
|
|
|
cpu = "wasm"
|
|
|
|
os = "wasm"
|
|
|
|
ar = "$skia_emsdk_dir/upstream/emscripten/emar"
|
|
|
|
cc = "$skia_emsdk_dir/upstream/emscripten/emcc"
|
|
|
|
cxx = "$skia_emsdk_dir/upstream/emscripten/em++"
|
|
|
|
link = cxx
|
|
|
|
}
|
|
|
|
}
|