Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zig v0.10 #5

Merged
merged 15 commits into from
Jan 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
*.swp
zig-cache/
zig-*
headers/
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
Here are the following supported language binding outputs:

- [x] C Bindings
- [ ] Python Bindings
- [x] Python Bindings
- [ ] Rust Bindings
- [ ] Go Bindings
- [ ] Nim Bindings
Expand All @@ -28,7 +28,7 @@ const std = @import("std");
export fn print_msg(msg_ptr: ?[*]const u8, len: usize) bool {
if (msg_ptr) |raw_msg| {
const msg = raw_msg[0 .. len - 1];
std.debug.warn("Msg is: {}", .{msg});
std.debug.print("Msg is: {}", .{msg});
return true;
}
return false;
Expand Down
14 changes: 6 additions & 8 deletions build.zig
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
const Builder = @import("std").build.Builder;
const header_gen = @import("header_gen.zig");

const std = @import("std");
const warn = std.debug.warn;
const warn = std.debug.print;

// This build.zig is only used as an example of using header_gen

Expand All @@ -11,18 +10,17 @@ pub fn build(b: *Builder) void {

const mode = b.standardReleaseOptions();

const exe = b.addExecutable("example", "src/main.zig");
// HEADER GEN BUILD STEP
const exe = b.addExecutable("example", "src/example/exports.zig");
exe.main_pkg_path = "src/";
exe.setTarget(target);
exe.setBuildMode(mode);
exe.addPackagePath("header_gen", "src/header_gen.zig");
exe.install();

const run_cmd = exe.run();
run_cmd.step.dependOn(b.getInstallStep());

const run_step = b.step("run", "Run the app");
const run_step = b.step("headergen", "Run the app");
run_step.dependOn(&run_cmd.step);

// --- Using header_gen
const gen = header_gen.HeaderGen("src/exports.zig").init();
gen.exec(header_gen.C_Generator);
}
Loading