Skip to content

Commit

Permalink
Replace compute.c with compute.zig
Browse files Browse the repository at this point in the history
  • Loading branch information
tiehuis committed Jul 19, 2017
1 parent 0704b44 commit c74cba4
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
11 changes: 10 additions & 1 deletion build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ const Builder = @import("std").build.Builder;

pub fn build(b: &Builder) {
const exe = b.addCExecutable("main");
b.addCIncludePath(".");
exe.addCompileFlags([][]const u8 {
"-std=c99"
});

const source_files = [][]const u8 {
"compute.c",
"compute_helper.c",
"display.c",
"main.c"
Expand All @@ -17,6 +17,15 @@ pub fn build(b: &Builder) {
exe.addSourceFile(source);
}

const zig_source_files = [][]const u8 {
"compute.zig",
};

for (zig_source_files) |source| {
const object = b.addObject(source, source);
exe.addObject(object);
}

exe.setOutputPath("./main");
b.default_step.dependOn(&exe.step);
}
6 changes: 0 additions & 6 deletions compute.c

This file was deleted.

5 changes: 5 additions & 0 deletions compute.zig
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pub use @cImport(@cInclude("compute_helper.h"));

export fn compute(a: u8) -> u8 {
compute_helper(a) + 5
}

0 comments on commit c74cba4

Please sign in to comment.