One file and building
The single header
goome.h in the root of c-goome is the whole library, API on top and the implementation behind #ifdef GOOME_IMPLEMENTATION. In exactly one .c file:
#define GOOME_IMPLEMENTATION
#include "goome.h"
and a plain #include "goome.h" everywhere else. Two files with GOOME_IMPLEMENTATION = duplicate symbols.
Set these before the implementation include:
| Define | What |
|---|---|
GOOME_NO_DRAW |
no drawing layer, images, fonts or UI kit. You still get the overlay, events, hotkeys and capture |
GOOME_NO_UI |
everything but the UI kit |
Compile it as C99 or newer. From C++ include the header normally, the implementation file just has to be a .c.
What it needs
Nothing to link, not even libm. Linux dlopens libwayland-client, libX11, xkbcommon, gio and gstreamer when needed. Windows loads gdi32, shcore and the rest with LoadLibrary. Mac dlopens the frameworks and goes through the objc runtime, no .m file and no -framework flags.
CI tests gcc, clang, mingw and MSVC.
With CMake
c-goome next to your code (a git submodule is fine):
cmake_minimum_required(VERSION 3.16)
project(myapp C)
set(CMAKE_C_STANDARD 99)
set(GOOME_EXAMPLES OFF)
set(GOOME_TESTS OFF)
add_subdirectory(c-goome)
add_executable(myapp main.c)
target_link_libraries(myapp PRIVATE goome)
GOOME_EXAMPLES and GOOME_TESTS default to on. GOOME_NO_DRAW is the third option.
Building goome itself
./build.sh # lib, examples and tests into build/
./build.sh test # same, then runs the unit tests
./build.sh win # windows exes with mingw into build-win/
./build.sh single # just remakes goome.h
WERROR=1 makes warnings errors, CI always sets it. Theres also a CMake project with presets (for Visual Studio, Rider, CLion and VS Code) and ctest runs the unit tests.
Dont edit the root goome.h. tools/single.py makes it from include/ and src/, and build.sh runs that every time.
The bindings
- csharp-goome:
./build.shputslibgoome.so/libgoome.dylibinruntimes/<rid>/native/,./build.sh winmakesgoome.dllwith mingw,dotnet pack src/GoomeSharpmakes the nupkg. - java-goome:
./build.shputslibgoome.soinbuild/natives/<os>/,./gradlew :goome:jarpacks it intogoome/build/libs/goome-<version>.jarwith whatever natives are there. Gradle needs a JDK 25, the jar runs on 17+. - godot-goome:
./build.shbuilds the addon lib intoaddons/goome/bin/,./build.sh winthe dll with mingw. - Python:
pip installbuilds the lib with your C compiler. In a clone./build.sh testbuildsgoome/_native/libgoome.soand runs the tests. - rust-goome:
cargo build,goome-syscompiles goome.h with thecccrate.cargo testruns the tests. - node-goome:
npm installandnpm run build, node-gyp compiles goome.h intogoome.node.npm testruns the tests. - go-goome: nothing to build first, cgo compiles goome.h.
go test ./...runs the tests. - zig-goome:
zig build test, andzig build examplesbuilds the examples. - lua-goome:
LUA_INC=/usr/include/lua5.4 ./build.sh testbuildsgoome.soand runs the tests,LUA=luajitwith the luajit headers for LuaJIT.