Skip to content

Commit

Permalink
feat: bzlmodify
Browse files Browse the repository at this point in the history
  • Loading branch information
zaucy committed Sep 15, 2023
1 parent cca04d6 commit f09d73d
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 44 deletions.
13 changes: 2 additions & 11 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
build --enable_platform_specific_config
build --incompatible_use_platforms_repo_for_constraints
build --incompatible_enable_cc_toolchain_resolution
build --incompatible_strict_action_env
import %workspace%/bazel/common.bazelrc

build:windows --platforms=//bazel/platforms:windows

build:linux --platforms=//bazel/platforms:linux
build:linux --extra_toolchains=@llvm_toolchain//:cc-toolchain-x86_64-linux

common:ci --announce_rc
common:ci --disk_cache=~/.cache/bazel-disk-cache
try-import %workspace%/user.bazelrc
8 changes: 8 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module(
name = "bazel_sundry",
version = "0.1.0",
compatibility_level = 1,
)

bazel_dep(name = "rules_cc", version = "0.0.8")
bazel_dep(name = "googletest", version = "1.14.0")
9 changes: 0 additions & 9 deletions WORKSPACE.bazel
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
workspace(name = "bazel_sundry")

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
name = "com_google_googletest",
sha256 = "6398970cac9b3ff8e8acef5bc1f6d624da633e0236a65825c95f98fbc8c5d6b5",
strip_prefix = "googletest-d1467f5813f4d363cfd11aba99c4e9fe47a85e99",
url = "https://github.com/google/googletest/archive/d1467f5813f4d363cfd11aba99c4e9fe47a85e99.zip",
)

http_archive(
name = "hedron_compile_commands",
sha256 = "ed5aea1dc87856aa2029cb6940a51511557c5cac3dbbcb05a4abd989862c36b4",
Expand Down
17 changes: 17 additions & 0 deletions bazel/common.bazelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
startup --windows_enable_symlinks
common --enable_bzlmod
build --enable_platform_specific_config
build --incompatible_use_platforms_repo_for_constraints
build --incompatible_enable_cc_toolchain_resolution
build --incompatible_strict_action_env
build --enable_runfiles
build --noincompatible_remove_rule_name_parameter
query --noincompatible_remove_rule_name_parameter

# Temporary until https://github.com/grailbio/bazel-toolchain/pull/198 is merged
build:linux --extra_toolchains=@llvm_toolchain//:cc-toolchain-x86_64-linux

common:ci --announce_rc
common:ci --verbose_failures
common:ci --keep_going
common:ci --disk_cache=~/.cache/bazel-disk-cache
15 changes: 12 additions & 3 deletions bazel/copts.bzl
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
copts = select({
"@bazel_tools//tools/cpp:msvc": ["/std:c++latest"],
"//conditions:default": ["-std=c++20"],
load("@bazel_skylib//lib:selects.bzl", "selects")

copts = selects.with_or({
("@rules_cc//cc/compiler:clang"): [
"-std=c++2b",
"-fexperimental-library",
],
("@rules_cc//cc/compiler:msvc-cl", "@rules_cc//cc/compiler:clang-cl"): [
"/std:c++latest",
"/permissive-",
"/Zc:preprocessor",
],
})
19 changes: 0 additions & 19 deletions bazel/platforms/BUILD.bazel

This file was deleted.

4 changes: 2 additions & 2 deletions test/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ cc_test(
copts = copts,
deps = [
"//bazel_sundry:runfiles",
"@com_google_googletest//:gtest",
"@com_google_googletest//:gtest_main",
"@googletest//:gtest",
"@googletest//:gtest_main",
],
)

0 comments on commit f09d73d

Please sign in to comment.