76 lines
2.2 KiB
Makefile
76 lines
2.2 KiB
Makefile
|
|
.DEFAULT_GOAL := all
|
||
|
|
|
||
|
|
CXX := gcc -xc++ -lstdc++ -shared-libgcc
|
||
|
|
|
||
|
|
BUILD := build
|
||
|
|
DEPS := imgui
|
||
|
|
SYNC := $(addsuffix -sync, $(DEPS))
|
||
|
|
|
||
|
|
# imgui_impl_allegro5.o imgui_impl_android.o imgui_impl_dx9.o
|
||
|
|
# imgui_impl_dx10.o imgui_impl_dx11.o imgui_impl_dx12.o
|
||
|
|
# imgui_impl_glfw.o imgui_impl_glut.o imgui_impl_opengl2.o
|
||
|
|
# imgui_impl_opengl3.o imgui_impl_sdl2.o imgui_impl_sdl3.o
|
||
|
|
# imgui_impl_sdlgpu3.o imgui_impl_sdlrenderer2.o imgui_impl_sdlrenderer3.o
|
||
|
|
# imgui_impl_vulkan.o imgui_impl_wgpu.o imgui_impl_win32.o
|
||
|
|
|
||
|
|
# === DEAR IMGUI = VALID BACKENDS ===
|
||
|
|
# allegro5 glfw sdlgpu3
|
||
|
|
# android glut sdlrenderer2
|
||
|
|
# dx9 opengl2 sdlrenderer3
|
||
|
|
# dx10 opengl3 vulkan
|
||
|
|
# dx11 sdl2 wgpu
|
||
|
|
# dx12 sdl3 win32
|
||
|
|
IMGUI_ENABLE_BACKENDS := sdl3 opengl3
|
||
|
|
|
||
|
|
# Dear ImGui
|
||
|
|
IMGUI_UPSTREAM := https://github.com/ocornut/imgui.git
|
||
|
|
IMGUI_BRANCH := docking
|
||
|
|
IMGUI_TAG := v1.92.3-docking
|
||
|
|
|
||
|
|
IMGUI_BACKENDS := $(foreach backend, $(IMGUI_ENABLE_BACKENDS), imgui_impl_$(backend).o)
|
||
|
|
|
||
|
|
IMGUI_OBJS := imgui.o imgui_demo.o \
|
||
|
|
imgui_draw.o imgui_tables.o imgui_widgets.o \
|
||
|
|
imgui_freetype.o imgui_stdlib.o \
|
||
|
|
$(addprefix backends/, $(IMGUI_BACKENDS))
|
||
|
|
|
||
|
|
STATICLIBS := $(foreach dep, $(DEPS), lib$(dep).a)
|
||
|
|
|
||
|
|
# === BUILD TARGETS ===
|
||
|
|
all: $(BUILD) $(STATICLIBS)
|
||
|
|
$(BUILD):
|
||
|
|
mkdir -p $(addprefix $(BUILD)/, $(DEPS))
|
||
|
|
|
||
|
|
libimgui.a: imgui $(addprefix $(BUILD)/imgui/, $(IMGUI_OBJS))
|
||
|
|
ar rcs $@ $(filter %.o, $^)
|
||
|
|
|
||
|
|
$(BUILD)/imgui/imgui_stdlib.o: imgui/misc/cpp/imgui_stdlib.cpp
|
||
|
|
$(CXX) -c $^ -o $@ -Iimgui
|
||
|
|
$(BUILD)/imgui/imgui_freetype.o: imgui/misc/freetype/imgui_freetype.cpp
|
||
|
|
$(CXX) -c $^ -o $@ -Iimgui
|
||
|
|
$(BUILD)/imgui/backends/%.o: imgui/backends/%.cpp
|
||
|
|
mkdir -p $(dir $@)
|
||
|
|
$(CXX) -c $^ -o $@ -Iimgui
|
||
|
|
$(BUILD)/imgui/%.o: imgui/%.cpp
|
||
|
|
$(CXX) -c $^ -o $@
|
||
|
|
|
||
|
|
# === SYNC TARGETS ===
|
||
|
|
.PHONY: sync $(SYNC)
|
||
|
|
sync: $(SYNC)
|
||
|
|
|
||
|
|
imgui:
|
||
|
|
mkdir -p $@
|
||
|
|
- git -C $@ init
|
||
|
|
- git -C $@ remote add upstream $(IMGUI_UPSTREAM)
|
||
|
|
$(MAKE) $@-sync
|
||
|
|
imgui-sync: imgui
|
||
|
|
git -C $< fetch upstream --tags
|
||
|
|
git -C $< -c advice.detachedHead=false checkout $(IMGUI_TAG)
|
||
|
|
|
||
|
|
# === UTILITY TARGETS ===
|
||
|
|
.PHONY: clean purge
|
||
|
|
clean:
|
||
|
|
rm -rf $(BUILD) $(STATICLIBS)
|
||
|
|
purge: clean
|
||
|
|
rm -rf $(DEPS)
|