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

Unified 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: Reduce visibility even futher 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/test/BUILD.gn ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/liblouis/BUILD.gn
diff --git a/third_party/liblouis/BUILD.gn b/third_party/liblouis/BUILD.gn
index 85e452c2d3c60fc4c579c07ef1d6dd84acbe72b7..634ec1aae2f8e110e23e9d6a8e9263f645950ae0 100644
--- a/third_party/liblouis/BUILD.gn
+++ b/third_party/liblouis/BUILD.gn
@@ -2,46 +2,202 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-chromevox_braille_out_dir = "$root_out_dir/resources/chromeos/chromevox/braille"
+import("//build/config/nacl/config.gni")
+import("//build/config/nacl/rules.gni")
-group("liblouis") {
- data_deps = [
- ":liblouis_tables",
- ":liblouis_tables_json",
- ]
-}
+if (current_toolchain == default_toolchain) {
+ chromevox_test_data_dir = "$root_build_dir/chromevox_test_data/braille"
+
+ # Build Liblouis library
+ #
+ # This target is used to build and assemble Liblouis braille translator
+ # including Native Client executable, manifest and translation tables.
+ #
+ # Variables:
+ # dest_dir: destination path for all translator files
+ # deps: private linked dependencies
+ # testonly: a target must only be used for testing
+ template("liblouis_library") {
+ assert(defined(invoker.dest_dir), "Must define dest_dir")
+ forward_variables_from(invoker, [ "dest_dir" ])
+
+ tables_target_name = "${target_name}_tables"
+ tables_json_target_name = "${target_name}_tables_json"
+ nexe_target_name = "${target_name}_nexe"
+ nmf_target_name = "${target_name}_nmf"
+ final_target_name = target_name
+
+ action(tables_target_name) {
+ forward_variables_from(invoker, [ "testonly" ])
+ visibility = [ ":$final_target_name" ]
+ script = "copy_tables.py"
+ inputs = [
+ "liblouis_list_tables.py",
+ ]
+ depfile = "$target_gen_dir/$target_name.d"
+ sources = [
+ "tables.json",
+ ]
+ outputs = [
+ "$depfile.stamp",
+ ]
+ args = [
+ "-D",
+ rebase_path(".", root_build_dir),
+ "-D",
+ rebase_path("src/tables", root_build_dir),
+ "-d",
+ rebase_path("$dest_dir/tables", root_build_dir),
+ "-e",
+ rebase_path("cvox-common.cti", root_build_dir),
+ "--depfile",
+ rebase_path(depfile, root_build_dir),
+ ] + rebase_path(sources, root_build_dir)
+ }
+
+ copy(tables_json_target_name) {
+ forward_variables_from(invoker, [ "testonly" ])
+ visibility = [ ":$final_target_name" ]
+ sources = [
+ "tables.json",
+ ]
+ outputs = [
+ "$dest_dir/{{source_file_part}}",
+ ]
+ }
+
+ copy(nexe_target_name) {
+ forward_variables_from(invoker, [ "testonly" ])
+ visibility = [
+ ":$final_target_name",
+ ":$nmf_target_name",
+ ]
+ nacl_wrapper = "liblouis_nacl_wrapper(//build/toolchain/nacl:clang_newlib_${target_cpu})"
+ path = get_label_info(":$nacl_wrapper", "root_out_dir")
+ sources = [
+ "${path}/liblouis_nacl.nexe",
+ ]
+
+ if (current_cpu == "x86") {
+ nmf_cpu = "x86_32"
+ } else if (current_cpu == "x64") {
+ nmf_cpu = "x86_64"
+ } else {
+ nmf_cpu = current_cpu
+ }
+ outputs = [
+ "$dest_dir/{{source_name_part}}_${nmf_cpu}.nexe",
+ ]
+ deps = [
+ ":$nacl_wrapper",
+ ]
+ }
+
+ generate_nmf(nmf_target_name) {
+ forward_variables_from(invoker, [ "testonly" ])
+ visibility = [ ":$final_target_name" ]
+ executables = get_target_outputs(":$nexe_target_name")
+ nmf = "$dest_dir/liblouis_nacl.nmf"
+ deps = [
+ ":$nexe_target_name",
+ ]
+ }
-action("liblouis_tables") {
- script = "copy_tables.py"
- inputs = [
- "liblouis_list_tables.py",
- ]
- depfile = "$target_gen_dir/tables.d"
- sources = [
- "tables.json",
- ]
- outputs = [
- "$depfile.stamp",
- ]
- args = [
- "-D",
- rebase_path(".", root_build_dir),
- "-D",
- rebase_path("src/tables", root_build_dir),
- "-d",
- rebase_path("$chromevox_braille_out_dir/tables", root_build_dir),
- "-e",
- rebase_path("cvox-common.cti", root_build_dir),
- "--depfile",
- rebase_path(depfile, root_build_dir),
- ] + rebase_path(sources, root_build_dir)
+ group(target_name) {
+ forward_variables_from(invoker, [ "testonly" ])
+ deps = [
+ ":$nexe_target_name",
+ ":$nmf_target_name",
+ ":$tables_json_target_name",
+ ":$tables_target_name",
+ ]
+ if (defined(invoker.deps)) {
+ deps += invoker.deps
+ }
+ }
+ }
+
+ liblouis_library("liblouis") {
+ dest_dir = "$root_build_dir/resources/chromeos/chromevox/braille"
+ }
+
+ liblouis_library("liblouis_test_data") {
+ testonly = true
+ dest_dir = chromevox_test_data_dir
+ deps = [
+ ":liblouis_test_files",
+ ]
+ }
+
+ copy("liblouis_test_files") {
+ visibility = [ ":liblouis_test_data" ]
+ testonly = true
+ sources = [
+ "//chrome/test/data/chromeos/liblouis_nacl/manifest.json",
+ "//chrome/test/data/chromeos/liblouis_nacl/test.js",
+ ]
+ outputs = [
+ "${chromevox_test_data_dir}/{{source_file_part}}",
+ ]
+ }
}
-copy("liblouis_tables_json") {
- sources = [
- "tables.json",
- ]
- outputs = [
- "$chromevox_braille_out_dir/{{source_file_part}}",
- ]
+if (is_nacl) {
+ config("liblouis_nacl_config") {
+ cflags = [
+ "-Wno-sign-compare",
+
+ # Needed for target_arch=mipsel
+ # src/liblouis/compileTranslationTable.c:1414
+ "-Wno-tautological-compare",
+
+ # Needed for target_arch=mipsel
+ # src/liblouis/logging.c:58
+ "-Wno-non-literal-null-conversion",
+ ]
+ }
+
+ source_set("liblouis_nacl") {
+ visibility = [ ":liblouis_nacl_wrapper" ]
+ sources = [
+ "overrides/liblouis/config.h",
+ "overrides/liblouis/liblouis.h",
+ "src/liblouis/compileTranslationTable.c",
+ "src/liblouis/logging.c",
+ "src/liblouis/lou_backTranslateString.c",
+ "src/liblouis/lou_translateString.c",
+ "src/liblouis/transcommon.ci",
+ "src/liblouis/wrappers.c",
+ ]
+ include_dirs = [
+ "overrides/liblouis",
+ "src/liblouis",
+ ".",
+ "../..",
+ ]
+ configs += [ ":liblouis_nacl_config" ]
+ }
+
+ executable("liblouis_nacl_wrapper") {
+ visibility = [ ":*" ]
+ output_name = "liblouis_nacl"
+ sources = [
+ "nacl_wrapper/liblouis_instance.cc",
+ "nacl_wrapper/liblouis_instance.h",
+ "nacl_wrapper/liblouis_module.cc",
+ "nacl_wrapper/liblouis_module.h",
+ "nacl_wrapper/liblouis_wrapper.cc",
+ "nacl_wrapper/liblouis_wrapper.h",
+ "nacl_wrapper/translation_params.h",
+ "nacl_wrapper/translation_result.h",
+ ]
+ deps = [
+ ":liblouis_nacl",
+ "//native_client/src/untrusted/nacl",
+ "//native_client_sdk/src/libraries/nacl_io",
+ "//ppapi:ppapi_cpp_lib",
+ "//ppapi/native_client:ppapi_lib",
+ "//third_party/jsoncpp",
+ ]
+ }
}
« no previous file with comments | « chrome/test/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698