Skip to content

Commit

Permalink
🐛 Don't rely on imgui.h being in a folder called imgui. Fixes #1
Browse files Browse the repository at this point in the history
  • Loading branch information
JulesFouchy committed Aug 23, 2023
1 parent 3665318 commit c2641dc
Show file tree
Hide file tree
Showing 11 changed files with 15 additions and 12 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ In order to access the gradient data (without the GUI state), you can get the `I

### Including

To add this library to your project, simply add these three lines to your *CMakeLists.txt* and replace `folder/containing/imgui` with the path to the parent folder containing *imgui*:
To add this library to your project, simply add these three lines to your *CMakeLists.txt* and replace `folder/containing/imgui` with the path to the folder containing the *imgui* headers:
```cmake
add_subdirectory(path/to/imgui_gradient)
target_include_directories(imgui_gradient SYSTEM PRIVATE folder/containing/imgui)
Expand Down
2 changes: 1 addition & 1 deletion src/ColorRGBA.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include <imgui/imgui.h> // Include ImVec4
#include <imgui.h> // Include ImVec4

namespace ImGG {

Expand Down
2 changes: 1 addition & 1 deletion src/HoverChecker.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "HoverChecker.hpp"
#include <imgui/imgui.h>
#include <imgui.h>
#include <algorithm>

namespace ImGG { namespace internal {
Expand Down
2 changes: 1 addition & 1 deletion src/RelativePosition.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include <imgui/imgui.h>
#include <imgui.h>
#include <cassert>
#include "WrapMode.hpp"

Expand Down
2 changes: 1 addition & 1 deletion src/Settings.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include <imgui/imgui.h>
#include <imgui.h>
#include <functional>
#include "Flags.hpp"
#include "internal.hpp"
Expand Down
2 changes: 1 addition & 1 deletion src/extra_widgets.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "extra_widgets.hpp"
#include <imgui/imgui.h>
#include <imgui.h>
#include <array>
#include "imgui_internal.hpp"
#include "tooltip.hpp"
Expand Down
2 changes: 1 addition & 1 deletion src/imgui_internal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsign-conversion"
#endif
#include <imgui/imgui_internal.h>
#include <imgui_internal.h>
#if defined(__GNUC__)
#pragma GCC diagnostic pop
#endif
2 changes: 1 addition & 1 deletion src/internal.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

#define IMGUI_DEFINE_MATH_OPERATORS
#include <imgui/imgui.h>
#include <imgui.h>
#include "imgui_internal.hpp"

namespace ImGG { namespace internal {
Expand Down
1 change: 0 additions & 1 deletion src/maybe_disabled.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#pragma once
#include <imgui/imgui.h>
#include <functional>

namespace ImGG {
Expand Down
2 changes: 1 addition & 1 deletion src/tooltip.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include <imgui/imgui.h>
#include <imgui.h>

namespace ImGG {

Expand Down
8 changes: 6 additions & 2 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ endif()

# Maybe enable warnings as errors
set(WARNINGS_AS_ERRORS_FOR_IMGUI_GRADIENT OFF CACHE BOOL "ON iff you want to treat warnings as errors")

if(WARNINGS_AS_ERRORS_FOR_IMGUI_GRADIENT)
if(MSVC)
target_compile_options(${PROJECT_NAME} PRIVATE /WX)
Expand All @@ -36,12 +37,15 @@ target_link_libraries(${PROJECT_NAME} PRIVATE doctest::doctest)

# ---Ignore .vscode/settings.json in Git---
find_package(Git QUIET)

if(GIT_FOUND)
get_filename_component(PARENT_DIR ${CMAKE_CURRENT_SOURCE_DIR} DIRECTORY)
if (EXISTS "${PARENT_DIR}/.git")

if(EXISTS "${PARENT_DIR}/.git")
execute_process(COMMAND ${GIT_EXECUTABLE} update-index --assume-unchanged .vscode/settings.json
WORKING_DIRECTORY ${PARENT_DIR}
RESULT_VARIABLE ERRORS)

if(NOT ERRORS EQUAL "0")
message("Git assume-unchanged failed: ${ERRORS}")
endif()
Expand All @@ -60,5 +64,5 @@ FetchContent_Declare(
GIT_TAG b1c961bbf81b85704daed4562baf535a86709d7f
)
FetchContent_MakeAvailable(quick_imgui)
target_include_directories(imgui_gradient PRIVATE ${quick_imgui_SOURCE_DIR}/lib)
target_include_directories(imgui_gradient PRIVATE ${quick_imgui_SOURCE_DIR}/lib/imgui)
target_link_libraries(${PROJECT_NAME} PRIVATE quick_imgui::quick_imgui)

0 comments on commit c2641dc

Please sign in to comment.