-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.zig
62 lines (51 loc) · 2.97 KB
/
build.zig
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
//بسم الله الرحمن الرحيم
//la ilaha illa Allah Mohammed Rassoul Allah
const std = @import("std");
// Although this function looks imperative, note that its job is to
// declaratively construct a build graph that will be executed by an external
// runner.
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const dikr = b.addExecutable(.{ .name = "popping-dikr", .target = target, .optimize = optimize });
const settings = b.addExecutable(.{ .name = "popping-dikr-settings", .target = target, .optimize = optimize });
dikr.addCSourceFile(.{ .file = b.path("src/dikr.c") });
settings.addCSourceFile(.{ .file = b.path("src/settings.c") });
dikr.linkLibC();
settings.linkLibC();
if (target.query.isNativeOs() and target.result.isGnu()) {
dikr.linkSystemLibrary("sdl2");
dikr.linkSystemLibrary("sdl2_ttf");
settings.linkSystemLibrary("sdl2");
settings.linkSystemLibrary("sdl2_ttf");
} else if (target.result.isMinGW()) {
dikr.addIncludePath(b.path("submodules/SDL2-2.30.3/x86_64-w64-mingw32/include"));
dikr.addIncludePath(b.path("submodules/SDL2_ttf-2.22.0/x86_64-w64-mingw32/include/SDL2"));
dikr.addIncludePath(b.path("submodules/SDL2_ttf-2.22.0/x86_64-w64-mingw32/include"));
dikr.addIncludePath(b.path("submodules/SDL2-2.30.3/x86_64-w64-mingw32/include/SDL2"));
settings.addIncludePath(b.path("submodules/SDL2-2.30.3/x86_64-w64-mingw32/include"));
settings.addIncludePath(b.path("submodules/SDL2-2.30.3/x86_64-w64-mingw32/include/SDL2"));
settings.addIncludePath(b.path("submodules/SDL2_ttf-2.22.0/x86_64-w64-mingw32/include"));
settings.addIncludePath(b.path("submodules/SDL2_ttf-2.22.0/x86_64-w64-mingw32/include/SDL2"));
dikr.addObjectFile(b.path("submodules/harfbuzz-win64/libfreetype-6.dll"));
dikr.addObjectFile(b.path("submodules/harfbuzz-win64/libharfbuzz-0.dll"));
dikr.addObjectFile(b.path("submodules/SDL2-2.30.3/x86_64-w64-mingw32/bin/SDL2.dll"));
dikr.addObjectFile(b.path("submodules/SDL2_ttf-2.22.0/x86_64-w64-mingw32/lib/libSDL2_ttf.a"));
settings.addObjectFile(b.path("submodules/harfbuzz-win64/libfreetype-6.dll"));
settings.addObjectFile(b.path("submodules/harfbuzz-win64/libharfbuzz-0.dll"));
settings.addObjectFile(b.path("submodules/SDL2-2.30.3/x86_64-w64-mingw32/bin/SDL2.dll"));
settings.addObjectFile(b.path("submodules/SDL2_ttf-2.22.0/x86_64-w64-mingw32/lib/libSDL2_ttf.a"));
//hide the console by the will of Allah
dikr.subsystem = .Windows;
settings.subsystem = .Windows;
}
b.installArtifact(dikr);
b.installArtifact(settings);
const run_cmd = b.addRunArtifact(dikr);
run_cmd.step.dependOn(b.getInstallStep());
if (b.args) |args| {
run_cmd.addArgs(args);
}
const run_step = b.step("run", "Run the app");
run_step.dependOn(&run_cmd.step);
}