Skip to content

lateleite/sdl3_mixer-on-zig

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SDL3_Mixer on Zig

This repository wraps the upstream SDL3_Mixer library source code with Zig's build system.

Zig 0.15.2 is required.

The build setup support the following audio decoders:

  • FLAC through dr_flac
  • GME's formats
  • MIDI through TiMidity
  • Module/tracker music through XMP
  • MP3 through dr_mp3
  • Opus
  • Vorbis

It also uses castholm's SDL3 port by default.

Installing as a build.zig.zon package

Run in your Zig project:

zig fetch --save-exact=sdl3_mixer git+https://github.com/lateleite/sdl3_mixer-on-zig.git

Then in your build.zig file:

pub fn build(b: *std.Build) !void {
    // ...

    // Add a reference to the package you've just fetched...
    const dep_mixer = b.dependency("sdl3_mixer", .{
        .target = target,
        .optimize = optimize,
        // force linking mode (default is static)
        // .@"link-mode" = .dynamic,
        // force enable or disable Position Independent Code (PIC) 
        // .pic = true,
        // you may choose to use your system's SDL3 library,
        // instead of building and statically linking another.
        //.@"use-system-sdl" = true,
        // you may also choose to use any other dependency from your system
        //.@"use-system-gme" = true,
        //.@"use-system-ogg" = true,
        //.@"use-system-opus" = true,
        //.@"use-system-opusfile" = true,
    });
    const lib_mixer = dep_mixer.artifact("SDL_mixer");

    // ...then link the library to your module
    your_module.linkLibrary(lib_mixer);

    // ...
}

After that, you may use SDL3_Mixer's header files in your module.

License

All (build) code here is released to public domain or under the BSD Zero Clause license, choose whichever you prefer.

You may find SDL3_Mixer's license at https://github.com/libsdl-org/SDL_mixer/blob/8c52ef985c3c6495fcb5cf7a118aa544388c2765/LICENSE.txt.

About

SDL3_Mixer library wrapped with Zig's build system

Topics

Resources

License

Stars

Watchers

Forks

Contributors

Languages