An example cross-platform CMake-based project using SDL2 and OpenGL
C++ C Other
Switch branches/tags
Nothing to show
Clone or download
Permalink
Failed to load latest commit information.
gl2 Delete unused functions from GLFuncTable May 20, 2017
modules Initial commit May 11, 2017
.gitignore Initial commit May 11, 2017
CMakeLists.txt Initial commit May 11, 2017
LICENSE Initial commit May 11, 2017
Main.cpp Initial commit May 11, 2017
README.md Link back to blog post May 11, 2017
demo-config.h.in Initial commit May 11, 2017
setup-win32.py Initial commit May 11, 2017

README.md

An example cross-platform CMake-based project.

This project uses SDL2 and OpenGL to render a spinning 3D logo to a desktop window. You can build it on Windows, MacOS or Linux.

Requirements

Windows (Visual Studio)

CMakeDemo expects to find the SDL2 headers and libraries in a subfolder named extern\SDL-2.0.5. You can download and extract them automatically by running the Python 3 script setup-win32.py. If you don't have Python installed, download and extract them by hand.

On Windows, CMakeDemo uses its own OpenGL headers and loads opengl32.dll dynamically at runtime. Nothing else is needed at build time.

MacOS (Xcode)

Install the SDL2 headers and libraries using MacPorts.

sudo port install libsdl2

OpenGL headers and libraries are installed by Xcode. CMake will find them automatically.

Ubuntu

Install the SDL2 headers and libraries.

sudo apt install libsdl2-dev

OpenGL headers and libraries are already present on the system. CMake will find them automatically.

Build Instructions

For build instructions, see the blog post How to Build a CMake-Based Project.