-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.zig
More file actions
63 lines (57 loc) · 2.16 KB
/
build.zig
File metadata and controls
63 lines (57 loc) · 2.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
const std = @import("std");
pub fn build(b: *std.Build) void {
const upstream = b.dependency("win_iconv", .{});
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const linkage = b.option(std.builtin.LinkMode, "linkage", "Link mode") orelse .static;
const strip = b.option(bool, "strip", "Omit debug information");
const pic = b.option(bool, "pie", "Produce Position Independent Code");
const exe = b.addExecutable(.{
.name = "win_iconv",
.root_module = b.createModule(.{
.target = target,
.optimize = optimize,
.strip = strip,
.pic = pic,
.link_libc = true,
}),
});
b.installArtifact(exe);
exe.root_module.addCSourceFile(.{ .file = upstream.path("win_iconv.c") });
exe.root_module.addCMacro("MAKE_EXE", "1");
exe.root_module.addCMacro("USE_LIBICONV_DLL", "1");
const lib = b.addLibrary(.{
.linkage = linkage,
.name = "iconv",
.root_module = b.createModule(.{
.target = target,
.optimize = optimize,
.strip = strip,
.pic = pic,
.link_libc = true,
}),
});
lib.installHeader(upstream.path("iconv.h"), "iconv.h");
lib.installHeader(upstream.path("localcharset.h"), "localcharset.h");
lib.root_module.addCSourceFile(.{ .file = upstream.path("win_iconv.c") });
switch (linkage) {
.static => {},
.dynamic => lib.root_module.addCMacro("MAKE_DLL", "1"),
}
lib.root_module.addCMacro("USE_LIBICONV_DLL", "1");
b.installArtifact(lib);
const win_iconv_test = b.addExecutable(.{
.name = "win_iconv_test",
.root_module = b.createModule(.{
.target = target,
.optimize = optimize,
.strip = strip,
.pic = pic,
.link_libc = true,
}),
});
win_iconv_test.root_module.addCSourceFile(.{ .file = upstream.path("win_iconv_test.c") });
win_iconv_test.root_module.addCMacro("USE_LIBICONV_DLL", "1");
const test_step = b.step("test", "Run tests");
test_step.dependOn(&b.addRunArtifact(win_iconv_test).step);
}