Skip to content

Conversation

@pavanakumar
Copy link

Thanks for the fantastic library. I have

  • added a working example with CMakeList.txt that automatically download the sources and setup the targets
  • the example working on SDL2+OpenGL3 and template CMakeLists.txt is provided in readme.txt for other backends
  • fixed warnings on unused variable in src/imgui_bezier_math.inl
  • fixed warning on reordering of class member in include/ImNodeFlow.h
  • removed CMakeLists.txt from root folder

@Fattorino
Copy link
Owner

I'll be reviewing this in the following weeks as work at uni has me quite busy. Meanwhile thanks for the contribution

@AaronAppel
Copy link

Thanks pavanakumar for sharing your example. It would be nice if the documentation.md had a sort of "quick start" section or example.md to reference how to integrate a simple demo/starting point into an app's main loop. And thank you for the awesome node editor, Fattorino 👍

@Fattorino
Copy link
Owner

it's sad to leave this PR un-merged and not updating the project more often. I hope one day I'll be able to show some love to it again and fix up some left over things.
(University is such a diva taking up all my time lol)

@arabine
Copy link
Contributor

arabine commented Apr 24, 2025

@Fattorino do you need some help to manage this project?

@arabine
Copy link
Contributor

arabine commented Apr 28, 2025

Ok here is the updated CMakeLists that fixes warnings and specify ImGui version. Otherwise, this PR is a must have to quick test and understand the library. Maybe in the future: add the possibility to add nodes + draw them in specified X,Y positions. @AaronAppel can you update your PR?

cmake_minimum_required(VERSION 3.14)
project(MyProject VERSION 1.0 LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)

set(IMGUI_DIR ${CMAKE_CURRENT_LIST_DIR}/includes/imgui)
set(IMNODEFLOW_DIR ${CMAKE_CURRENT_LIST_DIR}/..)

include(FetchContent)

FetchContent_Declare(
    imgui
    GIT_REPOSITORY "https://github.com/ocornut/imgui.git"
    GIT_TAG "v1.91.6"  # Update with future minimum compatibility
    SOURCE_DIR ${IMGUI_DIR}
    GIT_SHALLOW TRUE  # Limit history to download
)

FetchContent_MakeAvailable(imgui)

list(APPEND imgui_sources
    ${IMGUI_DIR}/imgui.cpp
    ${IMGUI_DIR}/misc/cpp/imgui_stdlib.cpp
    ${IMGUI_DIR}/imgui_draw.cpp
    ${IMGUI_DIR}/imgui_tables.cpp
    ${IMGUI_DIR}/imgui_widgets.cpp
    ${IMGUI_DIR}/backends/imgui_impl_sdl2.cpp
    ${IMGUI_DIR}/backends/imgui_impl_opengl3.cpp
)

list(APPEND imnode_flow_sources
    ${IMNODEFLOW_DIR}/src/ImNodeFlow.cpp
)

add_executable(example example.cpp ${imgui_sources} ${imnode_flow_sources})
target_include_directories(example PRIVATE ${IMGUI_DIR} ${IMNODEFLOW_DIR}/include ${IMGUI_DIR}/backends)
target_compile_definitions(example PRIVATE IMGUI_DEFINE_MATH_OPERATORS)

if(CMAKE_SYSTEM_NAME MATCHES Emscripten)
    include(cmake/emscripten.cmake)
else()
    include(cmake/desktop.cmake)
endif()

@Fattorino
Copy link
Owner

Is this cmake for the example?

@pavanakumar
Copy link
Author

This is a change set to the existing CMakeLists.txt for the example I created, have now merged the changes by @arabine and a fix to the window header

@arabine
Copy link
Contributor

arabine commented Apr 28, 2025

Okay nice, go for merge on my side. (not tested ecmascripten).

Copy link
Owner

@Fattorino Fattorino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything looks good, I just left two comments on minor details

@Fattorino Fattorino merged commit 102b6b3 into Fattorino:master Apr 30, 2025
@Fattorino
Copy link
Owner

@pavanakumar I was taling about the "global" CMake, not the example one. I don't like how, now, to use the library you have to manually add the .cpp file to the list of sources of the executable. I much prefer the use of add_subdirectory() and then linking.
But Im open to discuss to find the true best solution (Im far from a CMake expert), if you could please open an issue about it so not to discuss it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants