Code Monkey home page Code Monkey logo

cimgui-sokol-starterkit's Introduction

cimgui-sokol-starterkit

A minimal cross-platform starter-kit to write simple Dear ImGui tools for Windows, Linux and macOS in C.

WASM version (see below for build instructions)

Clone:

> git clone https://github.com/floooh/cimgui-sokol-starterkit
> cd cimgui-sokol-starterkit

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:

> ./demo

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

> Debug\demo.exe
> MinSizeRel\demo.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 cimgui-sokol-starterkit directory:

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

To run the compilation result in the system web browser:

> emrun demo.html

...which should look like this.

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:

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 demo.c.

Enjoy!

cimgui-sokol-starterkit's People

Contributors

floooh avatar imweijh avatar idbrii avatar rainbowbismuth avatar robaertschi avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.