change build system to CMake
This commit is contained in:
parent
e9814dea3e
commit
7ea34913fe
1
CMakeLists.txt
Normal file
1
CMakeLists.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.11)
|
||||||
73
Makefile
73
Makefile
@ -1,73 +0,0 @@
|
|||||||
# SPDX-FileCopyrightText: 2025 thorium1256
|
|
||||||
#
|
|
||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
||||||
|
|
||||||
# compiler stuff
|
|
||||||
CXX := c++
|
|
||||||
CXXFLAGS := -I include -std=c++11 -Wall -Wextra
|
|
||||||
DBG_CXXFLAGS := $(CXXFLAGS) -g
|
|
||||||
RLS_CXXFLAGS := $(CXXFLAGS) -O2
|
|
||||||
|
|
||||||
# linker stuff
|
|
||||||
LDFLAGS := -lncursesw -lSDL2
|
|
||||||
DBG_LDFLAGS := $(LDFLAGS)
|
|
||||||
RLS_LDFLAGS := $(LDFLAGS) -s
|
|
||||||
|
|
||||||
# directories
|
|
||||||
BUILD_DIR := build
|
|
||||||
SRC_DIR := src
|
|
||||||
BIN_DIR := bin
|
|
||||||
DBG_DIR := $(BIN_DIR)/debug
|
|
||||||
RLS_DIR := $(BIN_DIR)/release
|
|
||||||
DBG_EXEC := $(DBG_DIR)/debug
|
|
||||||
RLS_STRIPPED_EXEC := $(RLS_DIR)/tuimine
|
|
||||||
|
|
||||||
# install stuff
|
|
||||||
PREFIX ?= /usr/local
|
|
||||||
BINDIR ?= $(PREFIX)/bin
|
|
||||||
DATADIR ?= $(PREFIX)/share
|
|
||||||
APPLICATION ?= tuimine
|
|
||||||
|
|
||||||
# sources and objects
|
|
||||||
SRCS := $(wildcard $(SRC_DIR)/*.cpp)
|
|
||||||
DBG_OBJS := $(patsubst $(SRC_DIR)/%.cpp,$(BUILD_DIR)/debug_%.o,$(SRCS))
|
|
||||||
RLS_OBJS := $(patsubst $(SRC_DIR)/%.cpp,$(BUILD_DIR)/release_%.o,$(SRCS))
|
|
||||||
|
|
||||||
$(shell mkdir -p $(BIN_DIR))
|
|
||||||
$(shell mkdir -p $(DBG_DIR))
|
|
||||||
$(shell mkdir -p $(RLS_DIR))
|
|
||||||
$(shell mkdir -p $(BUILD_DIR))
|
|
||||||
|
|
||||||
# phony rules
|
|
||||||
.PHONY = all debug release clean install uninstall
|
|
||||||
|
|
||||||
all: release
|
|
||||||
|
|
||||||
debug: $(DBG_EXEC)
|
|
||||||
release: $(RLS_STRIPPED_EXEC)
|
|
||||||
both: debug release
|
|
||||||
|
|
||||||
# linking
|
|
||||||
$(DBG_EXEC): $(DBG_OBJS)
|
|
||||||
$(CXX) -o $@ $^ $(DBG_LDFLAGS)
|
|
||||||
|
|
||||||
$(RLS_STRIPPED_EXEC): $(RLS_OBJS)
|
|
||||||
$(CXX) -o $@ $^ $(RLS_LDFLAGS)
|
|
||||||
|
|
||||||
# compiling
|
|
||||||
$(BUILD_DIR)/debug_%.o: $(SRC_DIR)/%.cpp
|
|
||||||
$(CXX) -c -o $@ $< $(DBG_CXXFLAGS)
|
|
||||||
|
|
||||||
$(BUILD_DIR)/release_%.o: $(SRC_DIR)/%.cpp
|
|
||||||
$(CXX) -c -o $@ $< $(RLS_CXXFLAGS)
|
|
||||||
|
|
||||||
install: release
|
|
||||||
install -d $(DESTDIR)$(BINDIR)
|
|
||||||
install -m 755 $(RLS_STRIPPED_EXEC) $(DESTDIR)$(BINDIR)/$(APPLICATION)
|
|
||||||
|
|
||||||
uninstall:
|
|
||||||
rm -f $(DESTDIR)$(BINDIR)/$(APPLICATION)
|
|
||||||
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -rf $(BUILD_DIR) $(DBG_DIR) $(RLS_DIR)
|
|
||||||
Loading…
x
Reference in New Issue
Block a user