Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hyzyla/c-by-zig
Example of a C project that uses Zig as a build system
https://github.com/hyzyla/c-by-zig
Last synced: 1 day ago
JSON representation
Example of a C project that uses Zig as a build system
- Host: GitHub
- URL: https://github.com/hyzyla/c-by-zig
- Owner: hyzyla
- License: mit
- Created: 2024-05-06T20:51:29.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2024-05-06T21:05:38.000Z (9 months ago)
- Last Synced: 2025-01-16T03:19:27.003Z (4 days ago)
- Language: Zig
- Size: 2.93 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Basic Setup for a C Project Using the Zig Build System
This document provides a basic setup for a C project utilizing the Zig build system. It should simplify the process of setting up a new project especially for beginners (like me).
## Prerequisites
- Install [Zig](https://ziglang.org/learn/getting-started/#installing-zig)## Usage
Run the following command to build and run the project:
```shell
zig build run
```## Project structure
```
.
├── build.zig # build script
└── src # source files
├── main.c
├── lib.h
└── lib.c
```!!! note
If you have added or removed files, you need to update the list of files in the `build.zig` file, in the `exe.addCSourceFiles` section:
```diff
exe.addCSourceFiles(.{
.files = &.{
"src/main.c",
"src/lib.c",
+ "src/another_file.c",
},
});
```