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

Move to the new Zig modules #3

Closed
wants to merge 4 commits into from
Closed
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
39 changes: 26 additions & 13 deletions build.zig
Original file line number Diff line number Diff line change
@@ -1,26 +1,39 @@
const Builder = @import("std").build.Builder;
const Build = @import("std").Build;
const FileSource = Build.FileSource;

pub fn build(b: *Builder) void {
pub fn build(b: *Build) void {
const target = b.standardTargetOptions(.{});
const mode = b.standardReleaseOptions();

const lib = b.addStaticLibrary("zig-wcwidth", "src/main.zig");
lib.setTarget(target);
lib.setBuildMode(mode);
const optimize = b.standardOptimizeOption(.{});

_ = b.addModule("wcwidth", .{
.source_file = .{ .path = "src/main.zig" },
});

const lib = b.addStaticLibrary(.{
.name = "zig-wcwidth",
.root_source_file = FileSource.relative("src/main.zig"),
.target = target,
.optimize = optimize,
});
lib.install();

var generate = b.addExecutable("generate", "tools/generate.zig");
generate.setTarget(target);
generate.setBuildMode(mode);
var generate = b.addExecutable(.{
.name = "generate",
.root_source_file = FileSource.relative("tools/generate.zig"),
.target = target,
.optimize = optimize,
});

var generate_run = generate.run();

const generate_step = b.step("generate", "Generate tables");
generate_step.dependOn(&generate_run.step);

var main_tests = b.addTest("src/test.zig");
main_tests.setTarget(target);
main_tests.setBuildMode(mode);
var main_tests = b.addTest(.{
.root_source_file = FileSource.relative("src/test.zig"),
.target = target,
.optimize = optimize,
});

const test_step = b.step("test", "Run library tests");
test_step.dependOn(&main_tests.step);
Expand Down