floooh/sokol-samples is a open-source project on GitHub, written primarily in C. It has 810 stars. Sample code for https://github.com/floooh/sokol
Snapshot summary built from the project's own GitHub metadata — there's no written TopGit review yet. The page will update automatically when a full review is published.
WHY NO REVIEW YET
TopGit writes full reviews for the most-starred, most-requested repositories. This page is a snapshot until then — see the READ ME tab for the original README in full.
your system's default C/C++ toolchain (MSVC, GCC or Clang)
optional but recommended: ninja
[!NOTE]
On Linux you'll also need to install packages for OpenGL, X11, PulseAudio and Vulkan development, e.g.
libgl1-mesa-dev, libegl1-mesa-dev, mesa-common-dev, xorg-dev, libpulse-dev, libvulkan-dev, vulkan-validationlayers,
vulkan-tools
[!NOTE]
On Windows with Vulkan development you need to install the Vulkan SDK and before building,
make sure that the environement variable VULKAN_SDK is valid
[!NOTE]
On Windows run the build in a 'Visual Studio Command Prompt' terminal window.
Build and running samples
To build the samples in the host platform's default release-mode configuration:
git clone https://github.com/floooh/sokol-samples
cd sokol-samples
./fibs build
...then list all executable samples:
./fibs list targets --exe
...and run any of the samples, e.g.:
./fibs run triangle-sapp-ui
Alternatively configure for a specific build configuration:
./fibs config [build-config-name]
To see a list of all build configs:
./fibs list configs
To search for specific build configs, use grep or rg (ripgrep):
./fibs list configs | grep d3d11
./fibs list configs | rg macos
To open a project in an IDE, first configure with a build config
which has -vstudio-, -vscode- or -xcode- in the name, and
then run ./fibs open, e.g.:
./fibs config sapp-metal-macos-vscode-debug
./fibs open
...for additional documentation on the fibs meta-build-system see:
https://github.com/floooh/fibs
Cross-compile to Emscripten, iOS or Android
Emscripten
First install the Emscripten SDK (this will take a while):
./fibs emsdk install
Then pick one of the build configs with -emsc- in the name, build and run:
./fibs config sapp-gles-emsc-ninja-debug
./fibs build
./fibs run triangle-sapp
...this should open the system default web browser, running the selected sample.
iOS
Pick an iOS build config and open in Xcode:
./fibs config sapp-metal-ios-xcode-debug
./fibs open
...then build and run in the iOS simulator or iOS device.
To build and run on a real device you may need to provide an iOS Team Id, do
this via:
./fibs set iosteamid [your-team-id]
./fibs config sapp-metal-ios-xcode-debug
Android
Install a JDK version 17, and check via ./fibs diag tools whether
fibs can find java, javac and unzip:
./fibs diag tools
...
java: found
unzip: found
cwebp: found
...next install the Android SDK/NDK via:
./fibs android install
...then pick one of the Android build configs and build:
...next 'link' the cloned directory to the sokol import:
./fibs link sokol ../sokol
linked import 'sokol' to '/Users/floh/projects/sokol'
...verify via ./fibs list imports:
./fibs list imports
...
sokol: link => /Users/floh/projects/sokol
...
The sokol-samples project will now use the linked sokol repository instead
of the local imported version in the .fibs/imports subdirectory.
How to build without a build system
Many samples are simple enough to be built directly on the command line
without a build system, and the following examples of that might
be helpful for integrating the sokol headers and/or the sokol sample code
into your own project with the build system of your choice.
The expected directory structure for building the sokol-samples manually
is as follows (e.g. those directories must be cloned side-by-side):
Of course, in your own project you can put the sokol headers wherever
you want (I recommend copying them somewhere into your source directory),
and you don't have to use the prebuilt sokol-shdc shader compiler either.
[!NOTE]
For Release builds, you might want to add the compiler's respective
optimization flags, and provide an NDEBUG define so that assert() checks
and the sokol-gfx validation layer are removed (BUT please don't do
this for the Debug/Dev builds because asserts() and the validation
layer give important feedback if something goes wrong).
Building manually on macOS with clang
To build one of the Metal samples:
> cd sokol-samples/metal
> cc cube-metal.c osxentry.m sokol_gfx.m -o cube-metal -fobjc-arc -I../../sokol -framework Metal -framework AppKit -framework QuartzCore
To build one of the GLFW samples (requires a system-wide glfw install, e.g. brew install glfw):
> cd sokol-samples/glfw
> cc cube-glfw.c flextgl/flextGL.c -o cube-glfw -I../../sokol -lglfw -framework OpenGL -framework AppKit
To build one of the sokol-app samples for Metal:
> cd sokol-samples/sapp
> ../../sokol-tools-bin/bin/osx/sokol-shdc -i cube-sapp.glsl -o cube-sapp.glsl.h -l metal_macos
> cc cube-sapp.c ../libs/sokol/sokol.m -o cube-sapp -DSOKOL_METAL -fobjc-arc -I../../sokol -I ../libs -framework Metal -framework AppKit -framework QuartzCore -framework AudioToolbox
To build one of the sokol-app samples for GL on macOS:
Building manually on Windows with MSYS2/mingw gcc:
[!NOTE]
Compile with '-mwin32' (this defines _WIN32 for proper platform detection)
From the MSYS2 shell:
> cd sokol-samples/sapp
# compile shaders for HLSL and GLSL:
> ../../sokol-tools-bin/bin/win32/sokol-shdc -i cube-sapp.glsl -o cube-sapp.glsl.h -l hlsl5:glsl430
# build and run with D3D11 backend:
> gcc cube-sapp.c ../libs/sokol/sokol.c -o cube-sapp-d3d11 -mwin32 -O2 -DSOKOL_D3D11 -I../../sokol -I ../libs -lkernel32 -luser32 -lshell32 -ldxgi -ld3d11 -lole32 -lgdi32
> ./cube-sapp-d3d11
# build and run with GL backend:
> gcc cube-sapp.c ../libs/sokol/sokol.c -o cube-sapp-gl -mwin32 -O2 -DSOKOL_GLCORE -I../../sokol -I ../libs -lkernel32 -luser32 -lshell32 -lgdi32 -lole32
> ./cube-sapp-gl
Building manually on Windows with Clang:
[!NOTE]
AFAIK Clang for Windows needs a working MSVC toolchain and Windows SDK installed, I haven't tested without.
Clang recognizes the #pragma comment(lib,...) statements in the Sokol headers, so you don't
need to specify the link libraries manually.
> cd sokol-samples/sapp
# compile shaders for HLSL and GLSL:
> ..\..\sokol-tools-bin\bin\win32\sokol-shdc -i cube-sapp.glsl -o cube-sapp.glsl.h -l hlsl5:glsl430
# build and run with D3D11 backend:
> clang cube-sapp.c ../libs/sokol/sokol.c -o cube-sapp-d3d11.exe -O2 -DSOKOL_D3D11 -I ../../sokol -I ../libs
> cube-sapp-d3d11
# build and run with GL backend:
> clang cube-sapp.c ../libs/sokol/sokol.c -o cube-sapp-gl.exe -O2 -DSOKOL_GLCORE -I ../../sokol -I ../libs
> cube-sapp-gl
Building manually on Linux with gcc
On Linux you need the "usual" development-packages for OpenGL development, and
for the GLFW samples, also the GLFW development package (on Ubuntu it's called
libglfw3-dev).
To build one of the GLFW samples on Linux:
> cd sokol-samples/glfw
> cc cube-glfw.c glfw_glue.c flextgl/flextGL.c -o cube-glfw -I../../sokol -lGL -ldl -lm -lglfw3
TopGit's last sync did not record any GitHub topics for floooh/sokol-samples. GitHub topics appear in the right sidebar of a repository page; that's the authoritative place to check.
How active is development on floooh/sokol-samples?
The most recent commit recorded on floooh/sokol-samples was 13 days ago, based on the GitHub push timestamp. The repository has 91 forks — one of the better signals of community interest.
How many stars does floooh/sokol-samples have?
floooh/sokol-samples has 810 GitHub stars — refresh the page for the live number, or check github.com/floooh/sokol-samples. TopGit mirrors GitHub's count but does not claim minute-by-minute accuracy.
What is floooh/sokol-samples?
floooh/sokol-samples (floooh/sokol-samples) is a C project on GitHub. From the project's own README: Sample code for https://github.com/floooh/sokol
What language is floooh/sokol-samples written in?
floooh/sokol-samples is written primarily in C. GitHub's language field is based on the largest share of bytes in the default branch.
Read full README in the tab above.
Is sokol-samples worth your time?
ChatGPT, Claude and Perplexity can all read this page. Ask one of them what it makes of sokol-samples.