dotfiles/mzte-nv/build.zig

48 lines
1.3 KiB
Zig
Raw Normal View History

2022-10-20 15:38:12 +02:00
const std = @import("std");
pub fn build(b: *std.build.Builder) !void {
2023-02-11 13:24:42 +01:00
const target = b.standardTargetOptions(.{});
2022-10-20 15:38:12 +02:00
2023-02-11 13:24:42 +01:00
if (target.os_tag orelse @import("builtin").os.tag == .windows)
// windows is an error in many ways
return error.Windows;
const mode = b.standardOptimizeOption(.{});
const lib = b.addSharedLibrary(.{
.name = "mzte-nv",
.root_source_file = .{ .path = "src/main.zig" },
.target = target,
.optimize = mode,
});
2022-10-20 15:38:12 +02:00
2023-04-23 18:07:38 +02:00
const znvim_dep = b.dependency("znvim", .{ .target = target, .optimize = mode });
lib.addModule("nvim", znvim_dep.module("nvim_c"));
lib.addModule("znvim", znvim_dep.module("znvim"));
2022-10-20 15:38:12 +02:00
lib.linkLibC();
lib.linkSystemLibrary("luajit");
lib.strip = mode != .Debug;
lib.unwind_tables = true;
2023-03-28 00:39:38 +02:00
b.getInstallStep().dependOn(&b.addInstallFile(lib.getOutputSource(), "share/nvim/mzte-nv.so").step);
2022-11-19 01:53:49 +01:00
// this is the install step for the lua config compiler binary
2023-02-11 13:24:42 +01:00
const compiler = b.addExecutable(.{
.name = "mzte-nv-compile",
.root_source_file = .{ .path = "src/compiler.zig" },
.target = target,
.optimize = mode,
});
2022-11-19 01:53:49 +01:00
compiler.linkLibC();
compiler.linkSystemLibrary("luajit");
2022-11-19 01:53:49 +01:00
compiler.strip = mode != .Debug;
compiler.unwind_tables = true;
2022-11-19 01:53:49 +01:00
2023-04-19 22:51:23 +02:00
b.installArtifact(lib);
2022-10-20 15:38:12 +02:00
}