transfer RENA project deps+make to enby
This commit is contained in:
parent
a16720e92f
commit
b479742884
4 changed files with 141 additions and 0 deletions
51
Makefile
Normal file
51
Makefile
Normal file
|
|
@ -0,0 +1,51 @@
|
||||||
|
.DEFAULT_GOAL := all
|
||||||
|
|
||||||
|
include config.mk
|
||||||
|
|
||||||
|
# === BUILD ENVIRONMENT ===
|
||||||
|
BIN := bin
|
||||||
|
BUILD := build
|
||||||
|
|
||||||
|
LIB := lib
|
||||||
|
|
||||||
|
# === MACRO DEFINITIONS ===
|
||||||
|
define objpath
|
||||||
|
$(addprefix $(BUILD)/,
|
||||||
|
$(addsuffix .o,
|
||||||
|
$(basename $(1))))
|
||||||
|
endef
|
||||||
|
define mkobj
|
||||||
|
$(foreach DEP, $?,
|
||||||
|
mkdir -p $(dir $(call objpath, $(DEP)))
|
||||||
|
$(CC) $(CFLAGS) $1 -o $(call objpath, $(DEP)) -c $(DEP))
|
||||||
|
|
||||||
|
$(LD) -r $(LDFLAGS) -o $@ $(call objpath, $?)
|
||||||
|
endef
|
||||||
|
|
||||||
|
# === BUILD TARGETS ===
|
||||||
|
all:
|
||||||
|
|
||||||
|
.PHONY: tests
|
||||||
|
tests: $(BIN) $(BIN)/test-imgui-sdl3glfw3 $(BIN)/test-custom
|
||||||
|
|
||||||
|
$(BIN)/test-imgui-sdl3glfw3:
|
||||||
|
$(CXX) -o $@ sandbox/$(notdir $@).cpp -Ideps -Ideps/imgui -Ldeps -limgui -lSDL3 -lGL -lm
|
||||||
|
$(BIN)/test-custom:
|
||||||
|
$(CXX) -o $@ sandbox/$(notdir $@).cpp -Ideps -Ideps/imgui -Ldeps -limgui -lSDL3 -lGL -lm
|
||||||
|
$(BUILD) $(BIN):
|
||||||
|
mkdir -p $@
|
||||||
|
|
||||||
|
# === DEVELOPMENT TARGETS ===
|
||||||
|
# .PHONY: debug run test
|
||||||
|
# debug:
|
||||||
|
# $(MAKE) all \
|
||||||
|
# CFLAGS="$(CFLAGS) $(CFLAGS_DBG)" \
|
||||||
|
# CLDFLAGS="$(CLDFLAGS) $(CLDFLAGS_DBG)"
|
||||||
|
# run: debug
|
||||||
|
# - command $(BIN)/pw-test
|
||||||
|
# test: clean run
|
||||||
|
|
||||||
|
# === UTILITY TARGETS ===
|
||||||
|
.PHONY: clean
|
||||||
|
clean:
|
||||||
|
- rm -rf $(BUILD) $(BIN) vgcore.* &>/dev/null logs/
|
||||||
13
config.mk
Normal file
13
config.mk
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
# === C Compiler Configuration ===
|
||||||
|
CC := gcc
|
||||||
|
CFLAGS := -Wall -Wextra -std=gnu23 -O
|
||||||
|
CDEBUG := -g
|
||||||
|
|
||||||
|
# === C++ Compiler Configuration ===
|
||||||
|
CXX := gcc -xc++ -lstdc++ -shared-libgcc
|
||||||
|
CXXFLAGS := -Wall -Wextra -O
|
||||||
|
CXXDEBUG := -g
|
||||||
|
|
||||||
|
# === Linker Configuration ===
|
||||||
|
LD := ld
|
||||||
|
LDFLAGS :=
|
||||||
75
deps/Makefile
vendored
Normal file
75
deps/Makefile
vendored
Normal file
|
|
@ -0,0 +1,75 @@
|
||||||
|
.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)
|
||||||
2
mk
Executable file
2
mk
Executable file
|
|
@ -0,0 +1,2 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
$([ -x "$(command -v bear)" ] && echo 'bear -- ') make $@
|
||||||
Loading…
Add table
Add a link
Reference in a new issue