goome

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 builds with gcc on Linux, Apple clang on macOS, and mingw and MSVC (cl) on Windows, always with warnings as errors. Plain clang on Linux isnt in the matrix.

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

Edit this page on GitHub