gfxbox2.git - Unnamed repository; edit this file 'description' to name the repository. (original) (raw)
Contents⊕
gfxbox2, a C++ Computer Graphics Sandbox
This project’s canonical repositories is hosted on Gothel Software.
Goals
This project provides a C++ sandbox for computer graphics for our computer science class.
Its examples demonstrate basic usage and physics simulations.
Supported Platforms
C++20 and better where the SDL2 library is supported.
Optional WebAssembly (Wasm) builds with SDL2 via emscripten.
Online WebAssembly Examples
- Educational / Science
- Our Games
- Game Classics / Homages
- Boilerplates / Tests
Building Binaries
Build Dependencies
- CMake 3.13+ but >= 3.18 is recommended
- C++20 compiler
- gcc >= 10
- clang >= 15
- SDL2 library
- emscripten >= 3.1.59 optional for WebAssembly (Wasm)
- Example funcdraw
- Parser generator
* bison >= 3.2 - Lexer generator
* flex
- Parser generator
- Optional for
lintvalidation- clang-tidy >= 15
- Optional for
vscodiumintegration- clangd >= 15
- clang-tools >= 15
- clang-format >= 15
Installing build dependencies on Debian (11 or better): ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.sh} apt install git apt install build-essential g++ gcc libc-dev libpthread-stubs0-dev apt install clang-15 clang-tidy-15 clangd-15 clang-tools-15 clang-format-15 apt install cmake cmake-extras extra-cmake-modules pkg-config apt install libsdl2-dev libsdl2-image-dev libsdl2-ttf-dev libsdl2-mixer-dev apt install bison flex apt install doxygen graphviz~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Perhaps change the clang version-suffix of above clang install line to the appropriate version.
After complete clang installation, you might want to setup the latest version as your default. For Debian you can use this clang alternatives setup script.
WebAssembly (via emscripten)
At time of writing (Debian 12), it is recommended to install emscripten >= 3.1.59 for WebAssembly (Wasm) from its upstream source.
At a later time (more recent Debian > 12 deployment) the Debian default may be functional: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.sh} apt install emscripten~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Build Procedure
The following is covered with a convenient build script.
For a generic build use: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.sh} CPU_COUNT=~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~getconf _NPROCESSORS_ONLN git clone –recurse-submodule git://jausoft.com/srv/scm/cs_class/gfxbox2.git cd gfxbox2 mkdir build cd build cmake .. make -j $CPU_COUNT install doc
Our cmake configure has a number of options, cmake-gui or_ccmake_ can show you all the options. The interesting ones are detailed below:
Changing install path from /usr/local to /usr ~~~~~~~~~~~~~ -DCMAKE_INSTALL_PREFIX=/usr ~~~~~~~~~~~~~
Building debug build: ~~~~~~~~~~~~~ -DDEBUG=ON ~~~~~~~~~~~~~
Building with clang and clang-tidy lint validation ~~~~~~~~~~~~~ -DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang++ -DCMAKE_CXX_CLANG_TIDY=/usr/bin/clang-tidy;-p;r o o t d i r/build_dir ~~~~~~~~~~~~~
To build documentation run: ~~~~~~~~~~~~~ make doc ~~~~~~~~~~~~~
WebAssembly (via emscripten)
IDE Integration
Eclipse
IDE integration configuration files are provided for
- Eclipse with extensions
- CDT or CDT @ eclipse.org
CMake Support, installC/C++ CMake Build Supportwith IDorg.eclipse.cdt.cmake.feature.group
You can import the project to your workspace viaFile . Import... andExisting Projects into Workspace menu item.
For Eclipse one might need to adjust some setting in the.project and .cproject (CDT) via Eclipse settings UI, but it should just work out of the box.
VSCodium or VS Code
IDE integration configuration files are provided for
For VSCodium one might copy the example root-workspace file to the parent folder of this project (note the filename change) and adjust the path to your filesystem. ~~~~~~~~~~~~~ cp .vscode/gfxbox2.code-workspace_example ../gfxbox2.code-workspace vi ../gfxbox2.code-workspace ~~~~~~~~~~~~~ Then you can open it via File . Open Workspace from File...menu item.
- All listed extensions are referenced in this workspace file to be installed via the IDE
- The local settings.json has
clang-tidyenabled- If using
clang-tidyis too slow, just remove it from the settings file. clangdwill still contain a good portion ofclang-tidychecks
- If using