Meta: Add ccache compiler launcher to gn build
This commit is contained in:
parent
50383d318c
commit
863fad0e32
Notes:
sideshowbarker
2024-07-17 10:39:39 +09:00
Author: https://github.com/ADKaster Commit: https://github.com/SerenityOS/serenity/commit/863fad0e32 Pull-request: https://github.com/SerenityOS/serenity/pull/20209
2 changed files with 27 additions and 0 deletions
|
@ -21,6 +21,9 @@ template("unix_toolchain") {
|
|||
])
|
||||
|
||||
tool("cc") {
|
||||
if (enable_ccache) {
|
||||
command_launcher = "ccache"
|
||||
}
|
||||
depfile = "{{output}}.d"
|
||||
command = "$cc -MMD -MF $depfile -o {{output}} -c {{source}} {{defines}} {{include_dirs}} {{cflags}} {{cflags_c}}"
|
||||
depsformat = "gcc"
|
||||
|
@ -29,6 +32,9 @@ template("unix_toolchain") {
|
|||
}
|
||||
|
||||
tool("cxx") {
|
||||
if (enable_ccache) {
|
||||
command_launcher = "ccache"
|
||||
}
|
||||
depfile = "{{output}}.d"
|
||||
command = "$cxx -MMD -MF $depfile -o {{output}} -c {{source}} {{defines}} {{include_dirs}} {{cflags}} {{cflags_cc}}"
|
||||
depsformat = "gcc"
|
||||
|
@ -37,6 +43,9 @@ template("unix_toolchain") {
|
|||
}
|
||||
|
||||
tool("objcxx") {
|
||||
if (enable_ccache) {
|
||||
command_launcher = "ccache"
|
||||
}
|
||||
depfile = "{{output}}.d"
|
||||
command = "$cxx -MMD -MF $depfile -o {{output}} -c {{source}} {{defines}} {{include_dirs}} {{cflags}} {{cflags_objcc}}"
|
||||
depsformat = "gcc"
|
||||
|
@ -45,6 +54,9 @@ template("unix_toolchain") {
|
|||
}
|
||||
|
||||
tool("asm") {
|
||||
if (enable_ccache) {
|
||||
command_launcher = "ccache"
|
||||
}
|
||||
depfile = "{{output}}.d"
|
||||
command = "$cc -MMD -MF $depfile -o {{output}} -c {{source}} {{defines}} {{include_dirs}} {{asmflags}}"
|
||||
depsformat = "gcc"
|
||||
|
@ -53,6 +65,9 @@ template("unix_toolchain") {
|
|||
}
|
||||
|
||||
tool("alink") {
|
||||
if (enable_ccache) {
|
||||
command_launcher = "ccache"
|
||||
}
|
||||
if (current_os == "ios" || current_os == "mac") {
|
||||
command = "libtool -D -static -no_warning_for_no_symbols {{arflags}} -o {{output}} {{inputs}}"
|
||||
not_needed([ "ar" ])
|
||||
|
@ -78,6 +93,9 @@ template("unix_toolchain") {
|
|||
lib_dir_switch = "-L"
|
||||
|
||||
tool("solink") {
|
||||
if (enable_ccache) {
|
||||
command_launcher = "ccache"
|
||||
}
|
||||
outfile = "{{output_dir}}/{{target_output_name}}{{output_extension}}"
|
||||
if (current_os == "ios" || current_os == "mac") {
|
||||
command = "$ld -shared {{ldflags}} -o $outfile {{inputs}} {{libs}} {{frameworks}} -Wl,-install_name,@rpath/{{target_output_name}}{{output_extension}}"
|
||||
|
@ -98,6 +116,9 @@ template("unix_toolchain") {
|
|||
}
|
||||
|
||||
tool("solink_module") {
|
||||
if (enable_ccache) {
|
||||
command_launcher = "ccache"
|
||||
}
|
||||
outfile = "{{output_dir}}/{{target_output_name}}{{output_extension}}"
|
||||
if (current_os == "ios" || current_os == "mac") {
|
||||
command = "$ld -shared {{ldflags}} -Wl,-flat_namespace -Wl,-undefined,suppress -o $outfile {{inputs}} {{libs}} {{frameworks}} -Wl,-install_name,@rpath/{{target_output_name}}{{output_extension}}"
|
||||
|
@ -117,6 +138,9 @@ template("unix_toolchain") {
|
|||
}
|
||||
|
||||
tool("link") {
|
||||
if (enable_ccache) {
|
||||
command_launcher = "ccache"
|
||||
}
|
||||
outfile = "{{output_dir}}/{{target_output_name}}{{output_extension}}"
|
||||
if (current_os == "ios" || current_os == "mac") {
|
||||
command = "$ld {{ldflags}} -o $outfile {{inputs}} {{libs}} {{frameworks}} -Wl,-rpath,@executable_path/../lib"
|
||||
|
|
|
@ -5,4 +5,7 @@ declare_args() {
|
|||
# Enable setting -fuse-ld and other flags for using the lld linker.
|
||||
# Should not be set on macOS when using the default system compiler.
|
||||
use_lld = false
|
||||
|
||||
# Use ccache as a compiler launcher for compile and link jobs
|
||||
enable_ccache = true
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue