Skip to content

I don't see the reason to pass three separate paths for macOS. #44

Description

@mcourteaux

The SDK has one root location, so why not just pass that, instead of passing three paths.

My usage code now looks like this:

    var sdl_opts: struct {
        target: @TypeOf(target),
        optimize: @TypeOf(optimize),
        system_include_path: ?std.Build.LazyPath = null,
        system_framework_path: ?std.Build.LazyPath = null,
        library_path: ?std.Build.LazyPath = null,
    } = .{
        .target = target,
        .optimize = optimize,
    };
    if (target.result.os.tag.isDarwin()) {
        if (b.sysroot) |sysroot| {
            sdl_opts.system_include_path = std.Build.LazyPath{ .cwd_relative = b.pathJoin(&.{ sysroot, "/usr/include" }) };
            sdl_opts.system_framework_path = std.Build.LazyPath{ .cwd_relative = b.pathJoin(&.{ sysroot, "/System/Library/Frameworks" }) };
            sdl_opts.library_path = std.Build.LazyPath{ .cwd_relative = b.pathJoin(&.{ sysroot, "/usr/lib" }) };
        } else @panic(" Pass --sysroot <path/to/macOS/SDK>");
    }
    const sdl_dep = b.dependency("sdl", sdl_opts);

I think the SDL build.zig file could construct the relative paths if needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions