cross compile for windows and linux
All checks were successful
Build / build (push) Successful in 23s
All checks were successful
Build / build (push) Successful in 23s
This commit is contained in:
@@ -10,7 +10,9 @@ jobs:
|
||||
uses: actions/checkout@v4
|
||||
- run: wget http://172.17.0.1:8081/repository/ziglang.org/download/0.14.1/zig-x86_64-linux-0.14.1.tar.xz
|
||||
- run: tar xfv zig-x86_64-linux-0.14.1.tar.xz
|
||||
- run: ./zig-x86_64-linux-0.14.1/zig build
|
||||
- run: ./zig-x86_64-linux-0.14.1/zig build-exe src/main.zig -O ReleaseSmall -fstrip -fsingle-threaded -target x86_64-windows
|
||||
- run: ./zig-x86_64-linux-0.14.1/zig build -Doptimize=ReleaseSmall
|
||||
- run: ./zig-x86_64-linux-0.14.1/zig build -Doptimize=ReleaseSmall -Dtarget=x86_64-windows
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -22,8 +22,10 @@ pub fn build(b: *std.Build) void {
|
||||
// set a preferred release mode, allowing the user to decide how to optimize.
|
||||
const optimize = b.standardOptimizeOption(.{});
|
||||
|
||||
const exe_name = b.option([]const u8, "exe_name", "Name of the executable") orelse "zig-totp";
|
||||
|
||||
const lib = b.addStaticLibrary(.{
|
||||
.name = "zig-totp",
|
||||
.name = exe_name,
|
||||
// In this case the main source file is merely a path, however, in more
|
||||
// complicated build scripts, this could be a generated file.
|
||||
.root_source_file = b.path("src/root.zig"),
|
||||
@@ -37,7 +39,7 @@ pub fn build(b: *std.Build) void {
|
||||
b.installArtifact(lib);
|
||||
|
||||
const exe = b.addExecutable(.{
|
||||
.name = "zig-totp",
|
||||
.name = exe_name,
|
||||
.root_source_file = b.path("src/main.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
|
||||
Reference in New Issue
Block a user