diff --git a/.github/workflows/pr-smoketest-debian.yaml b/.github/workflows/pr-smoketest-debian.yaml index 1d8c79e07..f2c08166c 100644 --- a/.github/workflows/pr-smoketest-debian.yaml +++ b/.github/workflows/pr-smoketest-debian.yaml @@ -30,6 +30,7 @@ jobs: ca-certificates \ git \ ${{ matrix.compiler }} \ + make \ libboost-dev \ libboost-filesystem-dev \ libboost-locale-dev \ @@ -38,17 +39,15 @@ jobs: libcairo2-dev \ libglew-dev \ libglm-dev \ + libimgui-dev \ libsdl2-dev \ libsdl2-image-dev \ libsdl2-mixer-dev \ libsdl2-ttf-dev \ - libvorbis-dev \ - make + libvorbis-dev - name: Checkout Anura uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - with: - submodules: true - name: Build Anura env: diff --git a/.github/workflows/pr-smoketest-fedora.yaml b/.github/workflows/pr-smoketest-fedora.yaml index 48f6689f3..7f68c426b 100644 --- a/.github/workflows/pr-smoketest-fedora.yaml +++ b/.github/workflows/pr-smoketest-fedora.yaml @@ -50,6 +50,7 @@ jobs: - name: Build Anura env: + IMGUI: local CXX: ${{ matrix.compiler }} # Number of cores * 3 run: make -j "$(($(getconf _NPROCESSORS_ONLN) * 3))" diff --git a/.github/workflows/pr-smoketest-opensuse-leap.yaml b/.github/workflows/pr-smoketest-opensuse-leap.yaml index ea453f8e1..3b51c5748 100644 --- a/.github/workflows/pr-smoketest-opensuse-leap.yaml +++ b/.github/workflows/pr-smoketest-opensuse-leap.yaml @@ -56,10 +56,11 @@ jobs: - name: Checkout Anura uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 with: - submodules: true + submodules: true - name: Build Anura env: + IMGUI: local CXX: ${{ matrix.compiler }} # Number of cores * 3 run: make -j "$(($(getconf _NPROCESSORS_ONLN) * 3))" diff --git a/.github/workflows/pr-smoketest-ubuntu.yaml b/.github/workflows/pr-smoketest-ubuntu.yaml index 64898a31c..66c84ede3 100644 --- a/.github/workflows/pr-smoketest-ubuntu.yaml +++ b/.github/workflows/pr-smoketest-ubuntu.yaml @@ -27,6 +27,7 @@ jobs: ca-certificates \ git \ ${{ matrix.compiler }} \ + make \ libboost-dev \ libboost-filesystem-dev \ libboost-locale-dev \ @@ -35,17 +36,15 @@ jobs: libcairo2-dev \ libglew-dev \ libglm-dev \ + libimgui-dev \ libsdl2-dev \ libsdl2-image-dev \ libsdl2-mixer-dev \ libsdl2-ttf-dev \ - libvorbis-dev \ - make + libvorbis-dev - name: Checkout Anura uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - with: - submodules: true - name: Build Anura env: diff --git a/.github/workflows/push-unit-tests-dynamic-linux.yaml b/.github/workflows/push-unit-tests-dynamic-linux.yaml index e8731e9da..52c7993a1 100644 --- a/.github/workflows/push-unit-tests-dynamic-linux.yaml +++ b/.github/workflows/push-unit-tests-dynamic-linux.yaml @@ -16,6 +16,7 @@ jobs: ca-certificates \ git \ clang \ + make \ libboost-dev \ libboost-filesystem-dev \ libboost-locale-dev \ @@ -24,17 +25,15 @@ jobs: libcairo2-dev \ libglew-dev \ libglm-dev \ + libimgui-dev \ libsdl2-dev \ libsdl2-image-dev \ libsdl2-mixer-dev \ libsdl2-ttf-dev \ - libvorbis-dev \ - make + libvorbis-dev - name: Checkout Anura uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - with: - submodules: true - name: Build Anura env: diff --git a/Makefile b/Makefile index 76102a8ca..c360ecefa 100644 --- a/Makefile +++ b/Makefile @@ -151,9 +151,25 @@ OBJ := $(patsubst src/%.cpp,./build/%.o,$(SRC)) DEPS := $(patsubst src/%.cpp,./build/%.d,$(SRC)) INCLUDES := $(addprefix -I,$(SRC_DIR)) +# Allow to manually say we use the submodule +IMGUI?=library +ifeq ($(IMGUI),local) + BASE_CXXFLAGS += -DLOCAL_IMGUI + INC += -Iimgui + SRC += imgui/imgui.cpp imgui/imgui_draw.cpp imgui/imgui_widgets.cpp + OBJ += imgui/imgui.o imgui/imgui_draw.o imgui/imgui_widgets.o + SRC_DIR += ./imgui +else + INC += $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) pkg-config --cflags imgui) + LIBS += $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) pkg-config --libs imgui) +endif + +# Make it possible to inject this variable from ENV +export IMGUI + +# Compilation injection of our extensions of imgui CPPFLAGS += -DIMGUI_USER_CONFIG=\"$(abspath src/imgui_additions/imconfig.h)\" -INC += $(shell pkg-config --cflags imgui) -LIBS += $(shell pkg-config --libs imgui) + vpath %.cpp $(SRC_DIR) diff --git a/src/imgui_additions/imgui_custom.cpp b/src/imgui_additions/imgui_custom.cpp index 4c204740c..62981f181 100644 --- a/src/imgui_additions/imgui_custom.cpp +++ b/src/imgui_additions/imgui_custom.cpp @@ -17,7 +17,7 @@ #include "spline_simple.h" #include -#if !defined(_MSC_VER) && !defined(__APPLE__ ) +#if !defined(_MSC_VER) && !defined(__APPLE__ ) && !defined(LOCAL_IMGUI) #include #else #include diff --git a/src/imgui_additions/imgui_custom.h b/src/imgui_additions/imgui_custom.h index b2a854ff1..41e51e8f2 100644 --- a/src/imgui_additions/imgui_custom.h +++ b/src/imgui_additions/imgui_custom.h @@ -23,7 +23,7 @@ #pragma once -#if !defined(_MSC_VER) && !defined(__APPLE__ ) +#if !defined(_MSC_VER) && !defined(__APPLE__ ) && !defined(LOCAL_IMGUI) #include #else #include diff --git a/src/kre/imgui_impl_sdl_gl3.h b/src/kre/imgui_impl_sdl_gl3.h index 677d4fad6..37eb7174a 100644 --- a/src/kre/imgui_impl_sdl_gl3.h +++ b/src/kre/imgui_impl_sdl_gl3.h @@ -8,7 +8,7 @@ #pragma once -#if !defined(_MSC_VER) && !defined(__APPLE__ ) +#if !defined(_MSC_VER) && !defined(__APPLE__ ) && !defined(LOCAL_IMGUI) #include #else #include diff --git a/src/theme_imgui.cpp b/src/theme_imgui.cpp index 464ef838e..c275c030a 100644 --- a/src/theme_imgui.cpp +++ b/src/theme_imgui.cpp @@ -23,7 +23,7 @@ #include "theme_imgui.hpp" -#if !defined(_MSC_VER) && !defined(__APPLE__ ) +#if !defined(_MSC_VER) && !defined(__APPLE__ ) && !defined(LOCAL_IMGUI) #include #else #include