• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# © 2021 and later: Unicode, Inc. and others.
2# License & terms of use: http://www.unicode.org/copyright.html
3
4# This file defines Bazel targets for a subset of the ICU4C "i18n" library header and source files.
5# The configuration of dependencies among targets is strongly assisted by the
6# file in depstest that maintains such information, at
7# icu4c/source/test/depstest/dependencies.txt .
8
9load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
10
11package(
12    default_visibility = ["//visibility:public"],
13)
14
15# When compiling code in the `common` dir, the constant
16# `U_I18n_IMPLEMENTATION` needs to be defined. See
17# https://unicode-org.github.io/icu/userguide/howtouseicu#c-with-your-own-build-system .
18
19# If linker errors occur, then this may be a sign that the dependencies were
20# not specified correctly. Use dependencies.txt in depstest for assistance. See
21# https://stackoverflow.com/q/66111709/2077918 .
22
23cc_library(
24    name = "headers",
25    hdrs = glob([
26        "unicode/*.h", # public
27        "*.h",         # internal
28    ]),
29    # We need to add includes in order to preserve existing source files'
30    # include directives that use traditional paths, not paths relative to
31    # Bazel workspace:
32    # https://stackoverflow.com/a/65635893/2077918
33    includes = ["."],
34    local_defines = [
35        "U_I18N_IMPLEMENTATION",
36    ],
37)
38
39cc_library(
40    name = "collation",
41    srcs = [
42        "bocsu.cpp",
43        "coleitr.cpp",
44        "coll.cpp",
45        "collation.cpp",
46        "collationcompare.cpp",
47        "collationdata.cpp",
48        "collationdatareader.cpp",
49        "collationdatawriter.cpp",
50        "collationfastlatin.cpp",
51        # collationfcd.cpp is generated by genuca;
52        # probably hard to build genuca without depending on the old version.
53        "collationfcd.cpp",
54        "collationiterator.cpp",
55        "collationkeys.cpp",
56        "collationroot.cpp",
57        "collationrootelements.cpp",
58        "collationsets.cpp",
59        "collationsettings.cpp",
60        "collationtailoring.cpp",
61        "rulebasedcollator.cpp",
62        "sortkey.cpp",
63        "ucol.cpp",
64        "ucol_res.cpp",
65        "ucol_sit.cpp",
66        "ucoleitr.cpp",
67        "uitercollationiterator.cpp",
68        "utf16collationiterator.cpp",
69        "utf8collationiterator.cpp",
70    ],
71    includes = ["."],
72    deps = [
73        ":headers",
74        ":uclean_i18n",
75        "//icu4c/source/common:bytestream",
76        "//icu4c/source/common:normalizer2",
77        "//icu4c/source/common:platform",
78        "//icu4c/source/common:propname",
79        "//icu4c/source/common:resourcebundle",
80        "//icu4c/source/common:service_registration",
81        "//icu4c/source/common:ucharstrieiterator",
82        "//icu4c/source/common:uiter",
83        "//icu4c/source/common:ulist",
84        "//icu4c/source/common:unifiedcache",
85        "//icu4c/source/common:uset",
86        "//icu4c/source/common:usetiter",
87        "//icu4c/source/common:utrie2",
88        "//icu4c/source/common:uvector32",
89        "//icu4c/source/common:uvector64",
90    ],
91    local_defines = [
92        "U_I18N_IMPLEMENTATION",
93    ],
94)
95
96cc_library(
97    name = "collation_builder",
98    srcs = [
99        "collationbuilder.cpp",
100        "collationdatabuilder.cpp",
101        "collationfastlatinbuilder.cpp",
102        "collationruleparser.cpp",
103        "collationweights.cpp",
104    ],
105    includes = ["."],
106    deps = [
107        ":collation",
108        "//icu4c/source/common:canonical_iterator",
109        "//icu4c/source/common:ucharstriebuilder",
110        "//icu4c/source/common:uset_props"
111    ],
112    local_defines = [
113        "U_I18N_IMPLEMENTATION",
114    ],
115)
116
117cc_library(
118    name = "uclean_i18n",
119    srcs = [
120        "ucln_in.cpp",
121    ],
122    hdrs = ["ucln_in.h"],
123    includes = ["."],
124    deps = [
125        "//icu4c/source/common:platform",
126    ],
127    local_defines = [
128        "U_I18N_IMPLEMENTATION",
129    ],
130)
131