Simple C++ Docker Builder for raylib

Simple C/C++ Builder with compilers, buildtools, dependency manager and raylib
Features
What's included
Based on simple-cppbuilder
- Compilers: clang, gcc or cross-compiler
- Buildtools: cmake, make and ninja
- Dependency Manager: conan and/or vcpkg
- More Tools: python, pip, ccache, cppcheck, doxygen and more
- Libraries: raylib
How to use this image
You can find a basic core project example here.
Create a Dockerfile in your C/C++ raylib project
FROM abeimler/simple-cppbuilder-raylib as build
COPY . .
CMD ["./docker-build.sh"]
You can then build and run the Docker image:
$ docker build -t my-raylib-project .
$ docker run -it --rm --name my-raylib my-cppraylib-project
Run a single file
$ docker run -it --rm --name my-raylib-project -v "$PWD":/home/project -w /home/project abeimler/simple-cppbuilder-raylib ./docker-build.sh
Image Variants
:latest
Default image with gcc, buildtools and raylib (Platform: Desktop).
More infos here
:x64-mingw-w64, x86-mingw-w64
Default image with mingw-w64-cross-compiler and raylib (Platform: Desktop).
More infos here
Cross-Compiler (experimental)
Not fully tested
:web
Default image with emscripten and raylib (Platform: Web).
More infos here
:rpi4, :rpi3, :rpi2
Default image with arm-cross-compiler and raylib (Platform: DRM, Raspberry Pi).
More infos here
:rpi4-desktop
Default image with arm-cross-compiler and raylib (Platform: Desktop and OPENGL_VERSION=2.1).
More infos here
:arm-android, :arm64-android, :x86-android, :x64-android
Default image with android-ndk and raylib (Platform: Android).
More infos here
Environment Variables
CC
C Compiler, default: gcc.
Can also be clang.
CXX
C++ Compiler, default: g++.
Can also be clang++.
CMAKE_GENERATOR
CMake Generator cmake -G, default: Ninja.
Can also be Unix Makefiles.
CMAKE_BUILD_TYPE
CMake BuildType -DCMAKE_BUILD_TYPE, default: Release.
Can also be Debug, RelWithDebInfo or MinSizeRel.
TARGET
target run by cmake cmake --target, default: all.
CMAKE_TOOLCHAIN_FILE
CMake Toolchain File -DCMAKE_TOOLCHAIN_FILE.
RAYLIB_ADDITIONAL_CMAKE_ARGS
Custom CMake Arguments for raylib, e.g. -DUSE_AUDIO:BOOL=OFF or -DSUPPORT_GESTURES_SYSTEM:BOOL=OFF -DSUPPORT_MOUSE_GESTURES:BOOL=OFF (see CMake Build Options).
CMAKE_ARGS, ADDITIONAL_CMAKE_ARGS
Custom CMake Arguments, e.g. -DENABLE_COVERAGE:BOOL=ON.
Troubleshooting
For raylib troubleshooting, please check the raylib wiki
Android (Cross compiling)
android_native_app_glue.h: No such file or directory
add the <ANDROID_NDK_HOME>/sources/android/native_app_glue-path into your include_directories.
use env. variable NATIVE_APP_GLUE_PATH
if (${PLATFORM} MATCHES "Android")
include_directories($ENV{NATIVE_APP_GLUE_PATH})
endif()
Raspberry Pi (Cross compiling)
GLES2/gl2.h, bcm_host.h and other Raspberry Pi includes/libraries are missing
add the /opt/vc/include-path into your include_directories.
if (PLATFORM STREQUAL "Raspberry Pi")
include_directories(BEFORE SYSTEM /opt/vc/include /opt/vc/include/interface/vmcs_host/linux /opt/vc/include/interface/vcos/pthreads $ENV{ARCHLINUX_ARM_INCLUDES_DIR} $ENV{ARCHLINUX_ARM_LOCAL_INCLUDES_DIR})
link_directories(BEFORE /opt/vc/lib $ENV{ARCHLINUX_ARM_LIBRARIES_DIR} $ENV{ARCHLINUX_ARM_LOCAL_LIBRARIES_DIR})
endif()
drm.h, gbm.h and native system includes/libraries are missing
add the Arch Linux ARM include- and library-directories.
use env. variables ARCHLINUX_ARM_<LOCAL>_<INCLUDES/LIBRARIES>_DIR
if (PLATFORM STREQUAL "DRM")
include_directories(BEFORE SYSTEM $ENV{ARCHLINUX_ARM_INCLUDES_DIR} $ENV{ARCHLINUX_ARM_LOCAL_INCLUDES_DIR} $ENV{ARCHLINUX_ARM_LIBDRM_INCLUDES_DIR})
link_directories(BEFORE $ENV{ARCHLINUX_ARM_LIBRARIES_DIR} $ENV{ARCHLINUX_ARM_LOCAL_LIBRARIES_DIR})
endif()
More Examples
Using vcpkg
Set the Envirement-Variable CMAKE_TOOLCHAIN_FILE to /home/project/vcpkg/scripts/buildsystems/vcpkg.cmake and add -DVCPKG_CHAINLOAD_TOOLCHAIN_FILE="${VCPKG_CHAINLOAD_TOOLCHAIN_FILE}" (for cross-compiling) in ADDITIONAL_CMAKE_ARGS.
FROM abeimler/simple-cppbuilder-raylib as build
ENV CMAKE_TOOLCHAIN_FILE "/home/project/vcpkg/scripts/buildsystems/vcpkg.cmake"
ENV ADDITIONAL_CMAKE_ARGS -DVCPKG_CHAINLOAD_TOOLCHAIN_FILE="${VCPKG_CHAINLOAD_TOOLCHAIN_FILE}"
COPY . .
CMD ["./docker-build.sh"]
License
View license information for this image.
As with all Docker images, these likely also contain other software which may be under other licenses (such as Bash, etc from the base distribution, along with any direct or indirect dependencies of the primary software being contained).
As for any pre-built image usage, it is the image user's responsibility to ensure that any use of this image complies with any relevant licenses for all software contained within.
Links