78 lines
2.2 KiB
Plaintext
78 lines
2.2 KiB
Plaintext
|
|
template("xOS_executable_template") {
|
||
|
|
assert(defined(invoker.sources),
|
||
|
|
"Need sources in $target_name to build xOS App")
|
||
|
|
|
||
|
|
app_name = target_name
|
||
|
|
app_build_name = app_name + "_build"
|
||
|
|
|
||
|
|
deplibs = []
|
||
|
|
depbuilders = []
|
||
|
|
includes = []
|
||
|
|
confs = []
|
||
|
|
if (defined(invoker.libs)) {
|
||
|
|
deplibs = invoker.libs
|
||
|
|
}
|
||
|
|
if (defined(invoker.deps)) {
|
||
|
|
depbuilders = invoker.deps
|
||
|
|
}
|
||
|
|
if (defined(invoker.include_dirs)) {
|
||
|
|
includes = invoker.include_dirs
|
||
|
|
}
|
||
|
|
if (defined(invoker.configs)) {
|
||
|
|
confs = invoker.configs
|
||
|
|
}
|
||
|
|
if (defined(invoker.deplibs)) {
|
||
|
|
foreach(i, invoker.deplibs) {
|
||
|
|
deplibs += [ "$root_out_dir/base/libs/" + i + ".a" ]
|
||
|
|
depbuilders += [ "//libs/" + i + ":" + i ]
|
||
|
|
includes += [ "//libs/" + i + "/include" ]
|
||
|
|
confs += [ "//libs/" + i + ":" + i + "_include_config" ]
|
||
|
|
|
||
|
|
# Also adding libc includes.
|
||
|
|
# Note to add libc after libcxx.
|
||
|
|
if (i == "libcxx") {
|
||
|
|
includes += [ "//libs/libc/include" ]
|
||
|
|
}
|
||
|
|
|
||
|
|
if (i == "libui") {
|
||
|
|
includes += [ "//libs/libapi/include" ]
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
linkflags = []
|
||
|
|
if (defined(invoker.need_sign_section) && invoker.need_sign_section == true) {
|
||
|
|
# Adding empty section for a signature.
|
||
|
|
# HACK: Since ldflags follow inputs for linker we put this
|
||
|
|
# section as a first flag, but it will be treated as input.
|
||
|
|
linkflags += [ rebase_path("$root_out_dir/tmp/elfsign_section.o", "") ]
|
||
|
|
}
|
||
|
|
if (defined(invoker.ldflags)) {
|
||
|
|
linkflags += invoker.ldflags
|
||
|
|
}
|
||
|
|
|
||
|
|
executable(app_build_name) {
|
||
|
|
if (defined(invoker.install_path)) {
|
||
|
|
output_name = "base/" + invoker.install_path + app_name
|
||
|
|
} else {
|
||
|
|
output_name = "base/bin/" + app_name
|
||
|
|
}
|
||
|
|
sources = invoker.sources
|
||
|
|
libs = deplibs
|
||
|
|
deps = depbuilders
|
||
|
|
include_dirs = includes
|
||
|
|
configs = confs
|
||
|
|
ldflags = linkflags
|
||
|
|
forward_variables_from(invoker,
|
||
|
|
[
|
||
|
|
"cflags",
|
||
|
|
"cflags_c",
|
||
|
|
"cflags_cc",
|
||
|
|
"cflags_objc",
|
||
|
|
"cflags_objcc",
|
||
|
|
"asmflags",
|
||
|
|
"public_deps",
|
||
|
|
])
|
||
|
|
}
|
||
|
|
}
|