Skip to content

Adding Zig build#353

Open
Kbz-8 wants to merge 4 commits into
pytorch:mainfrom
Kbz-8:main
Open

Adding Zig build#353
Kbz-8 wants to merge 4 commits into
pytorch:mainfrom
Kbz-8:main

Conversation

@Kbz-8

@Kbz-8 Kbz-8 commented Dec 8, 2025

Copy link
Copy Markdown

I added a Zig build script because I wanted to use cpuinfo in a Zig project. Here's a small PR adding it if you want.

It adds possibility to use this library in Zig codes but also permit to compile the library with the Zig toolchain even if it is not used in Zig.

The build script is mainly based on the BAZEL one.

I do not expect it to be merged as it is a pretty niche adding but I'm opening this PR just in case.

@meta-cla meta-cla Bot added the cla signed label Dec 8, 2025
@fbarchard

Copy link
Copy Markdown
Contributor

Can you clarify if this is for the zig compiler or a zig build tool?
If it can be treated as a compiler, the main build files (bazel) may be able to use the existing build files?
Also for the compiler aspect, it may be interesting to explore via godbolt, as a way to test code builds correctly with zig

@Kbz-8

Kbz-8 commented Dec 27, 2025

Copy link
Copy Markdown
Author

This is for the Zig build system and thus will use the Zig compiler. This is mainly for Zig projects wanting to use cpuinfo

@Kbz-8

Kbz-8 commented Jan 5, 2026

Copy link
Copy Markdown
Author

Also for the compiler aspect, it may be interesting to explore via godbolt, as a way to test code builds correctly with zig

When compiling C code the Zig compiler wraps Clang so I don't think this is necessary (only notable difference is that ubsan is activated by default iirc).

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants