meson-gba - Modern GBA Development with Meson

May 17, 2024 · View on GitHub

This project provides Meson build files for various Game Boy Advance libraries and tools.

Development Notice

This project is still fairly experimental. Things are still messy, but are continuously being updated and improved. Things might break unexpectedly, and things are developed with the latest versions of Meson and GCC/devkitARM in mind, so make sure your tools are as up-to-date as can be.

Projects made with meson-gba

What's Included

Libraries and tools can be accessed using the dependency and find_program functions.

ProjectVersionDependenciesPrograms
agbabi2.1.7agbabi
butano 1 217.3.0butano
gba-hppr180.e313a94gba-hpp
gba-link-connection6.2.3gba-link-connection
gbfs2002-02-07gbfsgbfs, insgbfs, lsgbfs, ungbfs
gbt-player4.4.1gbt-playermod2gbt, s3m2gbt, s3msplit
grit0.9.2grit
libfat 11.1.5.r2.g69543f0libfat
libgbar136.0d46fc9libgba
libsavgba3.3.2libtonc
libseven0.22.3libseven
libtoncr15.cc862celibtonc
libugba/libsysgba0.3.0libugba, libsysgba
libutilr1.743f5d1libutil
maxmod1.0.15maxmod
minrt0.12.0minrt, minrt-multibootmakerom, gbafix-py, bin2s-py
mmutil1.10.1mmutil
posprintfsdk-seven forkposprintf
superfamiconv0.9.2.r16.ga5027f3superfamiconv

Installation and Usage

As all the libraries and tools are compiled from source, the only things you need to have installed and in your PATH are:

  • meson (at least version 1.1.0 or later)
  • git
  • A compiler for your system (cl.exe, gcc, etc.)
  • A compiler for the GBA (arm-none-eabi-gcc)

See the meson gba book for more information.

Using devkitPro

If you want to use devkitPro (for example, if you want to use libfat), use the following command to generate a suitable cross file:

Windows, using Powershell (not recommended):

$f = gc meson/gba.ini; $f[1] = "path = '$Env:DEVKITARM/bin'"; sc dkarm.ini $f

Windows, using MSYS2:

sed "2cpath = '$(cygpath -m $DEVKITARM/bin)'" meson/gba.ini > dkarm.ini

Windows, using WSL / Linux / MacOS:

sed "2cpath = '$DEVKITARM/bin'" meson/gba.ini > dkarm.ini

Then run

meson setup --cross-file=dkarm.ini build

for the setup step.

To build, run:

ninja -C build

The built ROMs (.elf, .gba) will be in the build directory.

Check out the examples branch for some example projects.

Compiler Support

This toolchain works both with devkitARM, and "standard" arm-none-eabi-gcc distributions. When reporting problems, please specify which compiler you're using, and what version (output of arm-none-eabi-gcc --version), as well as the output of meson setup.

If you wish to detect the devkitARM compiler specifically:

cc = meson.get_compiler('c')

cc_ver = run_command(cc, '--version', capture: true, check: false)

have_devkitarm = cc_ver.stdout().to_lower().contains('devkitarm')

See the Meson compiler API for other things you can test for.

License

meson-gba is licensed under the zlib license. See LICENSE.txt for more information.

See the homepages of the bundled projects for their respective licensing.

Footnotes

  1. Only available with the devkitARM toolchain. 2

  2. Pulls in code from agbabi, gbt-player, libtonc, libugba, maxmod, posprintf and vgm-player. You may get linking errors if you try to combine those dependencies with butano. Use a partial dependency to access includes and build flags.