-
Notifications
You must be signed in to change notification settings - Fork 0
/
BUILD.gn
108 lines (96 loc) · 3.97 KB
/
BUILD.gn
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
group("default") {
deps = [ "//src:flutter_embedder" ]
}
config("compiler") {
cflags = [ "-Wall", "-fPIC" ]
cflags_c = [ "-std=c99" ]
cflags_cc = [ "-std=c++14" ]
ldflags = []
libs = [ "stdc++" ]
}
toolchain("clang") {
# The path to functional Clang toolchain capable of building the target triple.
toolchain_path = "../../toolchain"
# The path to the target system sysroot.
sysroot_path = "../../sysroot/armel"
# The target. For example: "arm-linux-gnueabihf" for Raspberry Pi.
target_triple = "armv7l-tizen-linux-gnueabi"
# Path to extra system inlcude directories relative to the sysroot.
extra_system_include_dirs = [
"/usr/lib/gcc/armv7l-tizen-linux-gnueabi/6.2.1/include",
"/usr/lib/gcc/armv7l-tizen-linux-gnueabi/6.2.1/include/c++",
"/usr/lib/gcc/armv7l-tizen-linux-gnueabi/6.2.1/include/c++/armv7l-tizen-linux-gnueabi",
"/usr/lib/gcc/armv7l-tizen-linux-gnueabi/9.2.0/include",
"/usr/lib/gcc/armv7l-tizen-linux-gnueabi/9.2.0/include/c++",
"/usr/lib/gcc/armv7l-tizen-linux-gnueabi/9.2.0/include/c++/armv7l-tizen-linux-gnueabi",
"/usr/include/dlog",
"/usr/include/ecore-wl2-1",
"/usr/include/ecore-1",
"/usr/include/ecore-input-1",
"/usr/include/eo-1",
"/usr/include/eina-1",
"/usr/include/eina-1/eina",
"/usr/include/efl-1",
]
# Path to extra system library directories relative to the sysroot.
extra_system_lib_dirs = []
# Setup path to the tools to invoke
cc = "${toolchain_path}/bin/clang"
cxx = "${toolchain_path}/bin/clang++"
ld = "${toolchain_path}/bin/clang"
# Setup the target triple, this needs is required for all tool invocations.
target_triple_command = "--target=$target_triple"
sysroot_command = "--sysroot $sysroot_path"
# Add extra headers search directories for folders relative to sysroot.
extra_system_include_dirs_string = "-isysroot $sysroot_path"
foreach(extra_system_include_dir, extra_system_include_dirs) {
extra_system_include_dirs_string = "$extra_system_include_dirs_string -iwithsysroot $extra_system_include_dir"
}
# Add extra library search paths for folders relative to sysroot.
extra_system_lib_dirs_string = ""
foreach(extra_system_lib_dir, extra_system_lib_dirs) {
extra_system_lib_dirs_string =
"$extra_system_lib_dirs_string -L$sysroot_path/$extra_system_lib_dir"
}
# Common GN verbiage.
lib_switch = "-l"
lib_dir_switch = "-L"
# Common description prefixes in non-verbose invocation.
pretty_build_prefix = "🔨"
pretty_link_prefix = "⛓️"
tool("cc") {
depfile = "{{output}}.deps"
command = "$cc -o {{output}} -MMD -MF $depfile -c $target_triple_command $sysroot_command $extra_system_include_dirs_string {{defines}} {{include_dirs}} {{cflags}} {{cflags_c}} {{source}}"
outputs = [
"{{target_out_dir}}/{{target_output_name}}/objects/{{source_name_part}}.o",
]
depsformat = "gcc"
description = "$pretty_build_prefix CC: {{source_name_part}}"
}
tool("cxx") {
depfile = "{{output}}.deps"
command = "$cxx -o {{output}} -MMD -MF $depfile -c $target_triple_command $sysroot_command $extra_system_include_dirs_string {{defines}} {{include_dirs}} {{cflags}} {{cflags_cc}} {{source}}"
outputs = [
"{{target_out_dir}}/{{target_output_name}}/objects/{{source_name_part}}.o",
]
depsformat = "gcc"
description = "$pretty_build_prefix CXX: {{source_name_part}}"
}
tool("solink") {
outfile = "{{root_out_dir}}/{{target_output_name}}{{output_extension}}"
rspfile = "{{output}}.rsp"
rspfile_content = "{{inputs}}"
rpath = "-Wl,-rpath,'\$ORIGIN'"
command = "$ld -o $outfile $target_triple_command $sysroot_command $extra_system_lib_dirs_string $rpath -shared {{ldflags}} {{solibs}} {{libs}} @$rspfile"
description = "$pretty_link_prefix Shared Library: {{output}}"
outputs = [
outfile,
]
default_output_extension = ".so"
output_prefix = "lib"
}
tool("stamp") {
command = "touch {{output}}"
description = "$pretty_build_prefix Stamp: {{output}}"
}
}