migrate libvirt back to other repo
This commit is contained in:
parent
739bcb016a
commit
43333bd6b2
15 changed files with 220 additions and 1651 deletions
|
@ -1,19 +1,10 @@
|
|||
const std = @import("std");
|
||||
const Build = std.Build;
|
||||
const Step = Build.Step;
|
||||
|
||||
pub fn build(b: *std.Build) !void {
|
||||
const target = b.standardTargetOptions(.{});
|
||||
const optimize = b.standardOptimizeOption(.{});
|
||||
|
||||
const translate_c = b.addTranslateC(.{
|
||||
.root_source_file = b.path("libvirt/include/libvirt/libvirt.h"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
translate_c.addIncludeDir("libvirt/include");
|
||||
|
||||
const output = b.addInstallFile(translate_c.getOutput(), "libvirt.zig");
|
||||
const libvirt = b.dependency("libvirt", .{});
|
||||
|
||||
const exe = b.addExecutable(.{
|
||||
.name = "server",
|
||||
|
@ -21,14 +12,7 @@ pub fn build(b: *std.Build) !void {
|
|||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
exe.step.dependOn(&output.step);
|
||||
exe.linkLibC();
|
||||
exe.root_module.addIncludePath(b.path("libvirt/include"));
|
||||
// exe.linkSystemLibrary("libvirt");
|
||||
exe.addLibraryPath(b.path("libvirt/lib"));
|
||||
exe.addObjectFile(b.path("libvirt/lib/libvirt.so.0.10000.0"));
|
||||
exe.addObjectFile(b.path("libvirt/lib/libvirt-admin.so.0.10000.0"));
|
||||
exe.addObjectFile(b.path("libvirt/lib/libvirt-qemu.so.0.10000.0"));
|
||||
exe.root_module.addImport("libvirt", libvirt.module("libvirt"));
|
||||
b.installArtifact(exe);
|
||||
|
||||
const run_cmd = b.addRunArtifact(exe);
|
||||
|
@ -39,36 +23,4 @@ pub fn build(b: *std.Build) !void {
|
|||
|
||||
const run_step = b.step("run", "Run the app");
|
||||
run_step.dependOn(&run_cmd.step);
|
||||
|
||||
const libvirt_test = b.addTest(.{
|
||||
.root_source_file = b.path("src/libvirt.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.link_libc = true,
|
||||
});
|
||||
const libvirt_connection_test = b.addTest(.{
|
||||
.root_source_file = b.path("src/libvirt-connection.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.link_libc = true,
|
||||
});
|
||||
const libvirt_unit_tests = [_]*Step.Compile{
|
||||
libvirt_test,
|
||||
libvirt_connection_test,
|
||||
};
|
||||
for (libvirt_unit_tests) |tests| {
|
||||
tests.root_module.addIncludePath(b.path("libvirt/include"));
|
||||
tests.addLibraryPath(b.path("libvirt/lib"));
|
||||
tests.addObjectFile(b.path("libvirt/lib/libvirt.so.0.10000.0"));
|
||||
tests.addObjectFile(b.path("libvirt/lib/libvirt-admin.so.0.10000.0"));
|
||||
tests.addObjectFile(b.path("libvirt/lib/libvirt-qemu.so.0.10000.0"));
|
||||
}
|
||||
|
||||
const run_libvirt_tests = [_]*Step.Run{
|
||||
b.addRunArtifact(libvirt_test),
|
||||
b.addRunArtifact(libvirt_connection_test),
|
||||
};
|
||||
|
||||
const test_step = b.step("test", "Run unit tests");
|
||||
for (run_libvirt_tests) |tests| test_step.dependOn(&tests.step);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue