Skip to content

Would you consider building with Zig? #430

Closed

Description

@inge4pres

Motivation

Zig has an interesting approach to building software, is interoperable with C and C++.
Despite not being stabilized yet, it shows great capabilities in multiple areas where precise control of resources is desirable.

Adding a build.zig and a build.zig.zon file to this repo would allow all users to build (and test, maybe) this project with the zig binary.
It would automatically allow the project to be packaged as a Zig dependency that other projects can use in their build scripts.

Implementation Plan

The zig build artifacts can co-exist with the CMake/bazel build currently in place.
What we would do:

  • Add the build files in the repo root
  • (optional) Create a build directory if the build script gets too hairy
  • Add a GitHub workflow that builds the project with the latest released version of Zig

Activity

  1. gchatelet commented on Oct 8, 2025

    @gchatelet
    Collaborator

    I don't know Zig myself but I'm not opposed to its addition to cpu_features as long as it's not too big. Also I can't commit to supporting it so that would be a community effort.
    Would you mind creating a PR so I get a feel of it (doesn't need to be complete).

    Side note, I'm not too fond of a build folder because CMake users usually create their project here so its likely to conflict.

  2. Mizux commented on Oct 8, 2025

    @Mizux
    Collaborator

    +1 for not using build dir, since we already have a bazel/ and cmake/ top dir, would it be possible to have a zig/ top dir instead ?

  3. added
    enhancement
    question
    on Oct 8, 2025
  4. inge4pres commented on Oct 8, 2025

    @inge4pres
    ContributorAuthor

    Thanks for your inputs 🙏🏼

    Also I can't commit to supporting it so that would be a community effort.

    I'd be happy to contribute this change myself, and maintain it if needed.
    Zig releases happen on a semester/quarter basis so when those land, maintainers should update the Github action and the build.zig file accordingly.

    I can create a draft PR to discuss.

    +1 for not using build dir, since we already have a bazel/ and cmake/ top dir, would it be possible to have a zig/ top dir instead ?

    Deal, although it's not going to be necessary to have an additional folder at all, only if the build script becomes too complex to have in just 1 file.
    Let's say we can start with just 2 files, and if necessary, a top-level zig folder will contain the zig build harness.

  5. inge4pres commented on Oct 8, 2025

    @inge4pres
    ContributorAuthor

    Linked PR provides ability to build with Zig 0.15.1.

  6. inge4pres commented on Oct 14, 2025

    @inge4pres
    ContributorAuthor

    @Mizux @gchatelet thanks for the reviews 🙏🏼 the PR requires a new approval as I had pushed one more commit to address a comment after approval.

  7. inge4pres commented on Oct 14, 2025

    @inge4pres
    ContributorAuthor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementquestion

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions