Permalink
Browse files

Replace compute.c with compute.zig

  • Loading branch information...
tiehuis committed Jul 19, 2017
1 parent 0704b44 commit c74cba439b36fa7f6de41a155f156c06083bccfb
Showing with 15 additions and 7 deletions.
  1. +10 −1 build.zig
  2. +0 −6 compute.c
  3. +5 −0 compute.zig
View
@@ -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"
@@ -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);
}
View
@@ -1,6 +0,0 @@
#include "compute_helper.h"
char compute(char a)
{
return compute_helper(a) + 5;
}
View
@@ -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.