aboutsummaryrefslogtreecommitdiffhomepage
path: root/gn
diff options
context:
space:
mode:
authorGravatar Ethan Nicholas <ethannicholas@google.com>2017-06-27 09:56:09 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-06-27 14:20:05 +0000
commitccf59917d3fe7aaf59de714acfbd0596503f324f (patch)
treecc97719c47276c9dcbf0ec09effd580c4e7450dd /gn
parentc3aef18419c1bb16951370e11758c7ef131fa10b (diff)
sksl fragment processor support
Bug: skia: Change-Id: Ia3b0305c2b0c78074303831f628fb01852b90d34 Reviewed-on: https://skia-review.googlesource.com/17843 Commit-Queue: Ethan Nicholas <ethannicholas@google.com> Reviewed-by: Ben Wagner <benjaminwagner@google.com> Reviewed-by: Mike Klein <mtklein@google.com>
Diffstat (limited to 'gn')
-rw-r--r--gn/BUILD.gn278
-rw-r--r--gn/BUILDCONFIG.gn20
-rwxr-xr-xgn/compile_processors.py19
-rw-r--r--gn/sksl.gni5
-rw-r--r--gn/tests.gni1
-rw-r--r--gn/toolchain/BUILD.gn301
6 files changed, 344 insertions, 280 deletions
diff --git a/gn/BUILD.gn b/gn/BUILD.gn
index 96da6775ec..cbac9759e4 100644
--- a/gn/BUILD.gn
+++ b/gn/BUILD.gn
@@ -4,48 +4,14 @@
# found in the LICENSE file.
declare_args() {
- ar = "ar"
- cc = "cc"
- cxx = "c++"
-
- if (is_android) {
- if (host_os == "win") {
- ar = "$ndk/toolchains/$ndk_gccdir-4.9/prebuilt/$ndk_host/$ndk_target/bin/ar.exe"
- cc = "$ndk/toolchains/llvm/prebuilt/$ndk_host/bin/clang.exe"
- cxx = "$ndk/toolchains/llvm/prebuilt/$ndk_host/bin/clang++.exe"
- } else {
- ar = "$ndk/toolchains/$ndk_gccdir-4.9/prebuilt/$ndk_host/$ndk_target/bin/ar"
- cc = "$ndk/toolchains/llvm/prebuilt/$ndk_host/bin/clang"
- cxx = "$ndk/toolchains/llvm/prebuilt/$ndk_host/bin/clang++"
- }
- }
-
- msvc = 2015
-
extra_asmflags = []
extra_cflags = []
extra_cflags_c = []
extra_cflags_cc = []
extra_ldflags = []
- cc_wrapper = ""
malloc = ""
}
-declare_args() {
- if (msvc == 2015) {
- windk = "C:/Program Files (x86)/Microsoft Visual Studio 14.0"
- } else {
- windk = "C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional"
- }
-}
-
-if (host_os == "win") {
- python = "python.bat"
- stamp = "cmd.exe /c echo >"
-} else {
- python = "python"
- stamp = "touch"
-}
is_clang = is_android || is_ios || is_mac || (cc == "clang" && cxx == "clang++")
if (!is_clang && !is_win) {
@@ -476,247 +442,3 @@ config("executable") {
]
}
}
-
-toolchain("msvc") {
- lib_dir_switch = "/LIBPATH:"
-
- if (msvc == 2015) {
- bin = "$windk/VC/bin/amd64"
- env_setup = ""
- if (target_cpu == "x86") {
- bin += "_x86"
- env_setup = "cmd /c $windk/win_sdk/bin/SetEnv.cmd /x86 && "
- }
- } else {
- bin = "$windk/VC/Tools/MSVC/14.10.25017/bin/HostX64/$target_cpu"
- env_setup = ""
- if (target_cpu == "x86") {
- print("Be sure to run")
- print("$windk/VC/Auxiliary/Build/vcvarsall.bat amd64_x86")
- print("to set up your environment before running ninja.")
- }
- }
-
- tool("asm") {
- _ml = "ml"
- if (target_cpu == "x64") {
- _ml += "64"
- }
- command = "$env_setup$bin/$_ml.exe /nologo /c /Fo {{output}} {{source}}"
- outputs = [
- "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.obj",
- ]
- description = "assemble {{source}}"
- }
-
- tool("cc") {
- rspfile = "{{output}}.rsp"
- precompiled_header_type = "msvc"
- pdbname = "{{target_out_dir}}/{{label_name}}_c.pdb"
-
- # Label names may have spaces so pdbname must be quoted.
- command = "$env_setup$bin/cl.exe /nologo /showIncludes /FC @$rspfile /c {{source}} /Fo{{output}} /Fd\"$pdbname\""
- depsformat = "msvc"
- outputs = [
- "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.obj",
- ]
- rspfile_content = "{{defines}} {{include_dirs}} {{cflags}} {{cflags_c}}"
- description = "compile {{source}}"
- }
-
- tool("cxx") {
- rspfile = "{{output}}.rsp"
- precompiled_header_type = "msvc"
- pdbname = "{{target_out_dir}}/{{label_name}}_c.pdb"
-
- # Label names may have spaces so pdbname must be quoted.
- command = "$env_setup$bin/cl.exe /nologo /showIncludes /FC @$rspfile /c {{source}} /Fo{{output}} /Fd\"$pdbname\""
- depsformat = "msvc"
- outputs = [
- "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.obj",
- ]
- rspfile_content = "{{defines}} {{include_dirs}} {{cflags}} {{cflags_cc}}"
- description = "compile {{source}}"
- }
-
- tool("alink") {
- rspfile = "{{output}}.rsp"
-
- command = "$env_setup$bin/lib.exe /nologo /ignore:4221 {{arflags}} /OUT:{{output}} @$rspfile"
- 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}}"
- }
-
- tool("solink") {
- dllname = "{{output_dir}}/{{target_output_name}}{{output_extension}}"
- libname = "${dllname}.lib"
- pdbname = "${dllname}.pdb"
- rspfile = "${dllname}.rsp"
-
- command = "$env_setup$bin/link.exe /nologo /IMPLIB:$libname /DLL /OUT:$dllname /PDB:$pdbname @$rspfile"
- 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}}"
- }
-
- tool("link") {
- exename = "{{root_out_dir}}/{{target_output_name}}{{output_extension}}"
- pdbname = "$exename.pdb"
- rspfile = "$exename.rsp"
-
- command =
- "$env_setup$bin/link.exe /nologo /OUT:$exename /PDB:$pdbname @$rspfile"
-
- default_output_extension = ".exe"
- default_output_dir = "{{root_out_dir}}"
- outputs = [
- exename,
- ]
-
- # inputs_newline works around a fixed per-line buffer size in the linker.
- rspfile_content = "{{inputs_newline}} {{libs}} {{solibs}} {{ldflags}}"
- description = "link {{output}}"
- }
-
- tool("stamp") {
- command = "$stamp {{output}}"
- description = "stamp {{output}}"
- }
-
- tool("copy") {
- cp_py = rebase_path("cp.py")
- command = "$python $cp_py {{source}} {{output}}"
- description = "copy {{source}} {{output}}"
- }
-}
-
-toolchain("gcc_like") {
- lib_switch = "-l"
- lib_dir_switch = "-L"
-
- tool("cc") {
- depfile = "{{output}}.d"
- 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 = "compile {{source}}"
- }
-
- tool("cxx") {
- depfile = "{{output}}.d"
- 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 = "compile {{source}}"
- }
-
- tool("objc") {
- depfile = "{{output}}.d"
- command = "$cc_wrapper $cc -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_objc}} -c {{source}} -o {{output}}"
- depsformat = "gcc"
- outputs = [
- "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o",
- ]
- description = "compile {{source}}"
- }
-
- tool("objcxx") {
- depfile = "{{output}}.d"
- command = "$cc_wrapper $cxx -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_cc}} {{cflags_objc}} -c {{source}} -o {{output}}"
- depsformat = "gcc"
- outputs = [
- "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o",
- ]
- description = "compile {{source}}"
- }
-
- tool("asm") {
- depfile = "{{output}}.d"
- command = "$cc_wrapper $cc -MMD -MF $depfile {{defines}} {{include_dirs}} {{asmflags}} -c {{source}} -o {{output}}"
- depsformat = "gcc"
- outputs = [
- "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o",
- ]
- description = "assemble {{source}}"
- }
-
- tool("alink") {
- rspfile = "{{output}}.rsp"
- rspfile_content = "{{inputs}}"
- ar_py = rebase_path("ar.py")
- command = "$python $ar_py $ar {{output}} $rspfile"
- outputs = [
- "{{root_out_dir}}/{{target_output_name}}{{output_extension}}",
- ]
- default_output_extension = ".a"
- output_prefix = "lib"
- description = "link {{output}}"
- }
-
- tool("solink") {
- soname = "{{target_output_name}}{{output_extension}}"
-
- rpath = "-Wl,-soname,$soname"
- if (is_mac) {
- rpath = "-Wl,-install_name,@rpath/$soname"
- }
-
- 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 = "link {{output}}"
- }
-
- tool("link") {
- command = "$cc_wrapper $cxx {{ldflags}} {{inputs}} {{solibs}} {{libs}} -o {{output}}"
- outputs = [
- "{{root_out_dir}}/{{target_output_name}}{{output_extension}}",
- ]
- description = "link {{output}}"
- }
-
- tool("stamp") {
- command = "$stamp {{output}}"
- description = "stamp {{output}}"
- }
-
- tool("copy") {
- cp_py = rebase_path("cp.py")
- command = "$python $cp_py {{source}} {{output}}"
- description = "copy {{source}} {{output}}"
- }
-}
diff --git a/gn/BUILDCONFIG.gn b/gn/BUILDCONFIG.gn
index 2b3ae33292..43f66f8832 100644
--- a/gn/BUILDCONFIG.gn
+++ b/gn/BUILDCONFIG.gn
@@ -17,9 +17,21 @@ declare_args() {
ndk_api = 21
}
sanitize = ""
+
+ ar = "ar"
+ cc = "cc"
+ cxx = "c++"
+
+ msvc = 2015
}
declare_args() {
is_debug = !is_official_build
+
+ if (msvc == 2015) {
+ windk = "C:/Program Files (x86)/Microsoft Visual Studio 14.0"
+ } else {
+ windk = "C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional"
+ }
}
assert(!(is_debug && is_official_build))
@@ -164,8 +176,12 @@ set_defaults("component") {
if (is_win) {
# Windows tool chain
- set_default_toolchain("//gn:msvc")
+ set_default_toolchain("//gn/toolchain:msvc")
+ default_toolchain_name = "msvc"
+ host_toolchain = "msvc"
} else {
# GCC-like toolchains, including Clang.
- set_default_toolchain("//gn:gcc_like")
+ set_default_toolchain("//gn/toolchain:gcc_like")
+ default_toolchain_name = "gcc_like"
+ host_toolchain = "gcc_like_host"
}
diff --git a/gn/compile_processors.py b/gn/compile_processors.py
new file mode 100755
index 0000000000..72f23febdd
--- /dev/null
+++ b/gn/compile_processors.py
@@ -0,0 +1,19 @@
+#!/usr/bin/env python
+#
+# Copyright 2017 Google Inc.
+#
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import os
+import subprocess
+import sys
+
+skslc = sys.argv[1]
+dst = sys.argv[2]
+processors = sys.argv[3:]
+for p in processors:
+ path, _ = os.path.splitext(p)
+ filename = os.path.split(path)[1]
+ subprocess.check_call([skslc, p, os.path.join(dst, filename + ".h")])
+ subprocess.check_call([skslc, p, os.path.join(dst, filename + ".cpp")])
diff --git a/gn/sksl.gni b/gn/sksl.gni
index a1cab827ff..d13393025c 100644
--- a/gn/sksl.gni
+++ b/gn/sksl.gni
@@ -11,11 +11,16 @@ skia_sksl_sources = [
"$_src/sksl/SkSLCompiler.cpp",
"$_src/sksl/SkSLIRGenerator.cpp",
"$_src/sksl/SkSLParser.cpp",
+ "$_src/sksl/SkSLCPPCodeGenerator.cpp",
+ "$_src/sksl/SkSLHCodeGenerator.cpp",
"$_src/sksl/SkSLGLSLCodeGenerator.cpp",
"$_src/sksl/SkSLSPIRVCodeGenerator.cpp",
"$_src/sksl/SkSLString.cpp",
"$_src/sksl/SkSLUtil.cpp",
"$_src/sksl/lex.layout.cpp",
"$_src/sksl/ir/SkSLSymbolTable.cpp",
+ "$_src/sksl/ir/SkSLSetting.cpp",
"$_src/sksl/ir/SkSLType.cpp",
]
+
+skia_gpu_processor_sources = []
diff --git a/gn/tests.gni b/gn/tests.gni
index 6843a6f555..fde7df64eb 100644
--- a/gn/tests.gni
+++ b/gn/tests.gni
@@ -216,6 +216,7 @@ tests_sources = [
"$_tests/SkResourceCacheTest.cpp",
"$_tests/SkSharedMutexTest.cpp",
"$_tests/SkSLErrorTest.cpp",
+ "$_tests/SkSLFPTest.cpp",
"$_tests/SkSLGLSLTest.cpp",
"$_tests/SkSLMemoryLayoutTest.cpp",
"$_tests/SkSLSPIRVTest.cpp",
diff --git a/gn/toolchain/BUILD.gn b/gn/toolchain/BUILD.gn
new file mode 100644
index 0000000000..a4c13a7d69
--- /dev/null
+++ b/gn/toolchain/BUILD.gn
@@ -0,0 +1,301 @@
+declare_args() {
+ host_ar = ar
+ host_cc = cc
+ host_cxx = cxx
+
+ if (is_android) {
+ if (host_os == "win") {
+ target_ar = "$ndk/toolchains/$ndk_gccdir-4.9/prebuilt/$ndk_host/$ndk_target/bin/ar.exe"
+ target_cc = "$ndk/toolchains/llvm/prebuilt/$ndk_host/bin/clang.exe"
+ target_cxx = "$ndk/toolchains/llvm/prebuilt/$ndk_host/bin/clang++.exe"
+ } else {
+ target_ar = "$ndk/toolchains/$ndk_gccdir-4.9/prebuilt/$ndk_host/$ndk_target/bin/ar"
+ target_cc = "$ndk/toolchains/llvm/prebuilt/$ndk_host/bin/clang"
+ target_cxx = "$ndk/toolchains/llvm/prebuilt/$ndk_host/bin/clang++"
+ }
+ } else {
+ target_ar = ar
+ target_cc = cc
+ target_cxx = cxx
+ }
+
+ cc_wrapper = ""
+}
+
+if (host_os == "win") {
+ python = "python.bat"
+ stamp = "cmd.exe /c echo >"
+} else {
+ python = "python"
+ stamp = "touch"
+}
+
+toolchain("msvc") {
+ lib_dir_switch = "/LIBPATH:"
+
+ if (msvc == 2015) {
+ bin = "$windk/VC/bin/amd64"
+ env_setup = ""
+ if (target_cpu == "x86") {
+ bin += "_x86"
+ env_setup = "cmd /c $windk/win_sdk/bin/SetEnv.cmd /x86 && "
+ }
+ } else {
+ bin = "$windk/VC/Tools/MSVC/14.10.25017/bin/HostX64/$target_cpu"
+ env_setup = ""
+ if (target_cpu == "x86") {
+ print("Be sure to run")
+ print("$windk/VC/Auxiliary/Build/vcvarsall.bat amd64_x86")
+ print("to set up your environment before running ninja.")
+ }
+ }
+
+ tool("asm") {
+ _ml = "ml"
+ if (target_cpu == "x64") {
+ _ml += "64"
+ }
+ command = "$env_setup$bin/$_ml.exe /nologo /c /Fo {{output}} {{source}}"
+ outputs = [
+ "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.obj",
+ ]
+ description = "assemble {{source}}"
+ }
+
+ tool("cc") {
+ rspfile = "{{output}}.rsp"
+ precompiled_header_type = "msvc"
+ pdbname = "{{target_out_dir}}/{{label_name}}_c.pdb"
+
+ # Label names may have spaces so pdbname must be quoted.
+ command = "$env_setup$bin/cl.exe /nologo /showIncludes /FC @$rspfile /c {{source}} /Fo{{output}} /Fd\"$pdbname\""
+ depsformat = "msvc"
+ outputs = [
+ "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.obj",
+ ]
+ rspfile_content = "{{defines}} {{include_dirs}} {{cflags}} {{cflags_c}}"
+ description = "compile {{source}}"
+ }
+
+ tool("cxx") {
+ rspfile = "{{output}}.rsp"
+ precompiled_header_type = "msvc"
+ pdbname = "{{target_out_dir}}/{{label_name}}_c.pdb"
+
+ # Label names may have spaces so pdbname must be quoted.
+ command = "$env_setup$bin/cl.exe /nologo /showIncludes /FC @$rspfile /c {{source}} /Fo{{output}} /Fd\"$pdbname\""
+ depsformat = "msvc"
+ outputs = [
+ "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.obj",
+ ]
+ rspfile_content = "{{defines}} {{include_dirs}} {{cflags}} {{cflags_cc}}"
+ description = "compile {{source}}"
+ }
+
+ tool("alink") {
+ rspfile = "{{output}}.rsp"
+
+ command = "$env_setup$bin/lib.exe /nologo /ignore:4221 {{arflags}} /OUT:{{output}} @$rspfile"
+ 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}}"
+ }
+
+ tool("solink") {
+ dllname = "{{output_dir}}/{{target_output_name}}{{output_extension}}"
+ libname = "${dllname}.lib"
+ pdbname = "${dllname}.pdb"
+ rspfile = "${dllname}.rsp"
+
+ command = "$env_setup$bin/link.exe /nologo /IMPLIB:$libname /DLL /OUT:$dllname /PDB:$pdbname @$rspfile"
+ 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}}"
+ }
+
+ tool("link") {
+ exename = "{{root_out_dir}}/{{target_output_name}}{{output_extension}}"
+ pdbname = "$exename.pdb"
+ rspfile = "$exename.rsp"
+
+ command =
+ "$env_setup$bin/link.exe /nologo /OUT:$exename /PDB:$pdbname @$rspfile"
+
+ default_output_extension = ".exe"
+ default_output_dir = "{{root_out_dir}}"
+ outputs = [
+ exename,
+ ]
+
+ # inputs_newline works around a fixed per-line buffer size in the linker.
+ rspfile_content = "{{inputs_newline}} {{libs}} {{solibs}} {{ldflags}}"
+ description = "link {{output}}"
+ }
+
+ tool("stamp") {
+ command = "$stamp {{output}}"
+ description = "stamp {{output}}"
+ }
+
+ tool("copy") {
+ cp_py = rebase_path("../cp.py")
+ command = "$python $cp_py {{source}} {{output}}"
+ description = "copy {{source}} {{output}}"
+ }
+}
+
+template("gcc_like_toolchain") {
+ toolchain(target_name) {
+ ar = invoker.ar
+ cc = invoker.cc
+ cxx = invoker.cxx
+ lib_switch = "-l"
+ lib_dir_switch = "-L"
+
+ tool("cc") {
+ depfile = "{{output}}.d"
+ 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 = "compile {{source}}"
+ }
+
+ tool("cxx") {
+ depfile = "{{output}}.d"
+ 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 = "compile {{source}}"
+ }
+
+ tool("objc") {
+ depfile = "{{output}}.d"
+ command = "$cc_wrapper $cc -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_objc}} -c {{source}} -o {{output}}"
+ depsformat = "gcc"
+ outputs = [
+ "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o",
+ ]
+ description = "compile {{source}}"
+ }
+
+ tool("objcxx") {
+ depfile = "{{output}}.d"
+ command = "$cc_wrapper $cxx -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_cc}} {{cflags_objc}} -c {{source}} -o {{output}}"
+ depsformat = "gcc"
+ outputs = [
+ "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o",
+ ]
+ description = "compile {{source}}"
+ }
+
+ tool("asm") {
+ depfile = "{{output}}.d"
+ command = "$cc_wrapper $cc -MMD -MF $depfile {{defines}} {{include_dirs}} {{asmflags}} -c {{source}} -o {{output}}"
+ depsformat = "gcc"
+ outputs = [
+ "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o",
+ ]
+ description = "assemble {{source}}"
+ }
+
+ tool("alink") {
+ rspfile = "{{output}}.rsp"
+ rspfile_content = "{{inputs}}"
+ ar_py = rebase_path("../ar.py")
+ command = "$python $ar_py $ar {{output}} $rspfile"
+ outputs = [
+ "{{root_out_dir}}/{{target_output_name}}{{output_extension}}",
+ ]
+ default_output_extension = ".a"
+ output_prefix = "lib"
+ description = "link {{output}}"
+ }
+
+ tool("solink") {
+ soname = "{{target_output_name}}{{output_extension}}"
+
+ rpath = "-Wl,-soname,$soname"
+ if (is_mac) {
+ rpath = "-Wl,-install_name,@rpath/$soname"
+ }
+
+ 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 = "link {{output}}"
+ }
+
+ tool("link") {
+ command = "$cc_wrapper $cxx {{ldflags}} {{inputs}} {{solibs}} {{libs}} -o {{output}}"
+ outputs = [
+ "{{root_out_dir}}/{{target_output_name}}{{output_extension}}",
+ ]
+ description = "link {{output}}"
+ }
+
+ tool("stamp") {
+ command = "$stamp {{output}}"
+ description = "stamp {{output}}"
+ }
+
+ tool("copy") {
+ cp_py = rebase_path("../cp.py")
+ command = "$python $cp_py {{source}} {{output}}"
+ description = "copy {{source}} {{output}}"
+ }
+
+ 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
+}
+
+gcc_like_toolchain("gcc_like_host") {
+ cpu = host_cpu
+ os = host_os
+ ar = host_ar
+ cc = host_cc
+ cxx = host_cxx
+}