|
Banjo API 1.0.0-rc.2
Low-level C99 game development API
|
Add Banjo to your project via CMake, pkg-config, or hand-rolled compiler flags.
If you integrate Banjo through FetchContent or add_subdirectory, your build is going to compile Banjo as part of your project, so it needs the same system development headers Banjo itself needs (see Prerequisites).
If you integrate via find_package against a pre-installed Banjo, your build does not recompile Banjo; only Banjo's runtime requirements apply.
Quickest and easiest. CMake automatically downloads Banjo during configuration. Ideal for new projects, OSS development, and CI where dependencies should be reproducible.
Requires an internet connection during the first configuration.
Pin GIT_TAG to a release tag rather than a branch so your build is reproducible: main tracks unreleased development and can shift under you. Both stable tags (e.g. v1.0.0) and pre-release tags (e.g. v1.0.0-alpha.1) are valid; pick the newest that suits you from the Releases page.
Embeds Banjo directly into your project's source tree. Useful for tightly coupled projects or when you need fine-grained control over Banjo's build configuration.
You can control Banjo's configuration from your parent project:
When using add_subdirectory, link against the banjo target (not banjo::banjo).
Appropriate when Banjo has been installed system-wide or to a specific prefix. Recommended for production deployments and packaged distributions.
Install Banjo first:
Then in your project:
If Banjo was installed to a non-standard prefix, specify CMAKE_PREFIX_PATH:
What gets installed:
For non-CMake build systems, Banjo provides a pkg-config file (requires installation first).
If installed to a non-standard prefix:
If you prefer not to use a build system, link against Banjo manually (after building it via Building Banjo):
Banjo's optional Linux/Windows backends (X11, ALSA, MME) are loaded with dlopen / LoadLibrary at runtime: they have no link-time dependency, so you don't pass -lX11, -lasound, or -lwinmm. Backends that do need link-time symbols (Win32, Cocoa, CoreAudio, Emscripten) must be re-listed at your application's link line when using the static libbanjo.a.
A minimal test program:
If this compiles and links, your integration is configured correctly. For a functional example with window creation and rendering, see the Examples topic and the example file start.c.