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

Main module builds and tests pass for boost.chrono #1

Merged
merged 6 commits into from
Apr 8, 2024
Merged
Show file tree
Hide file tree
Changes from 5 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: 0 additions & 1 deletion .bazelrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@

common --enable_bzlmod
build --incompatible_use_platforms_repo_for_constraints
build --incompatible_enable_cc_toolchain_resolution
build --incompatible_strict_action_env
build --enable_runfiles
Expand Down
17 changes: 17 additions & 0 deletions .github/workflows/bazel.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: bazel

on: [pull_request]

jobs:
test:
strategy:
matrix:
os:
- ubuntu-latest
- windows-latest
- macos-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- run: bazelisk test ...
working-directory: test
66 changes: 63 additions & 3 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,62 @@ load("@rules_cc//cc:defs.bzl", "cc_library")

package(default_visibility = ["//visibility:public"])

_WINDOWS_HDRS = [
"**/win/*.hpp"
]

_POSIX_HDRS = [
"**/posix/*.hpp"
]

_MAC_HDRS = [
"**/mac/*.hpp"
]


cc_library(
name = "chrono_posix",
target_compatible_with = select({
"@platforms//os:windows": ["@platforms//:incompatible"],
"@platforms//os:macos": ["@platforms//:incompatible"],
"//conditions:default": [],
}),
hdrs = glob(_POSIX_HDRS),
includes = ["include"],
defines = ["BOOST_THREAD_DONT_USE_ATOMIC"],
)

cc_library(
name = "chrono_windows",
target_compatible_with = select({
"@platforms//os:windows": [],
"@platforms//os:macos": ["@platforms//:incompatible"],
"//conditions:default": ["@platforms//:incompatible"],
}),
hdrs = glob(_WINDOWS_HDRS),
includes = ["include"],
linkopts = ["-DEFAULTLIB:shell32"],
)

cc_library(
name = "chrono_mac",
target_compatible_with = select({
"@platforms//os:windows": ["@platforms//:incompatible"],
"@platforms//os:macos": [],
"//conditions:default": ["@platforms//:incompatible"],
}),
hdrs = glob(_MAC_HDRS),
includes = ["include"],
linkopts = ["-DEFAULTLIB:shell32"],
)

cc_library(
name = "boost.chrono",
hdrs = glob([
"include/**/*.hpp",
"include/**/*.h",
]),
], exclude = _POSIX_HDRS + _WINDOWS_HDRS + _MAC_HDRS),
srcs = glob(["src/**/*.cpp"]),
includes = ["include"],
deps = [
"@boost.assert",
Expand All @@ -24,6 +74,16 @@ cc_library(
"@boost.type_traits",
"@boost.typeof",
"@boost.utility",
"@boost.winapi",
],
] + select({
"@platforms//os:windows": [
":chrono_windows",
"@boost.winapi",
],
"@platforms//os:macos": [
":chrono_mac",
],
"//conditions:default": [
":chrono_posix",
],
})
)
1 change: 1 addition & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ module(
)

bazel_dep(name = "rules_cc", version = "0.0.8")
bazel_dep(name = "platforms", version = "0.0.7")
bazel_dep(name = "boost.assert", version = "1.83.0.bzl.1")
bazel_dep(name = "boost.config", version = "1.83.0.bzl.6")
bazel_dep(name = "boost.core", version = "1.83.0.bzl.1")
Expand Down
Loading
Loading