stamen

Stamen - static menu generator
git clone git://git.dimitrijedobrota.com/stamen.git
Log | Files | Refs | README | LICENSE

commit 0ab8d3b1b0cae32d598a861f4fa04f95b348d54c
parent 5dd366ebead42ece724fc60097c79e667739dcc6
Author: Dimitrije Dobrota <mail@dimitrijedobrota.com>
Date:   Tue,  7 Nov 2023 00:17:51 +0000

Switch to CMake

Diffstat:
M.gitignore | 54+-----------------------------------------------------
ACMakeLists.txt | 15+++++++++++++++
DMakefile | 37-------------------------------------
Dmenu.json | 22----------------------
Asrc/CMakeLists.txt | 23+++++++++++++++++++++++
5 files changed, 39 insertions(+), 112 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -1,54 +1,2 @@ build - -# Prerequisites -*.d - -# Object files -*.o -*.ko -*.obj -*.elf - -# Linker output -*.ilk -*.map -*.exp - -# Precompiled Headers -*.gch -*.pch - -# Libraries -*.lib -*.a -*.la -*.lo - -# Shared objects (inc. Windows DLLs) -*.dll -*.so -*.so.* -*.dylib - -# Executables -*.exe -*.out -*.app -*.i*86 -*.x86_64 -*.hex - -# Debug files -*.dSYM/ -*.su -*.idb -*.pdb - -# Kernel Module Compile Results -*.mod* -*.cmd -.tmp_versions/ -modules.order -Module.symvers -Mkfile.old -dkms.conf +.cache diff --git a/CMakeLists.txt b/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 3.27.2) +set(CMAKE_EXPORT_COMPILE_COMMANDS ON) + +project( + Menu + VERSION 0.0.1 + DESCRIPTION "Experimentation with dinamic menus" + LANGUAGES CXX +) + +set(CMAKE_CXX_STANDARD 20) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS OFF) + +add_subdirectory(src) diff --git a/Makefile b/Makefile @@ -1,37 +0,0 @@ -NAME = menu -CC = g++ - -SRC = src -INC = include -BUILD = build - -CFLAGS = -I$(INC) --std=c++17 -LDFLAGS = - -SRCS := $(wildcard $(SRC)/*.cpp) -OBJS=$(patsubst $(SRC)/%.cpp, $(BUILD)/%.o, $(SRCS)) -TRGT=$(BUILD)/$(NAME) - -ifeq ($(DEBUG),Y) - CFLAGS += -ggdb -Wall -Wextra -Werror -Wpedantic -Weffc++ -else - CFLAGS += -Ofast -flto=auto -endif - -all: dirs $(TRGT) -remake: clean - $(MAKE) - -$(TRGT): $(OBJS) - $(CC) $^ $(CFLAGS) $(LDFLAGS) -o $@ - -$(BUILD)/%.o: $(SRC)/%.cpp - $(CC) -c $< -o $@ $(CFLAGS) $(LDFLAGS) - -dirs: - @mkdir -p $(BUILD) - -clean: - @$(RM) -rf $(OBJS) $(TRGT) - -.PHONY: all clean remake dirs diff --git a/menu.json b/menu.json @@ -1,22 +0,0 @@ -[ - { - "name": "Main Menu", - "code": "main", - "items": [ - {"prompt": "Edit graph", "callback": "edit_graph"}, - {"prompt": "Algorithms", "callback": "algorithms"}, - {"prompt": "Setting", "callback": "settings"}, - {"prompt": "Quit", "callback": "finish"} - ] - }, - { - "name": "Edit Graph", - "code": "edit_graph", - "items": [ - {"prompt": "Read/Write files", "callback": "foo"}, - {"prompt": "Add/Remove node", "callback": "foo"}, - {"prompt": "Add/Remove edge", "callback": "foo"}, - {"prompt": "Print", "callback": "foo"}, - {"prompt": "Clear", "callback": "foo"} - ] - }] diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt @@ -0,0 +1,23 @@ +add_library(menu + menu.cpp + display.cpp +) + +target_include_directories(menu + PUBLIC ../include +) + + +add_executable(demo + main.cpp +) + +target_link_libraries(demo + PRIVATE menu +) + +set_target_properties(demo PROPERTIES + VERSION ${PROJECT_VERSION} + SOVERSION ${PROJECT_VERSION_MAJOR} + RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin" +)