summaryrefslogtreecommitdiff
path: root/src/mongo/db/query/collation/SConscript
blob: 6d5b61c660bb29b4809177d16b63a8d7aa0f6602 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
# -*- mode: python -*-

Import("env")
Import("use_system_version_of_library")

env = env.Clone()

env.Library(
    target="collator_interface",
    source=[
        "collation_index_key.cpp",
        "collation_spec.cpp",
        "collator_interface.cpp",
    ],
    LIBDEPS=[
        "$BUILD_DIR/mongo/base",
    ],
)

env.CppUnitTest(
    target="collation_spec_test",
    source=[
        "collation_spec_test.cpp",
    ],
    LIBDEPS=[
        "collator_interface",
    ],
)

env.Library(
    target="collator_interface_mock",
    source=[
        "collator_interface_mock.cpp",
    ],
    LIBDEPS=[
        "collator_interface",
    ],
)

env.CppUnitTest(
    target="collator_interface_mock_test",
    source=[
        "collator_interface_mock_test.cpp",
    ],
    LIBDEPS=[
        "collator_interface_mock",
    ],
)

env.CppUnitTest(
    target="collation_bson_comparison_test",
    source=[
        "collation_bson_comparison_test.cpp",
    ],
    LIBDEPS=[
        "collator_interface_mock",
    ],
)

env.CppUnitTest(
    target="collation_index_key_test",
    source=[
        "collation_index_key_test.cpp",
    ],
    LIBDEPS=[
        "collator_interface",
        "collator_interface_mock",
    ],
)

env.Library(
    target="collator_factory_interface",
    source=[
        "collator_factory_interface.cpp",
    ],
    LIBDEPS=[
        "$BUILD_DIR/mongo/db/service_context",
        "collator_interface",
    ],
)

env.Library(
    target="collator_factory_mock",
    source=[
        "collator_factory_mock.cpp",
    ],
    LIBDEPS=[
        "collator_factory_interface",
        "collator_interface_mock",
    ],
)

env.CppUnitTest(
    target="collator_factory_mock_test",
    source=[
        "collator_factory_mock_test.cpp",
    ],
    LIBDEPS=[
        "collator_factory_mock",
    ],
)

env.Library(
    target="collator_factory_icu",
    source=[
        "collator_factory_icu_decoration.cpp",
    ],
    LIBDEPS=[
        "collator_icu",
    ],
)

env.CppUnitTest(
    target="collator_factory_icu_test",
    source=[
        "collator_factory_icu_locales_test.cpp",
        "collator_factory_icu_test.cpp",
    ],
    LIBDEPS=[
        "collator_icu",
    ],
)

# The collator_icu library and the collator_interface_icu_test unit tests need an environment which
# has access to the third-party ICU headers.
icuEnv = env.Clone()

if not use_system_version_of_library("icu"):
    icuEnv.InjectThirdParty("icu")
    # Since we are injecting the third-party ICU headers, we must also copy the same defines that we
    # use to configure ICU when building ICU sources. See comment in
    # src/third_party/icu4c-57.1/source/SConscript.
    icuEnv.Append(
        CPPDEFINES=[
            ('UCONFIG_NO_BREAK_ITERATION', 1),
            ('UCONFIG_NO_FORMATTING', 1),
            ('UCONFIG_NO_TRANSLITERATION', 1),
            ('UCONFIG_NO_REGULAR_EXPRESSIONS', 1),
            ("U_CHARSET_IS_UTF8", 1),
            ("U_DISABLE_RENAMING", 1),
            ("U_STATIC_IMPLEMENTATION", 1),
            ("U_USING_ICU_NAMESPACE", 0),
        ],
    )

icuEnv.Library(
    target="collator_icu",
    source=[
        "collator_factory_icu.cpp",
        "collator_interface_icu.cpp",
    ],
    LIBDEPS=[
        "$BUILD_DIR/mongo/base",
        "$BUILD_DIR/mongo/bson/util/bson_extract",
        "$BUILD_DIR/mongo/util/icu_init",
        "$BUILD_DIR/third_party/shim_icu",
        "collator_factory_interface",
    ],
)

icuEnv.CppUnitTest(
    target="collator_interface_icu_test",
    source=[
        "collator_interface_icu_test.cpp",
    ],
    LIBDEPS=[
        "collator_icu",
    ],
)