diff --git a/.github/workflows/distro-ci.yml b/.github/workflows/distro-ci.yml index d7860526..830e44fb 100644 --- a/.github/workflows/distro-ci.yml +++ b/.github/workflows/distro-ci.yml @@ -21,20 +21,12 @@ jobs: config: - tag: fedora name: Fedora - - tag: debian-stable - name: Debian Stable - - tag: debian-unstable - name: Debian Unstable + - tag: debian + name: Debian - tag: archlinux name: Arch Linux - tag: gentoo-glibc name: Gentoo GLibc -# - tag: gentoo-musl -# name: Gentoo Musl -# - tag: alpine -# name: Alpine - - tag: ubuntu - name: Ubuntu steps: - run: | diff --git a/.github/workflows/docker-autobuild.yml b/.github/workflows/docker-autobuild.yml index db5b838e..1fedede8 100644 --- a/.github/workflows/docker-autobuild.yml +++ b/.github/workflows/docker-autobuild.yml @@ -5,7 +5,7 @@ on: - cron: "0 0 */7 * *" push: paths: - - 'docker/**' + - "docker/**" permissions: contents: read @@ -19,19 +19,13 @@ jobs: config: - tag: fedora name: Fedora - - tag: debian-stable - name: Debian Stable - - tag: debian-unstable - name: Debian Unstable + - tag: debian + name: Debian - tag: archlinux name: Arch Linux - tag: gentoo-glibc name: Gentoo GLibc - - tag: alpine - name: Alpine - - tag: ubuntu - name: Ubuntu - + steps: - name: Install Docker Buildx uses: docker/setup-buildx-action@v3 @@ -54,51 +48,3 @@ jobs: context: "{{ defaultContext }}:docker/${{ matrix.config.tag }}" push: true tags: hyperwin/hcpu-ci:${{ matrix.config.tag }} - - build-gentoo-musl-stage1: - runs-on: ubuntu-latest - name: "Update Gentoo Musl Docker image - stage 1" - steps: - - name: Login to DockerHub - uses: docker/login-action@v3 - with: - username: hyperwin - password: ${{ secrets.DOCKERHUB_PASSWORD }} - - - name: Checkout repository - uses: actions/checkout@v4 - with: - fetch-depth: 2 - submodules: true - - - name: Build and push - uses: docker/build-push-action@v6 - with: - context: "{{ defaultContext }}:docker/gentoo-musl/stage1" - push: true - tags: hyperwin/hcpu-ci:gentoo-musl-build - - build-gentoo-musl-stage2: - runs-on: ubuntu-latest - name: "Update Gentoo Musl Docker image - stage 2" - needs: build-gentoo-musl-stage1 - steps: - - name: Login to DockerHub - uses: docker/login-action@v3 - with: - username: hyperwin - password: ${{ secrets.DOCKERHUB_PASSWORD }} - - - name: Checkout repository - uses: actions/checkout@v4 - with: - fetch-depth: 2 - submodules: true - - - name: Build and push - uses: docker/build-push-action@v6 - with: - context: "{{ defaultContext }}:docker/gentoo-musl/stage2" - push: true - tags: hyperwin/hcpu-ci:gentoo-musl - diff --git a/.github/workflows/run-tests-feature-branch.yml b/.github/workflows/run-tests-feature-branch.yml index f162b636..61272c21 100644 --- a/.github/workflows/run-tests-feature-branch.yml +++ b/.github/workflows/run-tests-feature-branch.yml @@ -24,10 +24,8 @@ jobs: - name: Build and test with GCC on Release profile run: | - bazelisk test //src/... //tests/... --config=linux-dbg --compiler=gcc - bazelisk clean --expunge + CC=gcc bazelisk test //src/... //tests/... --config=linux-dbg - name: Build and test with LLVM on Release profile run: | - bazelisk test //src/... //tests/... --config=linux-dbg --compiler=clang - bazelisk clean --expunge + CC=clang bazelisk test //src/... //tests/... --config=linux-dbg diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index cf42f349..a58e00ba 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -26,20 +26,16 @@ jobs: - name: Build and test with GCC on Debug profile run: | - bazelisk test //src/... //tests/... --config=linux-dbg --compiler=gcc - bazelisk clean --expunge + CC=gcc bazelisk test //src/... //tests/... --config=linux-dbg - name: Build and test with GCC on Release profile run: | - bazelisk test //src/... //tests/... --config=linux-opt --compiler=gcc - bazelisk clean --expunge + CC=gcc bazelisk test //src/... //tests/... --config=linux-opt - name: Build and test with LLVM on Debug profile run: | - bazelisk test //src/... //tests/... --config=linux-dbg --compiler=clang - bazelisk clean --expunge + CC=clang bazelisk test //src/... //tests/... --config=linux-dbg - name: Build and test with LLVM on Release profile run: | - bazelisk test //src/... //tests/... --config=linux-opt --compiler=clang - bazelisk clean --expunge + CC=clang bazelisk test //src/... //tests/... --config=linux-opt diff --git a/MODULE.bazel b/MODULE.bazel index 3b3570dd..66b16a91 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -10,23 +10,22 @@ module( conan = use_extension("//conan:conan_deps_module_extension.bzl", "conan_extension") use_repo( conan, - "abseil", - "argparse", - "benchmark", - "boost", - "bzip2", "eternal", "fmt", - "gtest", "libbacktrace", "libunwind", - "re2", "spdlog", "xz_utils", "zlib", ) -bazel_dep(name = "rules_cc", version = "0.0.17") +bazel_dep(name = "boost.system", version = "1.87.0") +bazel_dep(name = "argparse", version = "3.0.0") +bazel_dep(name = "google_benchmark", version = "1.9.2") +bazel_dep(name = "googletest", version = "1.17.0") +bazel_dep(name = "re2", version = "2024-07-02.bcr.1") + +bazel_dep(name = "rules_cc", version = "0.1.1") bazel_dep(name = "aspect_rules_lint", version = "1.3.5") bazel_dep(name = "bazel_skylib", version = "1.7.1") diff --git a/conandata.yml b/conandata.yml index aa465698..3d0b650f 100644 --- a/conandata.yml +++ b/conandata.yml @@ -1,12 +1,6 @@ requirements: - gtest: "1.14.0" - benchmark: "1.9.1" - abseil: "20240116.1" libbacktrace: "cci.20210118" - argparse: "3.2" eternal: "1.0.1" - re2: "20230801" fmt: "11.0.2" libunwind: "1.8.1" - boost: "1.87.0" spdlog: "1.15.0" diff --git a/src/PCH/BUILD.bazel b/src/PCH/BUILD.bazel index 123b0274..ced4bf68 100644 --- a/src/PCH/BUILD.bazel +++ b/src/PCH/BUILD.bazel @@ -1,7 +1,7 @@ -load("//tools/bazel:pch.bzl", "precompiled_headers") +load("@rules_cc//cc:defs.bzl", "cc_library") -precompiled_headers( +cc_library( name = "pch_cstd", - main = "CStd.hpp", - visibility = ["//visibility:public"], + hdrs = ["CStd.hpp"], + visibility = ["//visibility:public"] ) diff --git a/src/Pog/BUILD.bazel b/src/Pog/BUILD.bazel index 5cd65d04..1d9c8847 100644 --- a/src/Pog/BUILD.bazel +++ b/src/Pog/BUILD.bazel @@ -1,24 +1,13 @@ load("@rules_cc//cc:defs.bzl", "cc_library") -load("//tools/bazel:pch.bzl", "precompiled_headers") cc_library( - name = "pog_core", + name = "pog", hdrs = glob( - ["**/*.hpp"], - exclude = ["Pog.hpp"], + ["**/*.hpp"] ), - visibility = ["//visibility:private"], + visibility = ["//visibility:public"], deps = [ "@fmt", "@re2", ], ) - -precompiled_headers( - name = "pog", - main = "Pog.hpp", - visibility = ["//visibility:public"], - deps = [ - ":pog_core", - ], -) diff --git a/tests/BUILD.bazel b/tests/BUILD.bazel index 4a50d10c..f4c9e266 100644 --- a/tests/BUILD.bazel +++ b/tests/BUILD.bazel @@ -1,5 +1,4 @@ load("@rules_cc//cc:defs.bzl", "cc_library") -load("//tools/bazel:pch.bzl", "precompiled_headers") package( default_visibility = [ @@ -7,11 +6,11 @@ package( ], ) -precompiled_headers( +cc_library( name = "pch_gtest", - main = "gtest.hpp", + hdrs = ["gtest.hpp"], deps = [ - "@gtest//:gtest-libgtest", + "@googletest//:gtest", ], ) diff --git a/tests/Integration/BUILD.bazel b/tests/Integration/BUILD.bazel index f5269665..15971ce0 100644 --- a/tests/Integration/BUILD.bazel +++ b/tests/Integration/BUILD.bazel @@ -11,6 +11,6 @@ cc_test( "//tests:pch_gtest", "//tests:test_fixtures", "@fmt", - "@gtest//:gtest-gmock_main", + "@googletest//:gtest_main", ], ) diff --git a/tests/Modular/BUILD.bazel b/tests/Modular/BUILD.bazel index 04a2b0bd..5b7631d8 100644 --- a/tests/Modular/BUILD.bazel +++ b/tests/Modular/BUILD.bazel @@ -14,6 +14,6 @@ cc_test( "//tests:pch_gtest", "//tests:test_fixtures", "@fmt", - "@gtest//:gtest-gmock_main", + "@googletest//:gtest_main", ], ) diff --git a/tests/Pog/BUILD.bazel b/tests/Pog/BUILD.bazel index 05d3a74e..94c3927a 100644 --- a/tests/Pog/BUILD.bazel +++ b/tests/Pog/BUILD.bazel @@ -8,7 +8,7 @@ cc_test( "//src/Pog:pog", "//tests:pch_gtest", "@fmt", - "@gtest//:gtest-gmock_main", + "@googletest//:gtest_main", "@re2", ], ) diff --git a/tools/bazel/pch.bzl b/tools/bazel/pch.bzl deleted file mode 100644 index 6f7eb9ae..00000000 --- a/tools/bazel/pch.bzl +++ /dev/null @@ -1,113 +0,0 @@ -"Custom target to support precompiled headers. Notice, this is relevant to end-consumer project, like ours" -# Inspired by: https://github.com/erenon/rules_pch - -load("@bazel_tools//tools/cpp:toolchain_utils.bzl", "find_cpp_toolchain") -load("@rules_cc//cc:action_names.bzl", "CPP_COMPILE_ACTION_NAME") - -def _global_flags(ctx, cc_toolchain): - feature_configuration = cc_common.configure_features( - ctx = ctx, - cc_toolchain = cc_toolchain, - ) - compile_variables = cc_common.create_compile_variables( - feature_configuration = feature_configuration, - cc_toolchain = cc_toolchain, - user_compile_flags = ctx.fragments.cpp.cxxopts + ctx.fragments.cpp.copts, - ) - tc_flags = cc_common.get_memory_inefficient_command_line( - feature_configuration = feature_configuration, - action_name = CPP_COMPILE_ACTION_NAME, - variables = compile_variables, - ) - - if cc_toolchain.needs_pic_for_dynamic_libraries(feature_configuration = feature_configuration): - return tc_flags + ["-fPIC"] - - return tc_flags - -def _precompiled_headers_impl(ctx): - files = ctx.attr.main.files.to_list() - if len(files) != 1: - fail("expected a single aggregated header to compile, got: {}".format(files)) - main_file = files[0] - - args = ctx.actions.args() - - # add args specified by the toolchain and on the command line - cc_toolchain = find_cpp_toolchain(ctx) - args.add_all(_global_flags(ctx, cc_toolchain)) - - # collect headers, include paths and defines of dependencies - headers = [] - for dep in ctx.attr.deps: - if not CcInfo in dep: - fail("dep arguments must provide CcInfo (e.g: cc_library)") - - # collect exported header files - compilation_context = dep[CcInfo].compilation_context - headers.append(compilation_context.headers) - - # add defines - for define in compilation_context.defines.to_list(): - args.add("-D" + define) - - # add include dirs - for i in compilation_context.includes.to_list(): - args.add("-I" + i) - - args.add_all(compilation_context.quote_includes.to_list(), before_each = "-iquote") - args.add_all(compilation_context.system_includes.to_list(), before_each = "-isystem") - - inputs = depset(direct = [main_file], transitive = headers + [cc_toolchain.all_files]) - - # add args specified for this rule - args.add_all(ctx.attr.copts) - - # force compilation of header - args.add("-xc++-header") - args.add(main_file.path) - - # specify output - output = ctx.actions.declare_file("{}.pch".format(main_file.basename)) - args.add("-o", output.path) - - # Unless -MD is specified while creating the precompiled file, - # the .d file of the user of the precompiled file will not - # show the precompiled file: therefore bazel will not rebuild - # the user if the pch file changes. - args.add("-MD") - args.add("-MF", "/dev/null") - - ctx.actions.run( - inputs = inputs, - outputs = [output], - executable = cc_toolchain.compiler_executable, - arguments = [args], - mnemonic = "PrecompileHdrs", - progress_message = "Pre-compiling header: {}".format(main_file.basename), - ) - - # create a CcInfo output that cc_binary rules can depend on - compilation_context = cc_common.create_compilation_context( - headers = depset(direct = [output, main_file]), - includes = depset(direct = [output.dirname]), - ) - main_cc_info = CcInfo(compilation_context = compilation_context, linking_context = None) - cc_info = cc_common.merge_cc_infos( - direct_cc_infos = [main_cc_info], - cc_infos = [dep[CcInfo] for dep in ctx.attr.deps if CcInfo in dep], - ) - - return [cc_info] - -precompiled_headers = rule( - implementation = _precompiled_headers_impl, - attrs = { - "main": attr.label(allow_files = True, mandatory = True), - "deps": attr.label_list(), - "copts": attr.string_list(), - "_cc_toolchain": attr.label(default = Label("@bazel_tools//tools/cpp:current_cc_toolchain")), - }, - toolchains = ["@bazel_tools//tools/cpp:toolchain_type"], - fragments = ["cpp"], -)