Pārlūkot izejas kodu

build.zig: run zig fmt

pull/4887/head
Jonathan Marler pirms 1 mēnesi
vecāks
revīzija
3d792f3363
1 mainītis faili ar 17 papildinājumiem un 20 dzēšanām
  1. +17
    -20
      build.zig

+ 17
- 20
build.zig Parādīt failu

@ -192,7 +192,6 @@ fn compileRaylib(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.
setDesktopPlatform(raylib, options.platform); setDesktopPlatform(raylib, options.platform);
}, },
.linux => { .linux => {
if (options.platform == .drm) { if (options.platform == .drm) {
if (options.opengl_version == .auto) { if (options.opengl_version == .auto) {
raylib.linkSystemLibrary("GLESv2"); raylib.linkSystemLibrary("GLESv2");
@ -209,34 +208,32 @@ fn compileRaylib(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.
} else if (target.result.abi == .android) { } else if (target.result.abi == .android) {
//these are the only tag options per https://developer.android.com/ndk/guides/other_build_systems //these are the only tag options per https://developer.android.com/ndk/guides/other_build_systems
const hostTuple = switch(builtin.target.os.tag) {
.linux => "linux-x86_64",
const hostTuple = switch (builtin.target.os.tag) {
.linux => "linux-x86_64",
.windows => "windows-x86_64", .windows => "windows-x86_64",
.macos => "darwin-x86_64",
else => {
@panic("unsupported host OS");
}
.macos => "darwin-x86_64",
else => @panic("unsupported host OS"),
}; };
const androidTriple = try target.result.linuxTriple(b.allocator); const androidTriple = try target.result.linuxTriple(b.allocator);
const androidNdkPathString: []const u8 = options.android_ndk; const androidNdkPathString: []const u8 = options.android_ndk;
if(androidNdkPathString.len < 1) @panic("no ndk path provided and ANDROID_NDK_HOME is not set");
if (androidNdkPathString.len < 1) @panic("no ndk path provided and ANDROID_NDK_HOME is not set");
const androidApiLevel: []const u8 = options.android_api_version; const androidApiLevel: []const u8 = options.android_api_version;
const androidSysroot = try std.fs.path.join(b.allocator, &.{androidNdkPathString, "/toolchains/llvm/prebuilt/", hostTuple, "/sysroot"});
const androidLibPath = try std.fs.path.join(b.allocator, &.{androidSysroot, "/usr/lib/", androidTriple});
const androidApiSpecificPath = try std.fs.path.join(b.allocator, &.{androidLibPath, androidApiLevel});
const androidIncludePath = try std.fs.path.join(b.allocator, &.{androidSysroot, "/usr/include"});
const androidArchIncludePath = try std.fs.path.join(b.allocator, &.{androidIncludePath, androidTriple});
const androidAsmPath = try std.fs.path.join(b.allocator, &.{androidIncludePath, "/asm-generic"});
const androidGluePath = try std.fs.path.join(b.allocator, &.{androidNdkPathString, "/sources/android/native_app_glue/"});
const androidSysroot = try std.fs.path.join(b.allocator, &.{ androidNdkPathString, "/toolchains/llvm/prebuilt/", hostTuple, "/sysroot" });
const androidLibPath = try std.fs.path.join(b.allocator, &.{ androidSysroot, "/usr/lib/", androidTriple });
const androidApiSpecificPath = try std.fs.path.join(b.allocator, &.{ androidLibPath, androidApiLevel });
const androidIncludePath = try std.fs.path.join(b.allocator, &.{ androidSysroot, "/usr/include" });
const androidArchIncludePath = try std.fs.path.join(b.allocator, &.{ androidIncludePath, androidTriple });
const androidAsmPath = try std.fs.path.join(b.allocator, &.{ androidIncludePath, "/asm-generic" });
const androidGluePath = try std.fs.path.join(b.allocator, &.{ androidNdkPathString, "/sources/android/native_app_glue/" });
raylib.addLibraryPath(.{ .cwd_relative = androidLibPath});
raylib.addLibraryPath(.{ .cwd_relative = androidLibPath });
raylib.root_module.addLibraryPath(.{ .cwd_relative = androidApiSpecificPath }); raylib.root_module.addLibraryPath(.{ .cwd_relative = androidApiSpecificPath });
raylib.addSystemIncludePath(.{ .cwd_relative = androidIncludePath }); raylib.addSystemIncludePath(.{ .cwd_relative = androidIncludePath });
raylib.addSystemIncludePath(.{ .cwd_relative = androidArchIncludePath});
raylib.addSystemIncludePath( .{ .cwd_relative = androidAsmPath});
raylib.addSystemIncludePath(.{ .cwd_relative = androidGluePath});
raylib.addSystemIncludePath(.{ .cwd_relative = androidArchIncludePath });
raylib.addSystemIncludePath(.{ .cwd_relative = androidAsmPath });
raylib.addSystemIncludePath(.{ .cwd_relative = androidGluePath });
var libcData = std.ArrayList(u8).init(b.allocator); var libcData = std.ArrayList(u8).init(b.allocator);
const writer = libcData.writer(); const writer = libcData.writer();
@ -442,7 +439,7 @@ pub const PlatformBackend = enum {
rgfw, rgfw,
sdl, sdl,
drm, drm,
android
android,
}; };
pub fn build(b: *std.Build) !void { pub fn build(b: *std.Build) !void {

Notiek ielāde…
Atcelt
Saglabāt