From 10a67a97b107870ce7a0f35756aa1545bee46be9 Mon Sep 17 00:00:00 2001 From: Fabrice Date: Mon, 9 Feb 2026 23:50:31 +0100 Subject: adds mimalloc --- .gitmodules | 3 +++ Makefile | 27 +++++++++++++++++++++++++-- mimalloc | 1 + 3 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 .gitmodules create mode 160000 mimalloc diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..de4d60e --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "mimalloc"] + path = mimalloc + url = https://github.com/microsoft/mimalloc.git diff --git a/Makefile b/Makefile index 6556686..99d46aa 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,18 @@ WORK_DIR = . SRC_DIR = $(WORK_DIR)/src +MI_DIR = $(WORK_DIR)/mimalloc +MI_BUILD = $(MI_DIR)/build +MI_OBJECT = $(MI_BUILD)/mimalloc.o +MI_FLAGS = \ + -DMI_BUILD_STATIC=NO \ + -DMI_BUILD_SHARED=NO \ + -DMI_BUILD_OBJECT=YES \ + -DMI_BUILD_TESTS=NO \ + -DMI_USE_CXX=NO + +MI_GENERATOR = "Unix Makefiles" + CSH_FLAGS = -Wall -Wextra -Werror -pedantic -I$(SRC_DIR) CC = clang @@ -11,8 +23,9 @@ CXX = clang++ CXX_STD = -std=c++11 CXX_FLAGS = -fno-rtti -fno-exceptions $(CXX_STD) $(CSH_FLAGS) -RM = rm -f +RM = rm -rf ECHO = echo +CMAKE = cmake XDG_SHELL_PROT = $(WORK_DIR)/xdg-shell.xml @@ -23,11 +36,20 @@ SOURCES = \ OBJECTS := $(SOURCES:.cc=.o) OBJECTS := $(OBJECTS:.c=.o) +OBJECTS += $(MI_OBJECT) LIBRARIES = -lwayland-client all: $(WAYCLOCK) +$(MI_BUILD): + @echo " CMAKE $@" + @$(CMAKE) $(MI_DIR) -B $@ -G $(MI_GENERATOR) $(MI_FLAGS) + +$(MI_OBJECT): | $(MI_BUILD) + @echo " MAKE $@" + @$(MAKE) -C $(MI_BUILD) + $(WAYCLOCK): $(OBJECTS) @echo " LD $@" @$(CXX) $(CXX_FLAGS) -o $@ $^ $(LIBRARIES) @@ -42,4 +64,5 @@ $(WAYCLOCK): $(OBJECTS) .PHONY: clean clean: - @$(RM) $(OBJECTS) $(WAYCLOCK) \ No newline at end of file + @$(RM) $(OBJECTS) $(WAYCLOCK) + @$(RM) $(MI_BUILD) \ No newline at end of file diff --git a/mimalloc b/mimalloc new file mode 160000 index 0000000..8ff03b6 --- /dev/null +++ b/mimalloc @@ -0,0 +1 @@ +Subproject commit 8ff03b636192e25db17eaaff29e6f75acc9a662b -- cgit v1.2.3