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

Get boost.thread building #3

Merged
merged 33 commits into from
Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
0c42a81
Initial commit where the top level boost.thread builds
andrewkatson Apr 4, 2024
d758d22
Remove BUILD file for tests because there is no CMakeLists.txt file. …
andrewkatson Apr 4, 2024
f392476
Add tests to the boost.thread library
andrewkatson Apr 6, 2024
b09ea3b
Add a test module and remove the test dependencies from prod
andrewkatson Apr 6, 2024
099e642
chore: add github ci
zaucy Apr 6, 2024
252d68f
Add in remaining dependencies and bazelrc, gitignore, and MODULE.baze…
andrewkatson Apr 6, 2024
d6876c0
Add back MODULE.bazel now that it has the right case name
andrewkatson Apr 6, 2024
9b69847
Merge branch 'bazelboost-1.83.0' of github.com:andrewkatson/thread in…
andrewkatson Apr 6, 2024
a552be7
Remove version from boost.thread dependency
andrewkatson Apr 6, 2024
80a8c8b
chore: update deps + minor tweaks
zaucy Apr 8, 2024
ff03797
chore: ci continue on error
zaucy Apr 8, 2024
85ba477
chore: disable fail fast
zaucy Apr 8, 2024
5fa2fd2
Start modifying the tests so we can get them to run independently
andrewkatson Apr 8, 2024
c58d08b
Modify the MODULE file
andrewkatson Apr 8, 2024
1332518
Merge branch 'bazelboost-1.83.0' of github.com:andrewkatson/thread in…
andrewkatson Apr 8, 2024
3409516
chore: get some windows tests working
zaucy Apr 9, 2024
a58bea9
chore: add working directory to ci
zaucy Apr 9, 2024
a136247
Remove some tests
andrewkatson Apr 9, 2024
41eb5b6
Merge the conflicts
andrewkatson Apr 9, 2024
3d1f45d
Comment out all tests that don't build
andrewkatson Apr 10, 2024
16a1855
Remove two more tests that just fail for no particular reason
andrewkatson Apr 10, 2024
6f4487d
Comment out the one test on Windows that fails (probably flaky). Also…
andrewkatson Apr 11, 2024
4881cc8
Remove assert because we don't make changes to the boost code that ar…
andrewkatson Apr 11, 2024
7841203
Skip all tests on posix since they all rely on pthread_helpers.hpp wh…
andrewkatson Apr 11, 2024
d1f9c88
Get mac working again by adding in common dependencies:
andrewkatson Apr 11, 2024
39a16f6
Commit local changes
andrewkatson Apr 11, 2024
1323782
Merge
andrewkatson Apr 11, 2024
309207c
Link statically on posix to get rid of undefined symbols and move one…
andrewkatson Apr 11, 2024
68e0327
link statically on Windows to see if that fixes things
andrewkatson Apr 11, 2024
74e5307
chore: query registry bazelrc
zaucy Apr 30, 2024
ca8f9ab
chore: add one of the threads tests
zaucy Apr 30, 2024
62dbfb5
chore: formatting
zaucy Apr 30, 2024
77247d9
fix: modify pthread_helpers adding missing assert header
zaucy Apr 30, 2024
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 .bazelignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test
3 changes: 2 additions & 1 deletion .bazelrc
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@

common --enable_bzlmod
build --incompatible_use_platforms_repo_for_constraints
build --incompatible_enable_cc_toolchain_resolution
build --incompatible_strict_action_env
build --enable_runfiles
build --registry=https://raw.githubusercontent.com/bazelboost/registry/main
build --registry=https://bcr.bazel.build
query --registry=https://raw.githubusercontent.com/bazelboost/registry/main
query --registry=https://bcr.bazel.build

try-import %workspace%/user.bazelrc
18 changes: 18 additions & 0 deletions .github/workflows/bazel.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: bazel

on: [pull_request]

jobs:
test:
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- windows-latest
- macos-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- run: bazelisk test ... -k
working-directory: test
131 changes: 120 additions & 11 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,151 @@ load("@rules_cc//cc:defs.bzl", "cc_library")

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

_COMMON_DEPS = [
"@boost.bind",
"@boost.config",
"@boost.core",
"@boost.date_time",
"@boost.move",
"@boost.system",
"@boost.type_traits",
"@boost.chrono",
]

_COMMON_HDRS = [
"include/boost/thread/detail/*.hpp",
"include/boost/thread/*.hpp",
"include/boost/thread/futures/*.hpp",
"include/boost/thread/csbl/*.hpp",
"include/boost/thread/executors/*.hpp",
]

_WINDOWS_HDRS = [
"include/boost/thread/win32/*.hpp",
]

_POSIX_HDRS = [
"include/boost/thread/pthread/*.hpp",
]

_MAC_HDRS = [
"include/boost/thread/pthread/*.hpp",
]

_WINDOWS_SRCS = [
"src/win32/*.cpp",
]

_MAC_SRCS = [
"src/pthread/once.cpp",
"src/pthread/thread.cpp",
]

_POSIX_SRCS = [
"src/pthread/thread.cpp",
"src/pthread/once.cpp",
]

_COMMON_SRCS = [
"src/future.cpp",
]

_COMMON_EXCLUDE_SRCS = ["src/pthread/once_atomic.cpp"]

cc_library(
name = "thread_posix",
target_compatible_with = select({
"@platforms//os:windows": ["@platforms//:incompatible"],
"@platforms//os:macos": ["@platforms//:incompatible"],
"//conditions:default": [],
}),
hdrs = glob(_POSIX_HDRS + _COMMON_HDRS),
srcs = glob(_POSIX_SRCS + _COMMON_SRCS, exclude = _COMMON_EXCLUDE_SRCS),
includes = ["include"],
deps = _COMMON_DEPS,
defines = [
"BOOST_THREAD_DONT_USE_ATOMIC",
],
)

cc_library(
name = "thread_windows",
target_compatible_with = select({
"@platforms//os:windows": [],
"@platforms//os:macos": ["@platforms//:incompatible"],
"//conditions:default": ["@platforms//:incompatible"],
}),
hdrs = glob(_WINDOWS_HDRS + _COMMON_HDRS),
srcs = glob(_WINDOWS_SRCS + _COMMON_SRCS, exclude = _COMMON_EXCLUDE_SRCS),
includes = ["include"],
linkopts = ["-DEFAULTLIB:shell32"],
local_defines = [
"BOOST_THREAD_BUILD_LIB",
],
defines = [
"BOOST_THREAD_WIN32",
"BOOST_THREAD_DONT_USE_ATOMIC",
],
deps = _COMMON_DEPS + [
"@boost.atomic",
],
)

cc_library(
name = "thread_mac",
target_compatible_with = select({
"@platforms//os:windows": ["@platforms//:incompatible"],
"@platforms//os:macos": [],
"//conditions:default": ["@platforms//:incompatible"],
}),
hdrs = glob(_MAC_HDRS + _COMMON_HDRS),
srcs = glob(_MAC_SRCS + _COMMON_SRCS, exclude = _COMMON_EXCLUDE_SRCS),
includes = ["include"],
defines = [
"BOOST_THREAD_DONT_USE_ATOMIC",
],
deps = _COMMON_DEPS,
)

cc_library(
name = "boost.thread",
hdrs = glob([
"include/**/*.hpp",
"include/**/*.h",
]),
], exclude = _POSIX_HDRS + _WINDOWS_HDRS + _MAC_HDRS + _COMMON_HDRS),
includes = ["include"],
srcs = glob(["src/**/*.cpp"], exclude = _POSIX_SRCS + _WINDOWS_SRCS + _MAC_SRCS + _COMMON_SRCS + _COMMON_EXCLUDE_SRCS),
deps = [
"@boost.algorithm",
"@boost.assert",
"@boost.atomic",
"@boost.bind",
"@boost.chrono",
"@boost.concept_check",
"@boost.config",
"@boost.container",
"@boost.container_hash",
"@boost.core",
"@boost.date_time",
"@boost.exception",
"@boost.function",
"@boost.intrusive",
"@boost.io",
"@boost.iterator",
"@boost.lexical_cast",
"@boost.move",
"@boost.optional",
"@boost.predef",
"@boost.preprocessor",
"@boost.smart_ptr",
"@boost.static_assert",
"@boost.system",
"@boost.throw_exception",
"@boost.tuple",
"@boost.type_traits",
"@boost.utility",
"@boost.winapi",
],
] + select({
"@platforms//os:windows": [
":thread_windows",
"@boost.winapi",
],
"@platforms//os:macos": [
":thread_mac",
],
"//conditions:default": [
":thread_posix",
],
}) + _COMMON_DEPS,
)
7 changes: 4 additions & 3 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,18 @@ module(
)

bazel_dep(name = "rules_cc", version = "0.0.8")
bazel_dep(name = "platforms", version = "0.0.7")
bazel_dep(name = "boost.algorithm", version = "1.83.0.bzl.1")
bazel_dep(name = "boost.assert", version = "1.83.0.bzl.1")
bazel_dep(name = "boost.atomic", version = "1.83.0.bzl.1")
bazel_dep(name = "boost.bind", version = "1.83.0.bzl.1")
bazel_dep(name = "boost.chrono", version = "1.83.0.bzl.1")
bazel_dep(name = "boost.chrono", version = "1.83.0.bzl.2")
bazel_dep(name = "boost.concept_check", version = "1.83.0.bzl.1")
bazel_dep(name = "boost.config", version = "1.83.0.bzl.6")
bazel_dep(name = "boost.container", version = "1.83.0.bzl.1")
bazel_dep(name = "boost.container_hash", version = "1.83.0.bzl.1")
bazel_dep(name = "boost.core", version = "1.83.0.bzl.1")
bazel_dep(name = "boost.date_time", version = "1.83.0.bzl.1")
bazel_dep(name = "boost.date_time", version = "1.83.0.bzl.2")
bazel_dep(name = "boost.exception", version = "1.83.0.bzl.1")
bazel_dep(name = "boost.function", version = "1.83.0.bzl.1")
bazel_dep(name = "boost.intrusive", version = "1.83.0.bzl.1")
Expand All @@ -28,7 +29,7 @@ bazel_dep(name = "boost.predef", version = "1.83.0.bzl.1")
bazel_dep(name = "boost.preprocessor", version = "1.83.0.bzl.1")
bazel_dep(name = "boost.smart_ptr", version = "1.83.0.bzl.1")
bazel_dep(name = "boost.static_assert", version = "1.83.0.bzl.1")
bazel_dep(name = "boost.system", version = "1.83.0.bzl.1")
bazel_dep(name = "boost.system", version = "1.83.0.bzl.2")
bazel_dep(name = "boost.throw_exception", version = "1.83.0.bzl.1")
bazel_dep(name = "boost.tuple", version = "1.83.0.bzl.1")
bazel_dep(name = "boost.type_traits", version = "1.83.0.bzl.1")
Expand Down
Loading