/meson-gba

Meson-based GBA toolchain

Primary LanguageMesonzlib LicenseZlib

meson-gba - Modern GBA Development with Meson

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

Development Notice

This project is still very much in alpha. 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.

What's Included

Versions are generally of the format [<tag>.]r<number of commits>.g<git commit hash>. Projects that don't use git are annotated with the latest file date present in the source archive.

Installation

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 0.60.0, ideally 1.0.0 or later)
  • git
  • A compiler for your system (cl.exe, gcc, etc.)
  • A compiler for the GBA (arm-none-eabi-gcc)

Compiling

Once you have everything, git clone or download this repository, then navigate to the directory in a terminal (or "command-line") window, and run the following commands:

meson subprojects download
meson setup --cross-file=meson/gba.ini build

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.

Windows

For development on Windows, the easiest method is to use MSYS2, either using the official installer, or the devkitPro installer.

Install everything needed like so:

pacman -S mingw-w64-ucrt-x86_64-meson git mingw-w64-ucrt-x86_64-gcc

And if using the non-devkitPro compiler (recommended!):

pacman -S mingw-w64-ucrt-x86_64-arm-none-eabi-toolchain

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

This project is licensed under the zlib license.
See LICENSE.txt for more information.