Added scaling and ready to start with sdl_image
This commit is contained in:
@@ -12,19 +12,32 @@ pub fn build(b: *Build) void {
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
if (target.query.isNativeOs() and target.result.os.tag == .linux) {
|
||||
// The SDL package doesn't work for Linux yet, so we rely on system
|
||||
// packages for now.
|
||||
exe.linkSystemLibrary("SDL2");
|
||||
exe.linkLibC();
|
||||
} else {
|
||||
const sdl_dep = b.dependency("sdl", .{
|
||||
.optimize = .ReleaseFast,
|
||||
.target = target,
|
||||
});
|
||||
exe.linkLibrary(sdl_dep.artifact("SDL2"));
|
||||
}
|
||||
|
||||
// Keeping this here just in case, but dynamic linking is working AFAICT
|
||||
// if (target.query.isNativeOs() and target.result.os.tag == .linux) {
|
||||
// // The SDL package doesn't work for Linux yet, so we rely on system
|
||||
// // packages for now.
|
||||
// exe.linkSystemLibrary("SDL2");
|
||||
// exe.linkSystemLibrary("SDL2_ttf");
|
||||
// exe.linkSystemLibrary("SDL2_image");
|
||||
// } else {
|
||||
const sdl_dep = b.dependency("SDL", .{
|
||||
.optimize = .ReleaseFast,
|
||||
.target = target,
|
||||
});
|
||||
const sdl_lib = sdl_dep.artifact("SDL2");
|
||||
exe.root_module.addIncludePath(sdl_lib.getEmittedIncludeTree().path(b, "SDL2"));
|
||||
exe.linkLibrary(sdl_lib);
|
||||
const sdl_ttf_dep = b.dependency("SDL_ttf", .{
|
||||
.optimize = .ReleaseFast,
|
||||
.target = target,
|
||||
});
|
||||
exe.linkLibrary(sdl_ttf_dep.artifact("SDL2_ttf"));
|
||||
const sdl_image_dep = b.dependency("SDL_image", .{
|
||||
.optimize = .ReleaseFast,
|
||||
.target = target,
|
||||
});
|
||||
exe.linkLibrary(sdl_image_dep.artifact("SDL2_image"));
|
||||
// }
|
||||
b.installArtifact(exe);
|
||||
|
||||
// Create Check step for zls
|
||||
@@ -34,18 +47,9 @@ pub fn build(b: *Build) void {
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
if (target.query.isNativeOs() and target.result.os.tag == .linux) {
|
||||
// The SDL package doesn't work for Linux yet, so we rely on system
|
||||
// packages for now.
|
||||
exe_check.linkSystemLibrary("SDL2");
|
||||
exe_check.linkLibC();
|
||||
} else {
|
||||
const sdl_dep = b.dependency("sdl", .{
|
||||
.optimize = .ReleaseFast,
|
||||
.target = target,
|
||||
});
|
||||
exe_check.linkLibrary(sdl_dep.artifact("SDL2"));
|
||||
}
|
||||
exe_check.linkLibrary(sdl_dep.artifact("SDL2"));
|
||||
exe_check.linkLibrary(sdl_ttf_dep.artifact("SDL2_ttf"));
|
||||
exe_check.linkLibrary(sdl_image_dep.artifact("SDL2_image"));
|
||||
const check = b.step("check", "Check if project compiles, used by Zig Language Server");
|
||||
check.dependOn(&exe_check.step);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user