From ab2753642a50ae6da67315f05fd4396b1c7201ff Mon Sep 17 00:00:00 2001 From: Ezekiel Warren Date: Thu, 7 Sep 2023 20:23:58 -0700 Subject: [PATCH 1/3] feat: initial bzlmod support --- .bazelrc | 10 ++++++++ .github/workflows/bzlmod-archive.yml | 12 ++++++++++ BUILD.bazel | 35 ++++++++++++++++++++++++++++ MODULE.bazel | 28 ++++++++++++++++++++++ WORKSPACE.bazel | 1 + 5 files changed, 86 insertions(+) create mode 100644 .bazelrc create mode 100644 .github/workflows/bzlmod-archive.yml create mode 100644 BUILD.bazel create mode 100644 MODULE.bazel create mode 100644 WORKSPACE.bazel diff --git a/.bazelrc b/.bazelrc new file mode 100644 index 000000000..dd6962b54 --- /dev/null +++ b/.bazelrc @@ -0,0 +1,10 @@ + +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 + +try-import %workspace%/user.bazelrc diff --git a/.github/workflows/bzlmod-archive.yml b/.github/workflows/bzlmod-archive.yml new file mode 100644 index 000000000..d1823b663 --- /dev/null +++ b/.github/workflows/bzlmod-archive.yml @@ -0,0 +1,12 @@ +name: Bzlmod Archive + +on: + release: + types: [published] + +jobs: + bzlmod-archive: + uses: bazelboost/registry/.github/workflows/bzlmod-archive.yml@main + secrets: inherit + permissions: + contents: write diff --git a/BUILD.bazel b/BUILD.bazel new file mode 100644 index 000000000..0c30e4ae9 --- /dev/null +++ b/BUILD.bazel @@ -0,0 +1,35 @@ +load("@rules_cc//cc:defs.bzl", "cc_library") + +package(default_visibility = ["//visibility:public"]) + +cc_library( + name = "boost.python", + hdrs = glob([ + "include/**/*.hpp", + "include/**/*.h", + ]), + includes = ["include"], + deps = [ + "@boost.align", + "@boost.bind", + "@boost.config", + "@boost.conversion", + "@boost.core", + "@boost.detail", + "@boost.foreach", + "@boost.function", + "@boost.graph", + "@boost.integer", + "@boost.iterator", + "@boost.lexical_cast", + "@boost.mpl", + "@boost.numeric_conversion", + "@boost.preprocessor", + "@boost.property_map", + "@boost.smart_ptr", + "@boost.static_assert", + "@boost.tuple", + "@boost.type_traits", + "@boost.utility", + ], +) diff --git a/MODULE.bazel b/MODULE.bazel new file mode 100644 index 000000000..57a309b7b --- /dev/null +++ b/MODULE.bazel @@ -0,0 +1,28 @@ +module( + name = "boost.python", + version = "1.83.0.bzl.1", + compatibility_level = 108300, +) + +bazel_dep(name = "rules_cc", version = "0.0.8") +bazel_dep(name = "boost.align", version = "1.83.0.bzl.1") +bazel_dep(name = "boost.bind", version = "1.83.0.bzl.1") +bazel_dep(name = "boost.config", version = "1.83.0.bzl.6") +bazel_dep(name = "boost.conversion", version = "1.83.0.bzl.1") +bazel_dep(name = "boost.core", version = "1.83.0.bzl.1") +bazel_dep(name = "boost.detail", version = "1.83.0.bzl.1") +bazel_dep(name = "boost.foreach", version = "1.83.0.bzl.1") +bazel_dep(name = "boost.function", version = "1.83.0.bzl.1") +bazel_dep(name = "boost.graph", version = "1.83.0.bzl.1") +bazel_dep(name = "boost.integer", version = "1.83.0.bzl.1") +bazel_dep(name = "boost.iterator", version = "1.83.0.bzl.1") +bazel_dep(name = "boost.lexical_cast", version = "1.83.0.bzl.1") +bazel_dep(name = "boost.mpl", version = "1.83.0.bzl.1") +bazel_dep(name = "boost.numeric_conversion", version = "1.83.0.bzl.1") +bazel_dep(name = "boost.preprocessor", version = "1.83.0.bzl.1") +bazel_dep(name = "boost.property_map", 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.tuple", version = "1.83.0.bzl.1") +bazel_dep(name = "boost.type_traits", version = "1.83.0.bzl.1") +bazel_dep(name = "boost.utility", version = "1.83.0.bzl.1") diff --git a/WORKSPACE.bazel b/WORKSPACE.bazel new file mode 100644 index 000000000..be0754f66 --- /dev/null +++ b/WORKSPACE.bazel @@ -0,0 +1 @@ +# SEE: MODULE.bazel From 249bdf4a23e3bc99108a940321a15c8de5fad969 Mon Sep 17 00:00:00 2001 From: Ezekiel Warren Date: Thu, 7 Sep 2023 20:31:15 -0700 Subject: [PATCH 2/3] chore: remove boost ci --- .github/workflows/deploy-documentation.yml | 37 ---------------- .github/workflows/test-osx.yml | 45 ------------------- .github/workflows/test-ubuntu.yml | 51 ---------------------- .github/workflows/test-windows.yml | 49 --------------------- 4 files changed, 182 deletions(-) delete mode 100644 .github/workflows/deploy-documentation.yml delete mode 100644 .github/workflows/test-osx.yml delete mode 100644 .github/workflows/test-ubuntu.yml delete mode 100644 .github/workflows/test-windows.yml diff --git a/.github/workflows/deploy-documentation.yml b/.github/workflows/deploy-documentation.yml deleted file mode 100644 index 065945137..000000000 --- a/.github/workflows/deploy-documentation.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: deploy documentation - -on: [push] - -jobs: - deploy: - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v2 - - name: setup - run: | - sudo apt-get update - sudo apt-get install \ - libboost1.71-tools-dev \ - python3 \ - python3-numpy \ - python3-sphinx \ - xsltproc \ - docbook-xsl - sudo python3 -m pip install --upgrade pip - sudo python3 -m pip install faber - - name: build - run: | - sed -e "s/\$PYTHON/python3/g" .ci/faber > ~/.faber - faber --builddir=build doc.html - if [ "${GITHUB_REF##*/}" == master ]; then - echo "destination_dir=doc/html" >> $GITHUB_ENV - else - echo "destination_dir=doc/develop/html" >> $GITHUB_ENV - fi - - name: deploy - uses: peaceiris/actions-gh-pages@v3 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: build/doc/html - destination_dir: ${{ env.destination_dir }} - keep_files: true diff --git a/.github/workflows/test-osx.yml b/.github/workflows/test-osx.yml deleted file mode 100644 index 19928d875..000000000 --- a/.github/workflows/test-osx.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: Test OSX - -on: [push, pull_request] - -jobs: - build: - runs-on: macOS-latest - - strategy: - fail-fast: false - matrix: - python-version: [3.6] - cxx: [clang++] - std: [c++98, c++11, c++14] # TODO: c++17 is failing ! - - steps: - - uses: actions/checkout@v2 - - name: setup python - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - name: setup prerequisites - run: | - brew install boost - python -m pip install --upgrade pip - python -m pip install setuptools faber - - name: build - run: | - python --version - ${{ matrix.cxx }} --version - faber -v - sed -e "s/\$PYTHON/python/g" .ci/faber > ~/.faber - faber \ - --builddir=build \ - cxx.name=${{ matrix.cxx }} \ - cxxflags=-std=${{ matrix.std }} \ - -j`sysctl -n hw.ncpu` - - name: test - run: | - faber \ - --builddir=build\ - cxx.name=${{ matrix.cxx }} \ - cxxflags=-std=${{ matrix.std }} \ - -j`sysctl -n hw.ncpu` \ - test.report diff --git a/.github/workflows/test-ubuntu.yml b/.github/workflows/test-ubuntu.yml deleted file mode 100644 index dab98aee4..000000000 --- a/.github/workflows/test-ubuntu.yml +++ /dev/null @@ -1,51 +0,0 @@ -name: Test Ubuntu - -on: [push, pull_request] - -jobs: - build: - runs-on: ubuntu-latest - - strategy: - fail-fast: false - matrix: - python: [python, python3] - cxx: [g++, clang++] - std: [c++98, c++11, c++14, c++17] - include: - # Add the appropriate docker image for each compiler. - # The images from teeks99/boost-python-test already have boost::python - # pre-reqs installed, see: - # https://github.com/teeks99/boost-python-test-docker - - cxx: clang++ - docker-img: teeks99/boost-python-test:clang-12_1.76.0 - - cxx: g++ - docker-img: teeks99/boost-python-test:gcc-10_1.76.0 - - container: - image: ${{ matrix.docker-img }} - - steps: - - uses: actions/checkout@v2 - - - name: build - run: | - ${{ matrix.python }} --version - ${{ matrix.cxx }} --version - faber -v - sed -e "s/\$PYTHON/${{ matrix.python }}/g" .ci/faber > ~/.faber - faber \ - --with-boost-include=${BOOST_PY_DEPS} \ - --builddir=build \ - cxx.name=${{ matrix.cxx }} \ - cxxflags=-std=${{ matrix.std }} \ - -j`nproc` - - name: test - run: | - faber \ - --with-boost-include=${BOOST_PY_DEPS} \ - --builddir=build \ - cxx.name=${{ matrix.cxx }} \ - cxxflags=-std=${{ matrix.std }} \ - -j`nproc` \ - test.report diff --git a/.github/workflows/test-windows.yml b/.github/workflows/test-windows.yml deleted file mode 100644 index 36c4a8e4f..000000000 --- a/.github/workflows/test-windows.yml +++ /dev/null @@ -1,49 +0,0 @@ -name: Test Windows - -on: [push, pull_request] - -jobs: - build: - runs-on: windows-latest - strategy: - fail-fast: false - matrix: - python-version: [3.7] - - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - uses: microsoft/setup-msbuild@v1.1 - - name: setup boost prerequisites - uses: lukka/run-vcpkg@v6 - with: - vcpkgGitCommitId: '88b1071e39f13b632644d9d953738d345a4ac055' - vcpkgDirectory: '${{ runner.workspace }}/vcpkg' - vcpkgTriplet: x64-windows - vcpkgArguments: > - boost-config - boost-core - boost-function - boost-graph - boost-iterator - boost-lexical-cast - boost-mpl - boost-preprocessor - boost-smart-ptr - boost-static-assert - boost-align - - name: setup faber - run: | - python -m pip install --upgrade pip - python -m pip install setuptools faber numpy - faber --info=tools cxx - - name: build - shell: cmd - run: | - faber --builddir=build cxx.name=msvc --with-boost-include=${{ runner.workspace }}/vcpkg/installed/x64-windows/include -j4 - - name: test - shell: cmd - run: | - faber --builddir=build cxx.name=msvc --with-boost-include=${{ runner.workspace }}/vcpkg/installed/x64-windows/include -j4 test.report From 77f9f86442bb4421f7f898014839313e0f17d332 Mon Sep 17 00:00:00 2001 From: Ezekiel Warren Date: Thu, 7 Sep 2023 20:31:19 -0700 Subject: [PATCH 3/3] chore: gitignore bazel related files --- .gitignore | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 06ea5d43c..befba87c4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,11 @@ bin.SCons *.pyc *~ -\#*\# \ No newline at end of file +\#*\# + +# Bazel +/bazel-* +/external +/.cache +/compile_commands.json +user.bazelrc