Skip to content

Commit

Permalink
Moving the CLD3 setup in third_party/BUILD.gn to third_party/cld/BUIL…
Browse files Browse the repository at this point in the history
…D.gn

For more context, see:
https://bugs.chromium.org/p/webrtc/issues/detail?id=6200

BUG=624904

Review-Url: https://codereview.chromium.org/2235933003
Cr-Commit-Position: refs/heads/master@{#411210}
  • Loading branch information
abakalov authored and Commit bot committed Aug 11, 2016
1 parent 58bed46 commit 62291e7
Show file tree
Hide file tree
Showing 17 changed files with 291 additions and 66 deletions.
4 changes: 2 additions & 2 deletions chrome/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ if (is_win) {
"//build/config/sanitizers:deps",
"//chrome/app:command_ids",
"//chrome/common:features",
"//third_party:cld",
"//third_party/cld",
]
if (is_win) {
output_name = "chrome"
Expand Down Expand Up @@ -970,7 +970,7 @@ if (is_win) {
"//components/crash/content/app",
"//components/policy",
"//content/public/app:both",
"//third_party:cld",
"//third_party/cld",
]

if (is_component_build) {
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/ui/webui/DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ include_rules = [

# Generated files
"+js2webui/chrome/test/data",
"+third_party/cld_version.h",
"+third_party/cld",

# Other libraries.
"+third_party/angle", # For ANGLE version.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include "content/public/browser/web_ui.h"
#include "content/public/browser/web_ui_data_source.h"
#include "grit/translate_internals_resources.h"
#include "third_party/cld_version.h"
#include "third_party/cld/cld_version.h"
#include "ui/base/l10n/l10n_util.h"

namespace {
Expand Down
2 changes: 1 addition & 1 deletion components/translate/content/renderer/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ static_library("renderer") {
"//content/public/common",
"//content/public/renderer",
"//services/shell/public/cpp",
"//third_party:cld",
"//third_party/WebKit/public:blink",
"//third_party/cld",
"//url",
"//v8",
]
Expand Down
2 changes: 1 addition & 1 deletion components/translate/core/language_detection/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ static_library("language_detection") {
deps = [
"//base",
"//components/translate/core/common",
"//third_party:cld",
"//third_party/cld",
"//url",
]
}
Expand Down
2 changes: 1 addition & 1 deletion components/translate/core/language_detection/DEPS
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
include_rules = [
# CLD library.
"+third_party/cld_version.h",
"+third_party/cld",
"+third_party/cld_2",
"+third_party/cld_3",
]
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include "components/translate/core/common/translate_constants.h"
#include "components/translate/core/common/translate_metrics.h"
#include "components/translate/core/common/translate_util.h"
#include "third_party/cld_version.h"
#include "third_party/cld/cld_version.h"

#if BUILDFLAG(CLD_VERSION) == 2
#include "third_party/cld_2/src/public/compact_lang_det.h"
Expand Down
2 changes: 1 addition & 1 deletion extensions/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ static_library("test_support") {
"//net:test_support",
"//testing/gmock",
"//testing/gtest",
"//third_party:cld",
"//third_party/cld",
]

public_deps = [
Expand Down
2 changes: 1 addition & 1 deletion extensions/renderer/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ source_set("renderer") {
"//mojo/edk/js",
"//mojo/public/js",
"//skia",
"//third_party:cld",
"//third_party/WebKit/public:blink",
"//third_party/cld",
]

if (proprietary_codecs && enable_wifi_display) {
Expand Down
2 changes: 1 addition & 1 deletion extensions/renderer/DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ include_rules = [
"+mojo/edk/js",

"+third_party/skia/include/core",
"+third_party/cld_version.h",
"+third_party/cld",
"+third_party/cld_2",
"+third_party/cld_3",

Expand Down
2 changes: 1 addition & 1 deletion extensions/renderer/i18n_custom_bindings.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include "extensions/common/message_bundle.h"
#include "extensions/renderer/script_context.h"
#include "extensions/renderer/v8_helpers.h"
#include "third_party/cld_version.h"
#include "third_party/cld/cld_version.h"

#if BUILDFLAG(CLD_VERSION) == 2
#include "third_party/cld_2/src/public/compact_lang_det.h"
Expand Down
2 changes: 1 addition & 1 deletion extensions/shell/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ source_set("app_shell_lib") {
"//extensions/shell/common/api:extensions_features",
"//extensions/utility",
"//skia",
"//third_party:cld",
"//third_party/WebKit/public:blink",
"//third_party/cld",
"//ui/base",
"//ui/base/ime",
"//v8",
Expand Down
82 changes: 29 additions & 53 deletions third_party/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -2,68 +2,44 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//build/buildflag_header.gni")

if (is_android) {
import("//build/config/android/config.gni")
}

# Specifies which language identification model to use: CLD2 or CLD3.
cld_version = 2
assert(!is_ios, "This is not used on iOS, don't drag it in unintentionally")

buildflag_header("cld_version") {
header = "cld_version.h"
flags = [ "CLD_VERSION=$cld_version" ]
}
declare_args() {
# Uses system libjpeg. If true, overrides use_libjpeg_turbo.
use_system_libjpeg = false

group("cld") {
public_deps = [
":cld_version",
]
if (cld_version == 2) {
public_deps += [ "//third_party/cld_2" ]
} else if (cld_version == 3) {
# TODO(abakalov): Rename to //third_party/cld_3/src/src:cld_3
public_deps += [ "//third_party/cld_3/src/src:nnet_language_identifier" ]
} else {
assert(false, "CLD version should be 2 or 3")
}
# Uses libjpeg_turbo as the jpeg implementation. Has no effect if
# use_system_libjpeg is set.
use_libjpeg_turbo = true
}

if (!is_ios) {
declare_args() {
# Uses system libjpeg. If true, overrides use_libjpeg_turbo.
use_system_libjpeg = false

# Uses libjpeg_turbo as the jpeg implementation. Has no effect if
# use_system_libjpeg is set.
use_libjpeg_turbo = true
}

config("system_libjpeg_config") {
libs = [ "jpeg" ]
defines = [ "USE_SYSTEM_LIBJPEG" ]
}
config("system_libjpeg_config") {
libs = [ "jpeg" ]
defines = [ "USE_SYSTEM_LIBJPEG" ]
}

config("libjpeg_turbo_config") {
defines = [ "USE_LIBJPEG_TURBO=1" ]
}
config("libjpeg_turbo_config") {
defines = [ "USE_LIBJPEG_TURBO=1" ]
}

# This is a meta target that forwards to the system's libjpeg,
# third_party/libjpeg, or third_party/libjpeg_turbo depending on the build args
# declared in this file.
group("jpeg") {
if (use_system_libjpeg) {
public_configs = [ ":system_libjpeg_config" ]
} else if (use_libjpeg_turbo) {
public_deps = [
"//third_party/libjpeg_turbo:libjpeg",
]
public_configs = [ ":libjpeg_turbo_config" ]
} else {
public_deps = [
"//third_party/libjpeg:libjpeg",
]
}
# This is a meta target that forwards to the system's libjpeg,
# third_party/libjpeg, or third_party/libjpeg_turbo depending on the build args
# declared in this file.
group("jpeg") {
if (use_system_libjpeg) {
public_configs = [ ":system_libjpeg_config" ]
} else if (use_libjpeg_turbo) {
public_deps = [
"//third_party/libjpeg_turbo:libjpeg",
]
public_configs = [ ":libjpeg_turbo_config" ]
} else {
public_deps = [
"//third_party/libjpeg:libjpeg",
]
}
}
27 changes: 27 additions & 0 deletions third_party/cld/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//build/buildflag_header.gni")

# Specifies which language identification model to use: CLD2 or CLD3.
cld_version = 2

buildflag_header("cld_version") {
header = "cld_version.h"
flags = [ "CLD_VERSION=$cld_version" ]
}

group("cld") {
public_deps = [
":cld_version",
]
if (cld_version == 2) {
public_deps += [ "//third_party/cld_2" ]
} else if (cld_version == 3) {
# TODO(abakalov): Rename to //third_party/cld_3/src/src:cld_3
public_deps += [ "//third_party/cld_3/src/src:nnet_language_identifier" ]
} else {
assert(false, "CLD version should be 2 or 3")
}
}
Loading

0 comments on commit 62291e7

Please sign in to comment.