2023-07-29 20:50:29 +00:00
|
|
|
toolchain("gcc") {
|
|
|
|
lib_switch = "-l"
|
|
|
|
lib_dir_switch = "-L"
|
|
|
|
|
|
|
|
tool("asm") {
|
|
|
|
depfile = "{{output}}.d"
|
2023-08-17 16:05:42 +00:00
|
|
|
command = "$cc -MD -MF $depfile {{defines}} {{include_dirs}} {{asmflags}} -c {{source}} -o {{output}}"
|
2023-07-29 20:50:29 +00:00
|
|
|
depsformat = "gcc"
|
|
|
|
outputs =
|
|
|
|
[ "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o" ]
|
|
|
|
description = "assemble {{source}}"
|
|
|
|
}
|
|
|
|
|
|
|
|
tool("cc") {
|
|
|
|
depfile = "{{output}}.d"
|
2023-08-17 16:05:42 +00:00
|
|
|
command = "$cc -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_c}} -c {{source}} -o {{output}}"
|
2023-07-29 20:50:29 +00:00
|
|
|
depsformat = "gcc"
|
|
|
|
outputs =
|
|
|
|
[ "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o" ]
|
|
|
|
description = "compile {{output}}"
|
|
|
|
}
|
|
|
|
|
|
|
|
tool("cxx") {
|
|
|
|
depfile = "{{output}}.d"
|
2023-08-17 16:05:42 +00:00
|
|
|
command = "$cxx -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_cc}} -c {{source}} -o {{output}}"
|
2023-07-29 20:50:29 +00:00
|
|
|
depsformat = "gcc"
|
|
|
|
outputs =
|
|
|
|
[ "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o" ]
|
|
|
|
description = "compile {{output}}"
|
|
|
|
}
|
|
|
|
|
|
|
|
tool("objc") {
|
|
|
|
depfile = "{{output}}.d"
|
2023-08-17 16:05:42 +00:00
|
|
|
command = "$cc -MMD -MF $depfile {{defines}} {{include_dirs}} {{framework_dirs}} {{cflags}} {{cflags_c}} {{cflags_objc}} -c {{source}} -o {{output}}"
|
2023-07-29 20:50:29 +00:00
|
|
|
depsformat = "gcc"
|
|
|
|
outputs =
|
|
|
|
[ "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o" ]
|
|
|
|
description = "compile {{output}}"
|
|
|
|
}
|
|
|
|
|
|
|
|
tool("objcxx") {
|
|
|
|
depfile = "{{output}}.d"
|
2023-08-17 16:05:42 +00:00
|
|
|
command = "$cxx -MMD -MF $depfile {{defines}} {{include_dirs}} {{framework_dirs}} {{cflags}} {{cflags_cc}} {{cflags_objcc}} -c {{source}} -o {{output}}"
|
2023-07-29 20:50:29 +00:00
|
|
|
depsformat = "gcc"
|
|
|
|
outputs =
|
|
|
|
[ "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o" ]
|
|
|
|
description = "compile {{output}}"
|
|
|
|
}
|
|
|
|
|
|
|
|
if (is_apple) {
|
2023-08-08 21:26:31 +00:00
|
|
|
not_needed([ "ar" ]) # libtool is used instead.
|
2023-07-29 20:50:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
tool("alink") {
|
|
|
|
if (is_apple) {
|
|
|
|
command =
|
|
|
|
"libtool -static -o {{output}} -no_warning_for_no_symbols {{inputs}}"
|
|
|
|
} else {
|
2023-08-17 16:05:42 +00:00
|
|
|
command = "rm -f {{output}} && $ar rcs {{output}} {{inputs}}"
|
2023-07-29 20:50:29 +00:00
|
|
|
}
|
|
|
|
outputs =
|
|
|
|
[ "{{target_out_dir}}/{{target_output_name}}{{output_extension}}" ]
|
|
|
|
default_output_extension = ".a"
|
|
|
|
output_prefix = "lib"
|
|
|
|
description = "link {{target_output_name}}{{output_extension}}"
|
|
|
|
}
|
|
|
|
|
|
|
|
tool("solink") {
|
|
|
|
soname = "{{target_output_name}}{{output_extension}}"
|
|
|
|
sofile = "{{output_dir}}/$soname"
|
|
|
|
rspfile = soname + ".rsp"
|
|
|
|
if (is_apple) {
|
|
|
|
os_specific_option = "-install_name @executable_path/$sofile"
|
|
|
|
rspfile_content = "{{inputs}} {{solibs}} {{libs}}"
|
|
|
|
} else {
|
|
|
|
os_specific_option = "-Wl,-soname=$soname"
|
|
|
|
rspfile_content = "-Wl,--whole-archive {{inputs}} {{solibs}} -Wl,--no-whole-archive {{libs}}"
|
|
|
|
}
|
2023-08-17 16:05:42 +00:00
|
|
|
command = "$cxx -shared {{ldflags}} {{frameworks}} -o $sofile $os_specific_option @$rspfile"
|
2023-07-29 20:50:29 +00:00
|
|
|
default_output_extension = ".so"
|
|
|
|
default_output_dir = "{{root_out_dir}}"
|
|
|
|
outputs = [ sofile ]
|
|
|
|
link_output = sofile
|
|
|
|
depend_output = sofile
|
|
|
|
output_prefix = "lib"
|
|
|
|
description = "link $soname"
|
|
|
|
}
|
|
|
|
|
|
|
|
tool("link") {
|
|
|
|
outfile = "{{target_output_name}}{{output_extension}}"
|
|
|
|
rspfile = "$outfile.rsp"
|
|
|
|
rspfile_content = "{{inputs}}"
|
|
|
|
if (is_apple) {
|
2023-08-17 16:05:42 +00:00
|
|
|
command = "$cxx {{ldflags}} {{solibs}} {{libs}} {{frameworks}} -o $outfile @$rspfile"
|
2023-07-29 20:50:29 +00:00
|
|
|
} else {
|
2023-08-17 16:05:42 +00:00
|
|
|
command = "$cxx {{ldflags}} -o $outfile -Wl,--start-group @$rspfile {{solibs}} -Wl,--end-group {{libs}}"
|
2023-07-29 20:50:29 +00:00
|
|
|
}
|
|
|
|
default_output_dir = "{{root_out_dir}}"
|
|
|
|
outputs = [ outfile ]
|
|
|
|
description = "link $outfile"
|
|
|
|
}
|
|
|
|
|
2023-08-17 16:05:42 +00:00
|
|
|
if (host_os == "win") {
|
|
|
|
tool("stamp") {
|
|
|
|
command = "cmd.exe /c echo > {{output}}"
|
|
|
|
description = "stamp {{output}}"
|
|
|
|
}
|
|
|
|
|
|
|
|
tool("copy") {
|
|
|
|
# Note: The build in copy command can't handle forward slashes as path separators.
|
|
|
|
# Use a python script as a work around.
|
|
|
|
# command = "cmd.exe /c copy /Y {{source}} {{output}}"
|
2023-07-29 20:50:29 +00:00
|
|
|
|
2023-08-17 16:05:42 +00:00
|
|
|
copy_cmd = rebase_path("../copy.py")
|
|
|
|
command = "python \"$copy_cmd\" {{source}} {{output}}"
|
|
|
|
|
|
|
|
description = "copy {{source}} {{output}}"
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
tool("stamp") {
|
|
|
|
command = "touch {{output}}"
|
|
|
|
description = "stamp {{output}}"
|
|
|
|
}
|
|
|
|
|
|
|
|
tool("copy") {
|
|
|
|
command = "cp -af {{source}} {{output}}"
|
|
|
|
description = "copy {{source}} {{output}}"
|
|
|
|
}
|
2023-07-29 20:50:29 +00:00
|
|
|
}
|
|
|
|
}
|