Merge pull request #8 from foxnne/pkg
Added getPackage and fixed errors
This commit is contained in:
commit
dec796d256
@ -55,8 +55,16 @@ pub const LibType = enum(i32) {
|
|||||||
exe_compiled,
|
exe_compiled,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// rel_path is used to add package paths. It should be the the same path used to include this build file
|
pub fn getPackage(comptime prefix_path: []const u8) std.build.Pkg {
|
||||||
pub fn linkArtifact(b: *Builder, artifact: *std.build.LibExeObjStep, target: std.build.Target, lib_type: LibType, rel_path: []const u8) void {
|
return .{
|
||||||
|
.name = "ecs",
|
||||||
|
.path = prefix_path ++ "src/ecs.zig",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/// prefix_path is used to add package paths. It should be the the same path used to include this build file
|
||||||
|
pub fn linkArtifact(b: *Builder, artifact: *std.build.LibExeObjStep, target: std.build.Target, lib_type: LibType, comptime prefix_path: []const u8) void {
|
||||||
|
const buildMode = b.standardReleaseOptions();
|
||||||
switch (lib_type) {
|
switch (lib_type) {
|
||||||
.static => {
|
.static => {
|
||||||
const lib = b.addStaticLibrary("ecs", "ecs.zig");
|
const lib = b.addStaticLibrary("ecs", "ecs.zig");
|
||||||
@ -66,7 +74,7 @@ pub fn linkArtifact(b: *Builder, artifact: *std.build.LibExeObjStep, target: std
|
|||||||
artifact.linkLibrary(lib);
|
artifact.linkLibrary(lib);
|
||||||
},
|
},
|
||||||
.dynamic => {
|
.dynamic => {
|
||||||
const lib = b.addSharedLibrary("ecs", "ecs.zig", null);
|
const lib = b.addSharedLibrary("ecs", "ecs.zig", .unversioned);
|
||||||
lib.setBuildMode(buildMode);
|
lib.setBuildMode(buildMode);
|
||||||
lib.install();
|
lib.install();
|
||||||
|
|
||||||
@ -75,5 +83,5 @@ pub fn linkArtifact(b: *Builder, artifact: *std.build.LibExeObjStep, target: std
|
|||||||
else => {},
|
else => {},
|
||||||
}
|
}
|
||||||
|
|
||||||
artifact.addPackagePath("ecs", std.fs.path.join(b.allocator, &[_][]const u8{ rel_path, "ecs.zig" }) catch unreachable);
|
artifact.addPackage(getPackage(prefix_path));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user