Files
ortools-clone/ortools/base/BUILD.bazel
2025-09-22 18:05:44 +02:00

600 lines
12 KiB
Python

# Copyright 2010-2025 Google LLC
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
load("@rules_cc//cc:cc_library.bzl", "cc_library")
load("@rules_cc//cc:cc_test.bzl", "cc_test")
package(default_visibility = ["//visibility:public"])
filegroup(
name = "base_swig",
srcs = ["base.i"],
visibility = ["//visibility:public"],
)
cc_library(
name = "accurate_sum",
hdrs = ["accurate_sum.h"],
)
cc_library(
name = "adjustable_priority_queue",
hdrs = [
"adjustable_priority_queue.h",
"adjustable_priority_queue-inl.h",
],
deps = [":base"],
)
cc_library(
name = "array",
hdrs = ["array.h"],
deps = ["@abseil-cpp//absl/utility"],
)
cc_library(
name = "base",
srcs = ["version.cc"],
hdrs = [
"commandlineflags.h",
"init_google.h",
"types.h",
"version.h",
],
copts = [
"-DOR_TOOLS_MAJOR=9",
"-DOR_TOOLS_MINOR=15",
"-DOR_TOOLS_PATCH=9999",
],
linkopts = select({
"@platforms//os:macos": ["-framework CoreFoundation"],
"//conditions:default": [],
}),
deps = [
":commandlineflags",
":logging",
":types",
"@abseil-cpp//absl/base",
"@abseil-cpp//absl/container:flat_hash_map",
"@abseil-cpp//absl/container:flat_hash_set",
"@abseil-cpp//absl/container:node_hash_map",
"@abseil-cpp//absl/container:node_hash_set",
"@abseil-cpp//absl/flags:flag",
"@abseil-cpp//absl/flags:parse",
"@abseil-cpp//absl/flags:usage",
"@abseil-cpp//absl/log",
"@abseil-cpp//absl/log:check",
"@abseil-cpp//absl/log:die_if_null",
"@abseil-cpp//absl/log:globals",
"@abseil-cpp//absl/log:initialize",
"@abseil-cpp//absl/strings",
"@abseil-cpp//absl/synchronization",
],
)
cc_library(
name = "base_export",
hdrs = ["base_export.h"],
)
cc_library(
name = "bitmap",
srcs = ["bitmap.cc"],
hdrs = ["bitmap.h"],
)
cc_library(
name = "commandlineflags",
srcs = ["commandlineflags.cc"],
hdrs = ["commandlineflags.h"],
deps = [
"@abseil-cpp//absl/flags:flag",
"@abseil-cpp//absl/flags:parse",
"@abseil-cpp//absl/flags:usage",
],
)
cc_library(
name = "constant_divisor",
srcs = ["constant_divisor.cc"],
hdrs = ["constant_divisor.h"],
visibility = ["//visibility:public"],
deps = [
"@abseil-cpp//absl/log:check",
"@abseil-cpp//absl/numeric:int128",
],
)
cc_test(
name = "constant_divisor_test",
srcs = ["constant_divisor_test.cc"],
deps = [
":constant_divisor",
"@abseil-cpp//absl/flags:flag",
"@abseil-cpp//absl/random",
"@abseil-cpp//absl/random:bit_gen_ref",
"@abseil-cpp//absl/random:distributions",
"@google_benchmark//:benchmark",
"@googletest//:gtest_main",
],
)
cc_library(
name = "container_logging",
hdrs = ["container_logging.h"],
deps = [":base"],
)
cc_library(
name = "dump_vars",
hdrs = ["dump_vars.h"],
copts = select({
"@platforms//os:windows": ["/Zc:preprocessor"],
"//conditions:default": [],
}),
deps = [
":strong_int",
":strong_vector",
"@abseil-cpp//absl/container:inlined_vector",
],
)
cc_test(
name = "dump_vars_test",
size = "small",
srcs = ["dump_vars_test.cc"],
copts = select({
"@platforms//os:windows": ["/Zc:preprocessor"],
"//conditions:default": [],
}),
deps = [
":dump_vars",
":strong_int",
":strong_vector",
"@abseil-cpp//absl/strings",
"@googletest//:gtest_main",
],
)
cc_library(
name = "flags",
hdrs = ["flags.h"],
deps = ["@abseil-cpp//absl/flags:flag"],
)
cc_library(
name = "file",
srcs = [
"file.cc",
"filesystem.cc",
],
hdrs = [
"file.h",
"filesystem.h",
"helpers.h",
"options.h",
],
deps = [
":status_macros",
"@abseil-cpp//absl/log",
"@abseil-cpp//absl/log:check",
"@abseil-cpp//absl/status",
"@abseil-cpp//absl/strings",
"@bzip2//:bz2",
"@protobuf",
"@zlib",
],
)
cc_library(
name = "gmock",
testonly = True,
hdrs = ["gmock.h"],
deps = [
":protocol-buffer-matchers",
"@abseil-cpp//absl/status:status_matchers",
"@googletest//:gtest",
],
)
cc_library(
name = "gmock_main",
testonly = True,
deps = [
":gmock",
"@googletest//:gtest_main",
],
)
cc_library(
name = "gzipfile",
srcs = ["gzipfile.cc"],
hdrs = ["gzipfile.h"],
deps = [
":base",
":file",
":path",
"@abseil-cpp//absl/strings",
"@zlib",
],
)
cc_library(
name = "gzipstring",
hdrs = ["gzipstring.h"],
deps = [
":base",
"@zlib",
],
)
cc_library(
name = "hash",
srcs = ["hash.cc"],
hdrs = ["hash.h"],
deps = ["@abseil-cpp//absl/strings"],
)
cc_library(
name = "int_type",
hdrs = ["int_type.h"],
deps = [":base"],
)
cc_library(
name = "intops",
hdrs = ["strong_int.h"],
deps = [
":int_type",
"@abseil-cpp//absl/log:absl_log",
"@abseil-cpp//absl/numeric:int128",
"@abseil-cpp//absl/strings",
"@abseil-cpp//absl/strings:str_format",
],
)
cc_library(
name = "iterator_adaptors",
hdrs = ["iterator_adaptors.h"],
deps = [":base"],
)
cc_library(
name = "linked_hash_map",
hdrs = ["linked_hash_map.h"],
deps = [
":base",
":logging",
"@abseil-cpp//absl/container:common",
"@abseil-cpp//absl/container:flat_hash_map",
],
)
cc_library(
name = "logging",
srcs = ["logging.cc"],
hdrs = ["logging.h"],
deps = [
":base_export",
"@abseil-cpp//absl/base:log_severity",
"@abseil-cpp//absl/flags:flag",
"@abseil-cpp//absl/flags:usage",
"@abseil-cpp//absl/log",
"@abseil-cpp//absl/log:check",
"@abseil-cpp//absl/log:die_if_null",
"@abseil-cpp//absl/log:flags",
"@abseil-cpp//absl/log:globals",
"@abseil-cpp//absl/log:initialize",
"@abseil-cpp//absl/memory",
"@abseil-cpp//absl/status",
"@abseil-cpp//absl/strings",
],
)
cc_library(
name = "map_util",
hdrs = ["map_util.h"],
deps = [":base"],
)
cc_library(
name = "mathutil",
srcs = ["mathutil.cc"],
hdrs = ["mathutil.h"],
deps = [":base"],
)
cc_library(
name = "memfile",
hdrs = ["memfile.h"],
)
cc_library(
name = "memutil",
hdrs = ["memutil.h"],
deps = ["@abseil-cpp//absl/strings"],
)
cc_library(
name = "murmur",
hdrs = ["murmur.h"],
deps = [
":base",
":hash",
"@abseil-cpp//absl/strings",
],
)
cc_library(
name = "mutable_memfile",
hdrs = ["mutable_memfile.h"],
)
cc_library(
name = "numbers",
srcs = ["numbers.cc"],
hdrs = ["numbers.h"],
deps = [
":strtoint",
"@abseil-cpp//absl/strings",
],
)
cc_library(
name = "parse_text_proto",
hdrs = ["parse_text_proto.h"],
deps = [
"//ortools/base:status_macros",
"@abseil-cpp//absl/log:check",
"@protobuf",
],
)
cc_library(
name = "parse_test_proto",
testonly = True,
hdrs = ["parse_test_proto.h"],
deps = [
":gmock",
"@abseil-cpp//absl/log:check",
"@protobuf",
],
)
cc_library(
name = "path",
srcs = ["path.cc"],
hdrs = ["path.h"],
deps = [
":base",
"@abseil-cpp//absl/strings",
],
)
cc_library(
name = "protobuf_util",
hdrs = ["protobuf_util.h"],
)
cc_library(
name = "protocol-buffer-matchers",
srcs = ["protocol-buffer-matchers.cc"],
hdrs = ["protocol-buffer-matchers.h"],
deps = [
"@abseil-cpp//absl/log:check",
"@abseil-cpp//absl/strings",
"@googletest//:gtest",
"@protobuf",
],
)
cc_library(
name = "protoutil",
hdrs = ["protoutil.h"],
deps = [
":timer",
"@abseil-cpp//absl/status",
"@abseil-cpp//absl/status:statusor",
"@protobuf",
],
)
cc_library(
name = "proto_enum_utils",
hdrs = ["proto_enum_utils.h"],
deps = [
"@abseil-cpp//absl/types:span",
"@protobuf",
],
)
cc_library(
name = "recordio",
srcs = ["recordio.cc"],
hdrs = ["recordio.h"],
deps = [
":base",
":file",
":logging",
"@abseil-cpp//absl/status:statusor",
"@abseil-cpp//absl/strings",
"@protobuf",
"@zlib",
],
)
cc_library(
name = "source_location",
hdrs = ["source_location.h"],
deps = ["@abseil-cpp//absl/base:config"],
)
cc_library(
name = "status_builder",
hdrs = ["status_builder.h"],
deps = [
":base",
"@abseil-cpp//absl/status",
"@abseil-cpp//absl/strings",
],
)
cc_library(
name = "status_macros",
hdrs = ["status_macros.h"],
deps = [
":base",
":status_builder",
"@abseil-cpp//absl/status",
"@abseil-cpp//absl/status:statusor",
],
)
cc_library(
name = "stl_util",
hdrs = ["stl_util.h"],
deps = [":base"],
)
cc_library(
name = "string_view_migration",
hdrs = ["string_view_migration.h"],
deps = ["@abseil-cpp//absl/strings"],
)
cc_library(
name = "strong_int",
hdrs = ["strong_int.h"],
deps = [
"@abseil-cpp//absl/meta:type_traits",
"@abseil-cpp//absl/strings",
"@abseil-cpp//absl/strings:str_format",
"@abseil-cpp//absl/strings:string_view",
],
)
cc_test(
name = "strong_int_test",
size = "small",
timeout = "long",
srcs = ["strong_int_test.cc"],
deps = [
":gmock",
":logging",
":strong_int",
"@abseil-cpp//absl/container:node_hash_map",
"@abseil-cpp//absl/flags:marshalling",
"@abseil-cpp//absl/hash:hash_testing",
"@abseil-cpp//absl/numeric:int128",
"@abseil-cpp//absl/strings",
"@abseil-cpp//absl/strings:str_format",
"@googletest//:gtest_main",
],
)
cc_library(
name = "strong_vector",
hdrs = ["strong_vector.h"],
deps = [
":base",
":intops",
],
)
cc_library(
name = "strtoint",
srcs = ["strtoint.cc"],
hdrs = ["strtoint.h"],
deps = [
"@abseil-cpp//absl/log:check",
"@abseil-cpp//absl/strings",
],
)
cc_library(
name = "sysinfo",
srcs = ["sysinfo.cc"],
hdrs = ["sysinfo.h"],
deps = ["@abseil-cpp//absl/strings"],
)
cc_library(
name = "temp_file",
srcs = ["temp_file.cc"],
hdrs = ["temp_file.h"],
deps = [
":base",
":file",
"@abseil-cpp//absl/status",
"@abseil-cpp//absl/strings",
"@abseil-cpp//absl/time",
],
)
cc_library(
name = "temp_path",
srcs = ["temp_path.cc"],
hdrs = ["temp_path.h"],
deps = [
":base",
":file",
"@abseil-cpp//absl/log:check",
"@abseil-cpp//absl/status",
"@abseil-cpp//absl/strings",
"@abseil-cpp//absl/time",
],
)
cc_library(
name = "threadpool",
srcs = ["threadpool.cc"],
hdrs = ["threadpool.h"],
deps = [
"@abseil-cpp//absl/log:check",
"@abseil-cpp//absl/synchronization",
],
)
cc_library(
name = "timer",
srcs = ["timer.cc"],
hdrs = ["timer.h"],
deps = [
"@abseil-cpp//absl/log:check",
"@abseil-cpp//absl/time",
],
)
cc_library(
name = "top_n",
hdrs = ["top_n.h"],
)
cc_library(
name = "types",
hdrs = ["types.h"],
)
cc_library(
name = "zipfile",
srcs = ["zipfile.cc"],
hdrs = ["zipfile.h"],
deps = [
":file",
":path",
":stl_util",
"@abseil-cpp//absl/strings",
"@zlib",
],
)