Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cc: split up rules for building c and c++ code [BUILD-560] #52

Merged
merged 7 commits into from
Mar 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .bazeliskrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
USE_BAZEL_VERSION=6.0.0
57 changes: 56 additions & 1 deletion cc/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@
# EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.

load("@bazel_skylib//rules:common_settings.bzl", "bool_flag")
load("@bazel_skylib//rules:common_settings.bzl", "bool_flag", "string_flag")

exports_files(
glob(["*.bzl"]),
visibility = ["//visibility:public"],
)

# Disable tests and test libraries with --@rules_swiftnav//:disable_test=true
bool_flag(
name = "disable_tests",
build_setting_default = False,
Expand All @@ -26,3 +27,57 @@ config_setting(
flag_values = {":disable_tests": "true"},
visibility = ["//visibility:public"],
)

# Enable exceptions with --@rules_swiftnav//:enable_exceptions=true
bool_flag(
name = "enable_exceptions",
build_setting_default = False,
visibility = ["//visibility:public"],
)

config_setting(
name = "_enable_exceptions",
flag_values = {":enable_exceptions": "true"},
visibility = ["//visibility:public"],
)

# Enable rtti with --@rules_swiftnav//:enable_exceptions=true
bool_flag(
name = "enable_rtti",
build_setting_default = False,
visibility = ["//visibility:public"],
)

config_setting(
name = "_enable_rtti",
flag_values = {":enable_rtti": "true"},
visibility = ["//visibility:public"],
)

# Allows us to experiment with building the codebase with different standards.
string_flag(
name = "cxx_standard",
build_setting_default = "", #inactive by default
visibility = ["//visibility:public"],
)

# Enable with --@rules_swiftnav//:cxx_standard=17
config_setting(
name = "cxx17",
flag_values = {":cxx_standard": "17"},
visibility = ["//visibility:public"],
)

# Enable with --@rules_swiftnav//:cxx_standard=20
config_setting(
name = "cxx20",
flag_values = {":cxx_standard": "20"},
visibility = ["//visibility:public"],
)

# Enable with --@rules_swiftnav//:cxx_standard=23
config_setting(
name = "cxx23",
flag_values = {":cxx_standard": "23"},
visibility = ["//visibility:public"],
)
Loading