123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- # Copyright Materialize, Inc. and contributors. All rights reserved.
- #
- # Use of this software is governed by the Business Source License
- # included in the LICENSE file.
- #
- # As of the Change Date specified in that file, in accordance with
- # the Business Source License, use of this software will be governed
- # by the Apache License, Version 2.0.
- """
- Defines configuration attributes for the systems we target.
- You can configure builds in Bazel using "configurable attributes" generally via
- the `select(...)` function. The following setting groups define the targets we
- support building Materialize for.
- """
- load("@bazel_skylib//lib:selects.bzl", "selects")
- load("@bazel_skylib//rules:common_settings.bzl", "bool_flag", "string_flag")
- # A flag that we can specify on the command line to configure whether or not we
- # build with a sanitizer.
- string_flag(
- name = "sanitizer",
- build_setting_default = "none",
- values = [
- "none",
- "address",
- "hwaddress",
- ],
- )
- config_setting(
- name = "sanitizer_none",
- flag_values = {":sanitizer": "none"},
- )
- config_setting(
- name = "sanitizer_address",
- flag_values = {":sanitizer": "address"},
- )
- config_setting(
- name = "sanitizer_hwaddress",
- flag_values = {":sanitizer": "hwaddress"},
- )
- bool_flag(
- name = "xlang_lto",
- build_setting_default = False,
- )
- config_setting(
- name = "use_xlang_lto",
- flag_values = {":xlang_lto": "True"},
- )
- # With our current toolchain setup, cross language LTO is only supported when building for Linux.
- #
- # See <https://github.com/rust-lang/rust/issues/60059> for macOS support.
- selects.config_setting_group(
- name = "xlang_lto_enabled",
- match_all = [
- "@platforms//os:linux",
- ":use_xlang_lto",
- # ASAN doesn't support being built when cross language LTO is enabled.
- ":sanitizer_none",
- ],
- visibility = ["//visibility:public"],
- )
- # We only want to use jemalloc if we're building for Linux and we're not using sanitizers.
- selects.config_setting_group(
- name = "use_jemalloc",
- match_all = [
- "@platforms//os:linux",
- ":sanitizer_none",
- ],
- visibility = ["//visibility:public"],
- )
- selects.config_setting_group(
- name = "linux_x86_64",
- match_all = [
- "@platforms//os:linux",
- "@platforms//cpu:x86_64",
- ],
- visibility = ["//visibility:public"],
- )
- selects.config_setting_group(
- name = "linux_arm",
- match_all = [
- "@platforms//os:linux",
- "@platforms//cpu:arm64",
- ],
- visibility = ["//visibility:public"],
- )
- selects.config_setting_group(
- name = "macos_x86_64",
- match_all = [
- "@platforms//os:macos",
- "@platforms//cpu:x86_64",
- ],
- visibility = ["//visibility:public"],
- )
- selects.config_setting_group(
- name = "macos_arm",
- match_all = [
- "@platforms//os:macos",
- "@platforms//cpu:arm64",
- ],
- visibility = ["//visibility:public"],
- )
|