Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 | 6 import("//build/config/nacl/rules.gni") |
| 7 group("liblouis") { | 7 |
| 8 data_deps = [ | 8 if (current_toolchain == default_toolchain) { |
| 9 ":liblouis_tables", | 9 chromevox_test_data_dir = "$root_build_dir/chromevox_test_data/braille" |
| 10 ":liblouis_tables_json", | 10 |
| 11 ] | 11 # Build Liblouis library |
| 12 # | |
| 13 # This target is used to build and assemble Liblouis braille translator | |
| 14 # including Native Client executable, manifest and translation tables. | |
| 15 # | |
| 16 # Variables: | |
| 17 # dest_dir: destination path for all translator files | |
| 18 # deps: private linked dependencies | |
| 19 # testonly: a target must only be used for testing | |
| 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 final_target_name = target_name | |
| 29 | |
| 30 action(tables_target_name) { | |
| 31 forward_variables_from(invoker, [ "testonly" ]) | |
| 32 visibility = [ ":$final_target_name" ] | |
| 33 script = "copy_tables.py" | |
| 34 inputs = [ | |
| 35 "liblouis_list_tables.py", | |
| 36 ] | |
| 37 depfile = "$target_gen_dir/$target_name.d" | |
| 38 sources = [ | |
| 39 "tables.json", | |
| 40 ] | |
| 41 outputs = [ | |
| 42 "$depfile.stamp", | |
| 43 ] | |
| 44 args = [ | |
| 45 "-D", | |
| 46 rebase_path(".", root_build_dir), | |
| 47 "-D", | |
| 48 rebase_path("src/tables", root_build_dir), | |
| 49 "-d", | |
| 50 rebase_path("$dest_dir/tables", root_build_dir), | |
| 51 "-e", | |
| 52 rebase_path("cvox-common.cti", root_build_dir), | |
| 53 "--depfile", | |
| 54 rebase_path(depfile, root_build_dir), | |
| 55 ] + rebase_path(sources, root_build_dir) | |
| 56 } | |
| 57 | |
| 58 copy(tables_json_target_name) { | |
| 59 forward_variables_from(invoker, [ "testonly" ]) | |
| 60 visibility = [ ":$final_target_name" ] | |
| 61 sources = [ | |
| 62 "tables.json", | |
| 63 ] | |
| 64 outputs = [ | |
| 65 "$dest_dir/{{source_file_part}}", | |
| 66 ] | |
| 67 } | |
| 68 | |
| 69 copy(nexe_target_name) { | |
| 70 forward_variables_from(invoker, [ "testonly" ]) | |
| 71 visibility = [ | |
| 72 ":$final_target_name", | |
| 73 ":$nmf_target_name", | |
| 74 ] | |
| 75 nacl_wrapper = "liblouis_nacl_wrapper(//build/toolchain/nacl:clang_newlib_ ${target_cpu})" | |
| 76 path = get_label_info(":$nacl_wrapper", "root_out_dir") | |
| 77 sources = [ | |
| 78 "${path}/liblouis_nacl.nexe", | |
| 79 ] | |
| 80 | |
| 81 if (current_cpu == "x86") { | |
| 82 nmf_cpu = "x86_32" | |
| 83 } else if (current_cpu == "x64") { | |
| 84 nmf_cpu = "x86_64" | |
| 85 } else { | |
| 86 nmf_cpu = current_cpu | |
| 87 } | |
| 88 outputs = [ | |
| 89 "$dest_dir/{{source_name_part}}_${nmf_cpu}.nexe", | |
| 90 ] | |
| 91 deps = [ | |
| 92 ":$nacl_wrapper", | |
| 93 ] | |
| 94 } | |
| 95 | |
| 96 generate_nmf(nmf_target_name) { | |
| 97 forward_variables_from(invoker, [ "testonly" ]) | |
| 98 visibility = [ ":$final_target_name" ] | |
| 99 executables = get_target_outputs(":$nexe_target_name") | |
| 100 nmf = "$dest_dir/liblouis_nacl.nmf" | |
| 101 deps = [ | |
| 102 ":$nexe_target_name", | |
| 103 ] | |
| 104 } | |
| 105 | |
| 106 group(target_name) { | |
| 107 forward_variables_from(invoker, [ "testonly" ]) | |
| 108 deps = [ | |
| 109 ":$nexe_target_name", | |
| 110 ":$nmf_target_name", | |
| 111 ":$tables_json_target_name", | |
| 112 ":$tables_target_name", | |
| 113 ] | |
| 114 if (defined(invoker.deps)) { | |
| 115 deps += invoker.deps | |
| 116 } | |
| 117 } | |
| 118 } | |
| 119 | |
| 120 liblouis_library("liblouis") { | |
| 121 dest_dir = "$root_build_dir/resources/chromeos/chromevox/braille" | |
| 122 } | |
| 123 | |
| 124 liblouis_library("liblouis_test_data") { | |
| 125 testonly = true | |
| 126 dest_dir = chromevox_test_data_dir | |
| 127 deps = [ | |
| 128 ":liblouis_test_files", | |
| 129 ] | |
| 130 } | |
| 131 | |
| 132 copy("liblouis_test_files") { | |
| 133 visibility = [ ":liblouis_test_data" ] | |
| 134 testonly = true | |
| 135 sources = [ | |
| 136 "//chrome/test/data/chromeos/liblouis_nacl/manifest.json", | |
| 137 "//chrome/test/data/chromeos/liblouis_nacl/test.js", | |
| 138 ] | |
| 139 outputs = [ | |
| 140 "${chromevox_test_data_dir}/{{source_file_part}}", | |
| 141 ] | |
| 142 } | |
| 12 } | 143 } |
| 13 | 144 |
| 14 action("liblouis_tables") { | 145 if (is_nacl) { |
| 15 script = "copy_tables.py" | 146 config("liblouis_nacl_config") { |
| 16 inputs = [ | 147 cflags = [ |
| 17 "liblouis_list_tables.py", | 148 "-Wno-sign-compare", |
| 18 ] | 149 |
| 19 depfile = "$target_gen_dir/tables.d" | 150 # Needed for target_arch=mipsel |
| 20 sources = [ | 151 # src/liblouis/compileTranslationTable.c:1414 |
| 21 "tables.json", | 152 "-Wno-tautological-compare", |
| 22 ] | 153 |
| 23 outputs = [ | 154 # Needed for target_arch=mipsel |
| 24 "$depfile.stamp", | 155 # src/liblouis/logging.c:58 |
| 25 ] | 156 "-Wno-non-literal-null-conversion", |
| 26 args = [ | 157 ] |
| 27 "-D", | 158 } |
| 28 rebase_path(".", root_build_dir), | 159 |
| 29 "-D", | 160 source_set("liblouis_nacl") { |
| 30 rebase_path("src/tables", root_build_dir), | 161 visibility = [ ":liblouis_nacl_wrapper" ] |
| 31 "-d", | 162 sources = [ |
| 32 rebase_path("$chromevox_braille_out_dir/tables", root_build_dir), | 163 "overrides/liblouis/config.h", |
| 33 "-e", | 164 "overrides/liblouis/liblouis.h", |
| 34 rebase_path("cvox-common.cti", root_build_dir), | 165 "src/liblouis/compileTranslationTable.c", |
| 35 "--depfile", | 166 "src/liblouis/logging.c", |
| 36 rebase_path(depfile, root_build_dir), | 167 "src/liblouis/lou_backTranslateString.c", |
| 37 ] + rebase_path(sources, root_build_dir) | 168 "src/liblouis/lou_translateString.c", |
| 169 "src/liblouis/transcommon.ci", | |
| 170 "src/liblouis/wrappers.c", | |
| 171 ] | |
| 172 include_dirs = [ | |
| 173 "overrides/liblouis", | |
| 174 "src/liblouis", | |
| 175 ".", | |
| 176 "../..", | |
| 177 ] | |
| 178 configs += [ ":liblouis_nacl_config" ] | |
| 179 } | |
| 180 | |
| 181 executable("liblouis_nacl_wrapper") { | |
| 182 visibility = [ "*" ] | |
|
Peter Lundblad
2015/12/01 09:10:33
Sorry, my bad, this should be:
visibility = ":*"
t
Petr Hosek
2015/12/01 15:55:55
Done.
| |
| 183 output_name = "liblouis_nacl" | |
| 184 sources = [ | |
| 185 "nacl_wrapper/liblouis_instance.cc", | |
| 186 "nacl_wrapper/liblouis_instance.h", | |
| 187 "nacl_wrapper/liblouis_module.cc", | |
| 188 "nacl_wrapper/liblouis_module.h", | |
| 189 "nacl_wrapper/liblouis_wrapper.cc", | |
| 190 "nacl_wrapper/liblouis_wrapper.h", | |
| 191 "nacl_wrapper/translation_params.h", | |
| 192 "nacl_wrapper/translation_result.h", | |
| 193 ] | |
| 194 deps = [ | |
| 195 ":liblouis_nacl", | |
| 196 "//native_client/src/untrusted/nacl", | |
| 197 "//native_client_sdk/src/libraries/nacl_io", | |
| 198 "//ppapi:ppapi_cpp_lib", | |
| 199 "//ppapi/native_client:ppapi_lib", | |
| 200 "//third_party/jsoncpp", | |
| 201 ] | |
| 202 } | |
| 38 } | 203 } |
| 39 | |
| 40 copy("liblouis_tables_json") { | |
| 41 sources = [ | |
| 42 "tables.json", | |
| 43 ] | |
| 44 outputs = [ | |
| 45 "$chromevox_braille_out_dir/{{source_file_part}}", | |
| 46 ] | |
| 47 } | |
| OLD | NEW |