diff --git a/.gitmodules b/.gitmodules index 9c0e469..3166021 100644 --- a/.gitmodules +++ b/.gitmodules @@ -7,3 +7,7 @@ [submodule "external/acutest"] path = external/acutest url = https://github.com/mity/acutest +[submodule "external/imgui"] + path = external/imgui + url = https://github.com/ocornut/imgui.git + branch = 1.9.4-docking diff --git a/CMakeLists.txt b/CMakeLists.txt index 3244bfe..3c4ba6d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,7 +14,11 @@ add_subdirectory(external/raylib) # ------------------------- add_subdirectory(external/angelscript/sdk/angelscript/projects/cmake) - +# ------------------------- +# Dear ImGui (docking branch) +# ------------------------- +# Ensure the submodule exists at external/imgui (added with git submodule) +add_subdirectory(cmake/imgui) # ------------------------- # Tests # ------------------------- @@ -61,6 +65,7 @@ target_include_directories(simian PUBLIC external/angelscript/sdk/angelscript/include external/angelscript/sdk/add_on/scriptstdstring external/angelscript/sdk/add_on/scriptbuilder + external/imgui ) target_link_libraries(simian @@ -68,6 +73,7 @@ target_link_libraries(simian angelscript scriptstdstring scriptbuilder + imgui ) # ------------------------- diff --git a/cmake/imgui/CMakeLists.txt b/cmake/imgui/CMakeLists.txt new file mode 100644 index 0000000..e4413bc --- /dev/null +++ b/cmake/imgui/CMakeLists.txt @@ -0,0 +1,27 @@ +cmake_minimum_required(VERSION 3.10) +project(imgui_wrapper NONE) + +# Root of the imgui submodule +set(IMGUI_ROOT "${CMAKE_SOURCE_DIR}/external/imgui") + +if(NOT EXISTS "${IMGUI_ROOT}/imgui.h") + message(FATAL_ERROR "ImGui not found in ${IMGUI_ROOT}. Run: git submodule update --init --recursive") +endif() + +# Gather core sources and optional backend sources if present +file(GLOB IMGUI_CORE_SRCS "${IMGUI_ROOT}/*.cpp") +file(GLOB IMGUI_BACKEND_SRCS "${IMGUI_ROOT}/backends/*.cpp") + +# Exclude example / main files if any sneak in +list(FILTER IMGUI_CORE_SRCS EXCLUDE REGEX ".*example.*|.*main.*") + +set(IMGUI_SOURCES ${IMGUI_CORE_SRCS} ${IMGUI_BACKEND_SRCS}) + +add_library(imgui STATIC ${IMGUI_SOURCES}) + +target_include_directories(imgui PUBLIC + ${IMGUI_ROOT} +) + +# Optional: keep PIC for static linking on some platforms +set_target_properties(imgui PROPERTIES POSITION_INDEPENDENT_CODE ON) \ No newline at end of file