Code Monkey home page Code Monkey logo

imgui-cmake-installer's Introduction

ImGui as a Library

CMake cross platform module for building Dear ImGui as a library.

Getting Started

git clone --recursive https://github.com/giladreich/ImGui-CMake-Installer
cd ImGui-CMake-Installer && mkdir build && cd build
cmake .. -DIMGUI_WITH_IMPL=OFF
cmake --build . --config Release --target install

By default it would build ImGui as a static library, but if you would like to build as a shared library(DLL), turn off IMGUI_STATIC_LIBRARY option when generating the project:

cmake .. -DIMGUI_WITH_IMPL=OFF -DIMGUI_STATIC_LIBRARY=OFF

There are few things you want to know when you build Dear ImGui:
ImGui comes with examples that already takes care of the way people should interact with the library, i.e imgui_impl_win32.cpp, imgui_impl_vulkan.cpp, imgui_impl_osx.mm imgui_impl_sdl.cpp etc...

Basically the author of the library didn't want it to be dependent on any kind of graphic API's, therefore he expects that you'll provide your own implementation for that part(even though they're already exists in the examples).

That being said, before you build the library, you want to have a look at CMakeOptions.cmake file to see which options are available.

If you want to include one of the examples in the library build, when you generate the cmake project, you'll want to pass which graphic API you want to include in your build. Example:

cmake .. -DIMGUI_IMPL_DX11=ON

That would basically copy and include in your library build the following files:
imgui_impl_win32.cpp imgui_impl_win32.h, imgui_impl_dx11.cpp, imgui_impl_dx11.h and the headers will also be copied under dist/include directory.

Prerequisites

If you run into any errors, please make sure you running with the correct environments(i.e Developer Command Prompt for VS 2017).

Another note that if you re-running cmake again with different options, make sure you remove CMakeCache.txt before you run cmake command again. Because the options would be cached in this file and won't refresh automatically.

Motivation

ImGui library designed to be copied into the project internally, I therefore wanted to externalize it so I can reference to it from multiple projects instead of copying ImGui to each project.

I also use Conan C++ Package Manager for building my projects and I wanted to have my own recipe for packaging ImGui with conan to make it more portable across different projects.

There is already existing project for conan-imgui, but unfortunately it only provides the library as is without the option to enable examples.

I therefore got the motivation to make this CMake module so I can manage my own conan-recipe.

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE.md file for details

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.