Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMakeLists #1573

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

CMakeLists #1573

wants to merge 2 commits into from

Conversation

dthompso99
Copy link

Adding a simple CMakeLists to allow easy inclusion via externalproject_add

@ocornut
Copy link
Owner

ocornut commented Jan 25, 2018

Sorry this is undesirable and especially not in the root folder. dear imgui especially doesn't need or suggest a specific build system and the mere presence of a cmakefile is bad news for many sorts of users.

Later down the road we will refactor the examples/ folder to take advantage or either premake/genie or cmake. But there is literally no benefit in libifying core imgui and it goes against incentivizing the user to edit imconfig.h.

@OvermindDL1
Copy link

OvermindDL1 commented Jan 25, 2018

Not proposing this PR should be added, I'm just adding some clarifications. :-)

But there is literally no benefit in libifying core imgui and it goes against incentivizing the user to edit imconfig.h.

Even with no build system setup I'd still never edit a file inside another library, EVER (I'd submit PR's, which are obviously not as useful for configurations). ^.^;

Normally I'd configure by either setting some #defines before including the files, or I'd expect to be able to pass options to the project build system so it could generate it's own 'config' file (built in feature to cmake and others).

For note, there is one very good nicety about adding a cmake file, it makes using imgui from within a cmake distribution manager (like hunter.sh) simple enough so end-users of imgui would only have to add something like:

# or `dear-imgui` or whatever you wanted the name to be
hunter_add_package(imgui <whatever build or library or whatever options here>)

Then it just gets used like normal, nothing different from including any other library:

find_package(imgui CONFIG REQUIRED) # Automatically include the right files to the current project
target_link_libraries(my-project imgui) # Link in the cpp object files

(A side-note, the process of adding hunter.sh itself to a cmake project, I.E. the end user, just involves grabbing the hunter-gate cmake file and putting it in their projects' cmake directory, and putting this at the top of their cmake file:

include("cmake/HunterGate.cmake")
HunterGate(
    URL "https://github.com/ruslo/hunter/archive/v0.19.234.tar.gz"
    SHA1 "3deec1041bd01c91e78269522b901fbab3a765e5"
)

And that's it.)

There are a few other cmake-based dependency managers (but I think hunter is the only one built entirely in cmake and thus requires absolutely nothing for someone to compile with or use, it 'just works').

For note, things like hunter can use projects without a cmake build system, it just involves having to build a cmake scaffold for it anyway, so this is not something that necessarily needs to be put in to this repo in any case (but not doing so means it can get out of sync pretty easily, but as it works based on specific commits that just means that users would get out-of-date versions instead of modern ones).

Also, for note, cmake is not so much a build system as it is a build system builder (it builds a build system for, well, about any known build system out, from make files using gcc or clang to the blazing fast ninja build system to the visual studio command line nmake or gui itself and far far more).

@ocornut
Copy link
Owner

ocornut commented Feb 11, 2018

FYI a started a Premake setup for the examples over in the premake branch:
https://github.com/ocornut/imgui/tree/premake

@ocornut
Copy link
Owner

ocornut commented Feb 26, 2018

Perhaps this is not the best place to discuss it, but I would be interested if someone can craft a cmake setup that would mimic this premake file from this branch:

https://github.com/ocornut/imgui/blob/premake/examples/premake5.lua

This is a setup to create the examples app.
It works with Visual Studio 2010 to 2017. The help at the top is purely fluff/redundancy but that's the sort of things that is useful for users.

I don't mind including both cmake and premake files if they are relatively simple.

@franciscod franciscod mentioned this pull request Apr 2, 2018
@ocornut ocornut force-pushed the master branch 2 times, most recently from 0c1e5bd to bb6a60b Compare August 27, 2021 19:10
@ocornut ocornut force-pushed the master branch 2 times, most recently from 8b83e0a to d735066 Compare December 13, 2021 11:31
@ocornut ocornut force-pushed the master branch 2 times, most recently from b3b85d8 to 0755767 Compare January 17, 2022 14:21
@ocornut ocornut force-pushed the master branch 3 times, most recently from c817acb to 8d39063 Compare February 15, 2022 16:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants