https://github.com/dpasca/dpasca-sdl2-template
Simple template to build SDL2 demos on Windows, Linux and Mac
https://github.com/dpasca/dpasca-sdl2-template
3d ai neural-network opengl sdl2 template-project
Last synced: about 12 hours ago
JSON representation
Simple template to build SDL2 demos on Windows, Linux and Mac
- Host: GitHub
- URL: https://github.com/dpasca/dpasca-sdl2-template
- Owner: dpasca
- Created: 2022-05-03T17:05:23.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2024-11-26T01:52:10.000Z (over 1 year ago)
- Last Synced: 2024-11-26T02:32:34.950Z (over 1 year ago)
- Topics: 3d, ai, neural-network, opengl, sdl2, template-project
- Language: C++
- Homepage:
- Size: 961 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Demos
| | |
|---|---|
| **Demo1**: A moving red rectangle  | **Demo2**: A 3D starfield (no *glm* for 3D)  |
| **Demo3**: A wire-frame cube made of particles  | **Demo4**: A cube made with random particles  |
| **Demo5**: A 2D rotating quad  | **Demo6**: A simple voxel scene  |
| **Demo7**: A voxelized fractal terrain  | **Demo8**: Rudimentary texture sampling  |
| **Demo9**: Simple self-driving using neural-networks  | |
## Required Tools
- [CMake](https://cmake.org/download/) 3.21 or newer
- A C++20 compiler
- Git, used by CMake to fetch pinned third-party dependencies
- Windows: Visual Studio 2022 or newer
- macOS: Xcode command line tools or Xcode
- Linux: gcc/clang and standard OpenGL development packages
## Quick Start
Dependencies are fetched by CMake and built statically by default. There is no
separate externals step.
### Linux/macOS
```bash
./build.sh
```
For Debug:
```bash
./build.sh Debug
```
### Windows
```bat
build.bat
```
For Debug:
```bat
build.bat Debug
```
Executables are written under `_bin`.
## CMake Presets
You can also build without the wrapper scripts:
```bash
cmake --preset release
cmake --build --preset release
```
Useful presets:
- `release`
- `debug`
- `xcode`
- `vs2022`
## Static Dependencies
The default build uses pinned vendored revisions of SDL2, glm, and Dear ImGui,
and builds third-party libraries statically:
```bash
cmake -S . -B _build/Release -DCMAKE_BUILD_TYPE=Release
```
System packages are opt-in:
```bash
cmake -S . -B _build/system -DDPASCA_USE_SYSTEM_DEPS=ON
```
For distribution builds, keep `DPASCA_USE_SYSTEM_DEPS` disabled. macOS and Linux
will still link to platform system libraries/frameworks such as OpenGL, Cocoa,
pthread, or libc, but SDL2/ImGui/glm are not pulled from Homebrew, apt, or other
machine-local package managers by default.
## IDE Projects
### Xcode
```bash
cmake --preset xcode
cmake --build --preset xcode-release
```
The Xcode project is generated under `_build/xcode`.
### Visual Studio
```bat
cmake --preset vs2022
cmake --build --preset vs2022-release
```
The Visual Studio solution is generated under `_build\vs2022`.