Commit Graph

5 Commits

Author SHA1 Message Date
Nicholas Junge bc946b919c
Modernize wheel building job config (#1783)
It is now possible to build Mac wheels on native machines in Github
Actions, so ARM64 Mac wheels are now built and tested on M1 machines.

Also, the artifact up-/download was migrated to v4, which made it
necessary to upload wheels to unique artifact names, and then later
stitch them together again in a subsequent job.

The cross-platform Mac build injection in setup.py was removed,
since it is no longer necessary.

I relanded a monkey-patching of Bazel build files, this time for
MODULE.bazel. This is because `rules_python` does not allow running
as the root user, which is the case in cibuildwheel+Linux (happens
in a Docker container). Since I did not see a quick way of switching
to rootless containers, and did not want to hardcode the config change
(it can apparently cause cache misses and build failures), I inject the
"ignore_root_user_error" flag into the MODULE.bazel file when running
in cibuildwheel on Linux.
2024-04-15 17:44:09 +01:00
Nicholas Junge e45585a4b8
Change nanobind linkage to response file approach on macOS (#1638)
* Change nanobind linkage to response file approach

This change needs https://github.com/bazelbuild/bazel/pull/18952 to be
merged first. Fixes macOS linkage of GBM's nanobind bindings on macOS by
supplying a linker response file instead of `-undefined dynamic_lookup`.

The latter has since been deprecated on macOS.

* Fix bazel_skylib checksum, bump skylib version in MODULE.bazel

* Bump Bazel to version 6.4.0 for linker response file support
2023-10-24 13:04:12 +01:00
Nicholas Junge 8f7b8dd9a3
Re-enable windows-latest tests for newer Bazel (#1641)
The Windows toolchain detection fix made it into Bazel 6.3.0, so the CI
should work again with the re-enabled `windows-latest` marker.

Require Bazel 6.3.0 in the Linux container setup in `cibuildwheel`.
2023-07-31 10:51:37 +01:00
Nicholas Junge 80a3c5e4d9
Switch bindings implementation to `nanobind` (#1526)
* End support for Python 3.7, update cibuildwheel and publish actions

Removes Python 3.7 from the support matrix, since it does not support
PEP590 vectorcalls.

Bumps the `cibuildwheel` and `pypa-publish` actions to their latest
available versions respectively.

* Add nanobind to the Bazel dependencies, add a BUILD file

The build file builds nanobind as a static `cc_library`. Currently,
the git SHA points to HEAD, since some necessary features have not
been included in a release yet.

* Delete pybind11 BUILD file

* Switch bindings implementation to nanobind

Switches over the binding tool to `nanobind` from `pybind11`. Most
changes in the build setup itself were drop-in replacements of existing
code changed to nanobind names, no new concepts needed to be
implemented.

Sets the minimum required macOS to 10.14 for full C++17 support. Also,
to avoid ambiguities in Bazel, build for macOS 11 on Mac ARM64.

* Use Bazel select for linker options

Guards against unknown linker option errors by selecting required
linker options for nanobind only on macOS, where they are relevant.

Other changes:
* Bump cibuildwheel action to v2.12.0
* Bump Bazel for aarch64 linux wheels to 6.0.0
* Remove C++17 flag from build files since it is present in setup.py `bazel build` command
* Bump nanobind commit to current HEAD (TBD: Bump to next stable release)

* Unbreak Windows builds of nanobind-based bindings

Guards compiler options behind a new `select` macro choosing between
MSVC and not MSVC.

Other changes:
* Inject the proper C++17 standard cxxopt in the `setup.py` build
command.
* Bump nanobind to current HEAD.
* Make `macos` a benchmark-wide condition, with public visibility to
allow its use in the nanobind BUILD file.

* Fall back to `nb::implicitly_convertible` for Counter construction

Since `benchmark::Counter` only has a constructor for `double`,
the nanobind `nb::init_implicit` template cannot be used. Therefore,
to support implicit construction from ints, we fall back to the
`nb::implicitly_convertible` template instead.
2023-02-06 13:07:17 +00:00
Nicholas Junge ff629d847c
Enable aarch64 Linux wheel builds, use cibuildwheel action directly (#1472)
This commit enables arm64 Linux wheel builds for Python.
It also changes the build procedure on Linux using
cibuildwheel in GitHub Actions. Instead of the more granular, verbose
approach that was used until now, we opt for the GitHub Action released
by cibuildwheel directly.

We also change the Bazel install procedure in the manylinux Docker
container image. Previously, Bazel was installed from an added RHEL repo, since that is
the recommended official way of installing Bazel on CentOS platforms.
However, the last successful build available for manylinux2014 has been Bazel 4,
which is showing its age with the release of Bazel 6 coming up as of this commit.

After this change, prebuilt Bazel binaries are downloaded using
wget directly from the Bazel GitHub release page. Since Bazel is built
for both x86 and arm64 on Linux, we immediately gain wheel build
support for these architectures. However, since the architecture
of the manylinux image is aarch64 instead of arm64,
a shell script was added that normalizes aarch64 to arm64,
and installs the correct arm64 Bazel binary if necessary.
2022-08-30 13:35:50 +01:00