Skip to content

improve addLibraryFile API #85

@silbinarywolf

Description

@silbinarywolf

Description

I'm not sure I'm completely satisfied with the solution I settled on here: #84

Instead of this pattern:

const vulkan_validation_dep = b.lazyDependency("vulkan_validation", .{}) orelse return;
apk.addLibraryFile(.arm64_v8a, vulkan_validation_dep.path("arm64-v8a/libVkLayer_khronos_validation.so"));
apk.addLibraryFile(.armeabi_v7a, vulkan_validation_dep.path("armeabi-v7a/libVkLayer_khronos_validation.so"));
apk.addLibraryFile(.x86, vulkan_validation_dep.path("x86/libVkLayer_khronos_validation.so"));
apk.addLibraryFile(.x86_64, vulkan_validation_dep.path("x86_64/libVkLayer_khronos_validation.so"));

I think I'd prefer an exhaustive struct that allows a nullable field for each so that you need to provide a library for each target platform. For example:

apk.addLibraryFile(.{
    .arm64_v8a = vulkan_validation_dep.path("arm64-v8a/libVkLayer_khronos_validation.so"),
    .armeabi_v7a = vulkan_validation_dep.path("armeabi-v7a/libVkLayer_khronos_validation.so"),
    .x86 = vulkan_validation_dep.path("x86/libVkLayer_khronos_validation.so"),
    .x86_64 = vulkan_validation_dep.path("x86_64/libVkLayer_khronos_validation.so"),
});

An even more ideal solution would be something wherein we can use custom build steps to determine the platform arch for an *.so file and it just automatically puts them in the correct lib/{arch/ folder in the APK. But that seems overkill right now, especially while Zig not yet 1.0.0

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