Skip to content

Commit b702076

Browse files
Merge pull request #22 from pierrelgol/enhancements
Various enhancements / update of the std.builtin.Type enum usage
2 parents f365786 + 50253e4 commit b702076

File tree

3 files changed

+228
-206
lines changed

3 files changed

+228
-206
lines changed

.gitignore

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# This file is for zig-specific build artifacts.
2+
# If you have OS-specific or editor-specific files to ignore,
3+
# such as *.swp or .DS_Store, put those in your global
4+
# ~/.gitignore and put this in your ~/.gitconfig:
5+
#
6+
# [core]
7+
# excludesfile = ~/.gitignore
8+
#
9+
# Cheers!
10+
# -andrewrk
11+
12+
.zig-cache/
13+
zig-out/
14+
/release/
15+
/debug/
16+
/build/
17+
/build-*/
18+
/docgen_tmp/
19+
20+
# Although this was renamed to .zig-cache, let's leave it here for a few
21+
# releases to make it less annoying to work with multiple branches.
22+
zig-cache/
23+

build.zig

+21-17
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,39 @@
11
const std = @import("std");
22

3-
// Although this function looks imperative, note that its job is to
4-
// declaratively construct a build graph that will be executed by an external
5-
// runner.
63
pub fn build(b: *std.Build) void {
7-
// Standard target options allows the person running `zig build` to choose
8-
// what target to build for. Here we do not override the defaults, which
9-
// means any target is allowed, and the default is native. Other options
10-
// for restricting supported target set are available.
114
const target = b.standardTargetOptions(.{});
12-
13-
// Standard optimization options allow the person running `zig build` to select
14-
// between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall. Here we do not
15-
// set a preferred release mode, allowing the user to decide how to optimize.
165
const optimize = b.standardOptimizeOption(.{});
176

187
const lib = b.addStaticLibrary(.{
198
.name = "Fluent",
20-
// In this case the main source file is merely a path, however, in more
21-
// complicated build scripts, this could be a generated file.
229
.root_source_file = b.path("fluent.zig"),
2310
.target = target,
2411
.optimize = optimize,
2512
});
2613

27-
// This declares intent for the library to be installed into the standard
28-
// location when the user invokes the "install" step (the default step when
29-
// running `zig build`).
3014
b.installArtifact(lib);
3115

32-
// Export as module to be available for @import("Fluent") on user site
16+
const check = b.addStaticLibrary(.{
17+
.name = "Fluent",
18+
.root_source_file = b.path("fluent.zig"),
19+
.target = target,
20+
.optimize = optimize,
21+
.use_llvm = false,
22+
.use_lld = false,
23+
});
24+
const check_step = b.step("check", "check if the code compiles");
25+
check_step.dependOn(&check.step);
26+
27+
const lib_unit_tests = b.addTest(.{
28+
.root_source_file = b.path("fluent.zig"),
29+
.target = target,
30+
.optimize = optimize,
31+
});
32+
33+
const run_lib_unit_tests = b.addRunArtifact(lib_unit_tests);
34+
const test_step = b.step("test", "Run unit tests");
35+
test_step.dependOn(&run_lib_unit_tests.step);
36+
3337
_ = b.addModule("Fluent", .{
3438
.root_source_file = b.path("fluent.zig"),
3539
.target = target,

0 commit comments

Comments
 (0)