Util scripts aimed at simplifying the use of `zig cc` for compiling C, C++, Rust, and Go programs.
Project description
zigcc
Util scripts aimed at simplifying the use of zig cc{.verbatim} for
compiling C, C++, Rust, and Go programs.
Why
In most cases, we can use following command to use Zig for compile
CC='zig cc' CXX='zig c++' ...
However in real world, there are many issues this way, such as:
- zig cc: parse -target and -mcpu/-march/-mtune flags according to clang #4911
- Targets compare: Rust to Zig
- unsupported linker arg
- Rust + `zig cc` CRT conflict. : rust
So this project was born, it will
- Convert target between Zig and Rust/Go
- Ignore link args when
zig cc{.verbatim} throw errors, hopefully this will make compile successfully, WIP.
Install
pip3 install -U zigcc
This will install three executables:
zigcc{.verbatim}, used forCC{.verbatim}zigcxx{.verbatim}, used forCXX{.verbatim}zigcargo{.verbatim} can used to replacecargo{.verbatim}, it will automatically setCC{.verbatim}CARGO_TARGET_<triple>_LINKER{.verbatim} tozigcc{.verbatim}CXX{.verbatim} tozigcxx{.verbatim}
Use in GitHub Action
Adding a step to your workflow like this:
- name: Install zigcc
uses: jiacai2050/zigcc@v1
with:
zig-version: master
Then you can invoke zigcc{.verbatim} zigcxx{.verbatim}
zigcargo{.verbatim} in following steps.
Config
There some are env variable to config zigcc:
-
ZIGCC_FLAGS{.verbatim}, space separated flags, pass to zig cc. An example is set this to-fno-sanitize=undefined{.verbatim} to disable sanitize since they may break your programs. See Catching undefined behavior with zig cc -
ZIGCC_BLACKLIST_FLAGS{.verbatim}, space separated flags, used to filter flagszig cc{.verbatim} don't support, such as-Wl,-dylib{.verbatim} otherwise you could see errors belownote: error: unsupported linker arg: -dylib
-
ZIGCC_VERBOSE{.verbatim} Set to1{.verbatim} enable verbose logs.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file zigcc-1.0.0.tar.gz.
File metadata
- Download URL: zigcc-1.0.0.tar.gz
- Upload date:
- Size: 5.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.27.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2af491a6be24df3ffc9a89a6d638c3ec8e96a3f33749c9390be448c60a0e0c5e
|
|
| MD5 |
baa26e3409bc05a555e9d532168c712b
|
|
| BLAKE2b-256 |
43e66b353a86260d4be817b1fa4d786b5fc64ae8966fe8a5ac634c61acad394e
|
File details
Details for the file zigcc-1.0.0-py3-none-any.whl.
File metadata
- Download URL: zigcc-1.0.0-py3-none-any.whl
- Upload date:
- Size: 5.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.27.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
af2b712edc27514d98ab1a9ddb62e1815486efef60a23a7a259d6d979cb7b228
|
|
| MD5 |
bb096ebd0a7efe88d963441c641f215b
|
|
| BLAKE2b-256 |
23d4690393ad6dc44cf045cf79518b2505a2e357d7acc545ce5b6650b68fb420
|