ide just launches ./lightgui (builds only with --build via plain make; the redundant cmake re-build is gone). Delete widgets/layout/ (the standalone layout executable) and drop it from widgets/CMakeLists.txt. The file-based IPC header widgets/common/ipc.h is KEPT: it is still referenced by widgets/palette/main_palette.cpp, which is now dead code (ide no longer launches the palette process) but was not authorized for deletion in this step.
71 lines
3.0 KiB
Makefile
71 lines
3.0 KiB
Makefile
CXX ?= g++
|
|
CXXFLAGS ?= -O2 -Wall -Wextra -std=c++17
|
|
GTKFLAGS := $(shell pkg-config --cflags gtk+-3.0)
|
|
GTKLIBS := $(shell pkg-config --libs gtk+-3.0)
|
|
# X11 + XFrame widgets for the unified canvas (src/xframe_canvas*.cpp):
|
|
# the canvas module includes <X11/...> and widgets/common/registry.h.
|
|
X11FLAGS := $(shell pkg-config --cflags x11)
|
|
X11LIBS := $(shell pkg-config --libs x11)
|
|
WIDGETS_INC := -Iwidgets
|
|
# Headers the XFrame canvas core depends on (outside src/).
|
|
WIDGET_HDRS := widgets/common/registry.h widgets/common/ico.h widgets/core/xframe_core.h
|
|
NPROC := $(shell nproc 2>/dev/null || echo 4)
|
|
# Short git commit, baked into the binary for Help -> About
|
|
# (LIGHTGUI_GIT_HASH); "unknown" when built outside a git checkout.
|
|
GIT_HASH := $(shell git rev-parse --short HEAD 2>/dev/null || echo unknown)
|
|
|
|
# Parallel build, ON BY DEFAULT (standing requirement): the designer is
|
|
# compiled one .o per .cpp and linked, so a plain `make` / `make
|
|
# lightgui` / `make all` uses all NPROC cores with no -j flag to
|
|
# remember. SRCS is a wildcard, so a .cpp added to src/ later is
|
|
# compiled as its own .o automatically — no Makefile edit needed, and
|
|
# no future build silently falls back to a single core.
|
|
MAKEFLAGS += -j$(NPROC)
|
|
|
|
# LightGUI -- C++/GTK designer (src/) + XFrame widgets (widgets/).
|
|
# make build the lightgui binary and all widget demos
|
|
# make lightgui build ./lightgui only
|
|
# make widgets build widgets/build (all widget demos + palette + layout)
|
|
# make test run the layout -> LightGUI seam test (no display needed)
|
|
# make clean remove built artefacts
|
|
# ./ide start the designer (single process)
|
|
.PHONY: all lightgui widgets test clean
|
|
|
|
SRCS := $(wildcard src/*.cpp)
|
|
OBJS := $(SRCS:.cpp=.o)
|
|
# Headers the .o files depend on (any header change rebuilds them all;
|
|
# cheap, and it keeps the rule simple). The generated embedded headers
|
|
# are built by their own rules below when missing.
|
|
HDRS := $(wildcard src/*.h) ui/designer.ui
|
|
GENHDRS := src/indicators_embedded.h src/drawings_embedded.h
|
|
|
|
all: lightgui widgets
|
|
|
|
lightgui: $(OBJS) $(GENHDRS)
|
|
$(CXX) $(CXXFLAGS) -DLIGHTGUI_GIT_HASH='"$(GIT_HASH)"' -o $@ $(OBJS) $(GTKFLAGS) $(GTKLIBS) $(X11LIBS)
|
|
|
|
# One .o per .cpp (pattern rule — parallelises under -j).
|
|
src/%.o: src/%.cpp $(HDRS) $(GENHDRS) $(WIDGET_HDRS)
|
|
$(CXX) $(CXXFLAGS) -DLIGHTGUI_GIT_HASH='"$(GIT_HASH)"' -c $< -o $@ $(GTKFLAGS) $(X11FLAGS) $(WIDGETS_INC)
|
|
|
|
src/indicators_embedded.h: src/indicators.h tools/embed_indicators.sh
|
|
sh tools/embed_indicators.sh src/indicators.h $@
|
|
|
|
src/drawings_embedded.h: src/drawings.h tools/embed_drawings.sh
|
|
sh tools/embed_drawings.sh src/drawings.h $@
|
|
|
|
widgets:
|
|
cmake -S widgets -B widgets/build
|
|
# Clear MAKEFLAGS for the submake: the top-level -j in MAKEFLAGS
|
|
# would otherwise make it warn "-j forced in submake: resetting
|
|
# jobserver mode". cmake still gets -j explicitly, so the widgets
|
|
# still build on all cores.
|
|
MAKEFLAGS= cmake --build widgets/build -j$(NPROC)
|
|
|
|
test:
|
|
python3 widgets/tests/test_layout_to_lightgui.py
|
|
|
|
clean:
|
|
rm -f lightgui $(OBJS)
|
|
rm -rf widgets/build
|