Hello everyone,
I’m currently learning zig, zig build and drinking from two fire hoses at the same time.
I’m trying to build an existing C project that depends on SDL2 and SDL2_image and I’d like to use what’s already done in allyourcodebase.
SDL_image declares SDL as a dependency. So, I have two questions:
-
Since the C project I’m compiling depends on both SDL and SDL_image, is it better to declare both as dependencies in the C project, or to just rely on the transitive dependency of SDL_image on SDL
-
In general, is there a current idiom for controlling the compilation of transitive dependencies? For example, I want to compile SDL2 but with a change to default options:
const sdl_dep = b.dependency("sdl", .{ .render_driver_ogl_es = false });
but as far as I can see, if I do not wish it include SDL as a dependency directly I cannot control the options SDL_image uses when building SDL. Or, alternatively, is there a way to tell SDL_image: “Hey, I know you depend on SDL2 - used this one instead of the one you call out in your build.zig.zon, I’ll take care of fetching and compiling it”?