Skip to content

Commit 5bc7470

Browse files
committed
updated README and added CI
1 parent 1097522 commit 5bc7470

File tree

2 files changed

+75
-2
lines changed

2 files changed

+75
-2
lines changed

.github/workflows/ci.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Continuous Integration
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
pull_request:
8+
branches: [main]
9+
10+
workflow_dispatch:
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Check out repository
18+
uses: actions/checkout@v4
19+
20+
- name: Set up LLVM and Clang
21+
run: |
22+
sudo apt-get update
23+
sudo apt-get install -y lld llvm llvm-dev clang
24+
25+
- name: Set up Zig
26+
uses: mlugg/setup-zig@v1
27+
28+
- name: Run `build`
29+
run: zig build

README.md

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,46 @@
1-
# Zig-ZFP: A Zig Build Process for the ZFP Compression Library
2-
This is intended to be a simple build wrapper around the [ZFP C compression library](https://github.com/LLNL/zfp) for Zig.
1+
# zfp-zig: zfp packaged for the Zig programming language
2+
This is the [ZFP C compression library](https://github.com/LLNL/zfp) for the [Zig](https://ziglang.org/) programming language.
3+
4+
# How do I include it in my Zig program?
5+
If you are starting a new package:
6+
```bash
7+
8+
mkdir my_project; cd my_project
9+
zig init
10+
## add the package to 'build.zig.zon'
11+
zig fetch --save=zfp git+https://github.com/keltonhalbert/zfp.git
12+
```
13+
This will add the zig C library as a dependency to your project.
14+
Next, if you are linking it to a library or executable, add the following to **build.zig**:
15+
```Zig
16+
pub fn build(b: *std.Build) !void {
17+
const target = b.standardTargetOptions(.{});
18+
19+
const optimize = b.standardOptimizeOption(.{});
20+
21+
const zfp_dep = b.dependency("zfp", .{
22+
.target = target,
23+
.optimize = optimize,
24+
});
25+
26+
// if you are linking it to a library...
27+
const lib_mod = b.createModule(.{
28+
.root_source_file = b.path("src/root.zig"),
29+
.target = target,
30+
.optimize = optimize,
31+
});
32+
33+
lib_mod.linkLibrary(zfp_dep.artifact("zfp"));
34+
35+
// or, if you are linking it to an executable...
36+
const exe_mod = b.createModule(.{
37+
.root_source_file = b.path("src/main.zig"),
38+
.target = target,
39+
.optimize = optimize,
40+
});
41+
42+
exe_mod.linkLibrary(zfp_dep.artifact("zfp"));
43+
}
44+
```
45+
# Requirements
46+
The target version of Zig is ```0.14```. It may work with earlier versions, but has not been tested.

0 commit comments

Comments
 (0)