Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(472)

Side by Side Diff: third_party/liblouis/BUILD.gn

Issue 1462243002: GN: Support building liblouis library (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # Copyright 2015 The Chromium Authors. All rights reserved. 1 # Copyright 2015 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 chromevox_braille_out_dir = "$root_out_dir/resources/chromeos/chromevox/braille" 5 import("//build/config/nacl/config.gni")
6 import("//build/config/nacl/rules.gni")
6 7
7 group("liblouis") { 8 if (current_toolchain == default_toolchain) {
Peter Lundblad 2015/11/30 10:27:04 Curious, why do we need this check here?
Petr Hosek 2015/12/01 01:19:56 To ensure that these targets are not instantiated
8 data_deps = [ 9 chromevox_test_data_dir = "$root_build_dir/chromevox_test_data/braille"
9 ":liblouis_tables", 10 chromevox_braille_out_dir =
Peter Lundblad 2015/11/30 10:27:04 nit: This is only used once, so could just use the
Petr Hosek 2015/12/01 01:19:56 Done.
10 ":liblouis_tables_json", 11 "$root_build_dir/resources/chromeos/chromevox/braille"
11 ] 12
13 # Build Liblouis library
14 #
15 # This target is used to build and assemble Liblouis braille translator
16 # including Native Client executable, manifest and translation tables.
17 #
18 # Variables:
19 # dest_dir: destination path for all translator files
Peter Lundblad 2015/11/30 10:27:04 List 'deps' here as well (no need for a descriptio
Petr Hosek 2015/12/01 01:19:56 Done.
20 template("liblouis_library") {
21 assert(defined(invoker.dest_dir), "Must define dest_dir")
22 forward_variables_from(invoker, [ "dest_dir" ])
23
24 tables_target_name = "${target_name}_tables"
25 tables_json_target_name = "${target_name}_tables_json"
26 nexe_target_name = "${target_name}_nexe"
27 nmf_target_name = "${target_name}_nmf"
28
29 action(tables_target_name) {
Peter Lundblad 2015/11/30 10:27:04 Add visibility = [ ":$target_name" ]
Petr Hosek 2015/12/01 01:19:57 Done.
30 script = "copy_tables.py"
31 inputs = [
32 "liblouis_list_tables.py",
33 ]
34 depfile = "$target_gen_dir/$target_name.d"
35 sources = [
36 "tables.json",
37 ]
38 outputs = [
39 "$depfile.stamp",
40 ]
41 args = [
42 "-D",
43 rebase_path(".", root_build_dir),
44 "-D",
45 rebase_path("src/tables", root_build_dir),
46 "-d",
47 rebase_path("$dest_dir/tables", root_build_dir),
48 "-e",
49 rebase_path("cvox-common.cti", root_build_dir),
50 "--depfile",
51 rebase_path(depfile, root_build_dir),
52 ] + rebase_path(sources, root_build_dir)
53 }
54
55 copy(tables_json_target_name) {
Peter Lundblad 2015/11/30 10:27:04 Add visibility = [ ":$target_name" ]
Petr Hosek 2015/12/01 01:19:56 Done.
56 sources = [
57 "tables.json",
58 ]
59 outputs = [
60 "$dest_dir/{{source_file_part}}",
61 ]
62 }
63
64 copy(nexe_target_name) {
Peter Lundblad 2015/11/30 10:27:04 Add visibility = [ ":$target_name" ]
Petr Hosek 2015/12/01 01:19:57 Done.
65 nacl_wrapper = "liblouis_nacl_wrapper(//build/toolchain/nacl:clang_newlib_ ${target_cpu})"
66 path = get_label_info(":$nacl_wrapper", "root_out_dir")
67 sources = [
68 "${path}/liblouis_nacl.nexe",
69 ]
70
71 if (current_cpu == "x86") {
72 nmf_cpu = "x86_32"
73 } else if (current_cpu == "x64") {
74 nmf_cpu = "x86_64"
75 } else {
76 nmf_cpu = current_cpu
77 }
78 outputs = [
79 "$dest_dir/{{source_name_part}}_${nmf_cpu}.nexe",
80 ]
81 deps = [
82 ":$nacl_wrapper",
83 ]
84 }
85
86 generate_nmf(nmf_target_name) {
Peter Lundblad 2015/11/30 10:27:04 Add visibility = [ ":$target_name" ]
Petr Hosek 2015/12/01 01:19:57 Done.
87 executables = get_target_outputs(":$nexe_target_name")
88 nmf = "$dest_dir/liblouis_nacl.nmf"
89 deps = [
90 ":$nexe_target_name",
91 ]
92 }
93
94 group(target_name) {
95 deps = [
96 ":$nexe_target_name",
97 ":$nmf_target_name",
98 ":$tables_json_target_name",
99 ":$tables_target_name",
100 ]
101 if (defined(invoker.deps)) {
102 deps += invoker.deps
103 }
104 }
105 }
106
107 liblouis_library("liblouis") {
108 dest_dir = chromevox_braille_out_dir
109 }
110
111 liblouis_library("liblouis_test_data") {
112 dest_dir = chromevox_test_data_dir
113 deps = [
114 ":liblouis_test_files",
115 ]
116 }
Peter Lundblad 2015/11/30 10:27:04 Add testonly = true (see comment on the template i
Petr Hosek 2015/12/01 01:19:57 Done.
117
118 copy("liblouis_test_files") {
Peter Lundblad 2015/11/30 10:27:04 Add visibility = ":$liblouis_test_data" and te
Petr Hosek 2015/12/01 01:19:56 Done.
119 sources = [
120 "//chrome/test/data/chromeos/liblouis_nacl/manifest.json",
121 "//chrome/test/data/chromeos/liblouis_nacl/test.js",
122 ]
123 outputs = [
124 "${chromevox_test_data_dir}/{{source_file_part}}",
125 ]
126 }
12 } 127 }
13 128
14 action("liblouis_tables") { 129 if (is_nacl) {
15 script = "copy_tables.py" 130 config("liblouis_nacl_config") {
16 inputs = [ 131 cflags = [
17 "liblouis_list_tables.py", 132 "-Wno-sign-compare",
18 ] 133
19 depfile = "$target_gen_dir/tables.d" 134 # Needed for target_arch=mipsel
20 sources = [ 135 # src/liblouis/compileTranslationTable.c:1414
21 "tables.json", 136 "-Wno-tautological-compare",
22 ] 137
23 outputs = [ 138 # Needed for target_arch=mipsel
24 "$depfile.stamp", 139 # src/liblouis/logging.c:58
25 ] 140 "-Wno-non-literal-null-conversion",
26 args = [ 141 ]
27 "-D", 142 }
28 rebase_path(".", root_build_dir), 143
29 "-D", 144 source_set("liblouis_nacl") {
Peter Lundblad 2015/11/30 10:27:04 Add visibility = [ ":liblouis_nacl_wrapper" ]
Petr Hosek 2015/12/01 01:19:56 Done.
30 rebase_path("src/tables", root_build_dir), 145 sources = [
31 "-d", 146 "overrides/liblouis/config.h",
32 rebase_path("$chromevox_braille_out_dir/tables", root_build_dir), 147 "overrides/liblouis/liblouis.h",
33 "-e", 148 "src/liblouis/compileTranslationTable.c",
34 rebase_path("cvox-common.cti", root_build_dir), 149 "src/liblouis/logging.c",
35 "--depfile", 150 "src/liblouis/lou_backTranslateString.c",
36 rebase_path(depfile, root_build_dir), 151 "src/liblouis/lou_translateString.c",
37 ] + rebase_path(sources, root_build_dir) 152 "src/liblouis/transcommon.ci",
153 "src/liblouis/wrappers.c",
154 ]
155 include_dirs = [
156 "overrides/liblouis",
157 "src/liblouis",
158 ".",
159 "../..",
160 ]
161 configs += [ ":liblouis_nacl_config" ]
162 }
163
164 executable("liblouis_nacl_wrapper") {
Peter Lundblad 2015/11/30 10:27:03 Add visibility = [ "*" ] or list the two targets.
Petr Hosek 2015/12/01 01:19:57 Done.
165 output_name = "liblouis_nacl"
166 sources = [
167 "nacl_wrapper/liblouis_instance.cc",
168 "nacl_wrapper/liblouis_instance.h",
169 "nacl_wrapper/liblouis_module.cc",
170 "nacl_wrapper/liblouis_module.h",
171 "nacl_wrapper/liblouis_wrapper.cc",
172 "nacl_wrapper/liblouis_wrapper.h",
173 "nacl_wrapper/translation_params.h",
174 "nacl_wrapper/translation_result.h",
175 ]
176 deps = [
177 ":liblouis_nacl",
178 "//native_client/src/untrusted/nacl",
179 "//native_client_sdk/src/libraries/nacl_io",
180 "//ppapi:ppapi_cpp_lib",
181 "//ppapi/native_client:ppapi_lib",
182 "//third_party/jsoncpp",
183 ]
184 }
38 } 185 }
39
40 copy("liblouis_tables_json") {
41 sources = [
42 "tables.json",
43 ]
44 outputs = [
45 "$chromevox_braille_out_dir/{{source_file_part}}",
46 ]
47 }
OLDNEW
« chrome/browser/resources/chromeos/chromevox/BUILD.gn ('K') | « chrome/test/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698