Skip to content

k0pernicus/sokol_starter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

60 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sokol Starter

A cross-platform application with Sokol + Dear ImGui, for Windows, Linux and macOS in C & C++.
Forked from the official starter project.

Build:

> mkdir build
> cd build

> cmake ..
> cmake --build .

To build a Release version on Linux and Mac:

> cmake -DCMAKE_BUILD_TYPE=MinSizeRel ..
> cmake --build .

To build a Release version on Windows with the VisualStudio toolchain:

> cmake ..
> cmake --build . --config MinSizeRel

To build in w64devkit console

> cmake -G "MinGW Makefiles" -DCMAKE_MAKE_PROGRAM=make ..
> cmake --build .

NOTE: on Linux you'll also need to install the 'usual' dev-packages needed for X11+GL development.

Run:

On Linux and macOS:

> ./app

On Windows with the Visual Studio toolchain the exe is in a subdirectory:

> Debug\app.exe
> MinSizeRel\app.exe

Build and Run WASM/HTML version via Emscripten (Linux, macOS)

Setup the emscripten SDK as described here:

https://emscripten.org/docs/getting_started/downloads.html#installation-instructions

Don't forget to run source ./emsdk_env.sh after activating the SDK.

And then in the code directory:

mkdir build
cd build
emcmake cmake -DCMAKE_BUILD_TYPE=MinSizeRel ..
cmake --build .

To run the compilation result in the system web browser:

> emrun app.html

IDE Support

Visual Studio (Windows)

On Windows, cmake will automatically create a Visual Studio solution file in the build directory, which can be opened (inside the build directory) with:

> cmake --open .

Xcode (macOS)

Replace cmake .. with cmake -GXcode .. and open the generated Xcode project:

> cmake -GXcode ..
> cmake --open .

Visual Studio Code (Windows, Linux, macOS)

Use the MS C/C++ extension together with the MS CMake Tools extension and start Visual Studio code from the project's root directory. The CMake extension will detect the CMakeLists.txt file and take over from there.

Notes:

The repository contains snapshots of the following libraries:

C bindings were generated via dear_bindings and are located in floooh/dcimgui

I'm not planning to do frequent updates to newer versions of those files, so the versions contained in here may be behind. Updating your own copies is trivial though, just copy the new files from the original repositories over the files contained here.

I tried to keep the CMake file as simple as possible (unfortunately it's not quite as simple as I had liked, because of some cross-platform differences).

All the important code is in app.cpp.

Enjoy!

About

A starter project for Sokol

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors