mirror of
https://github.com/m1ngsama/TUT.git
synced 2025-12-25 02:57:08 +00:00
build: Update build system for terminal browser
Update CMake and add Makefile for the new project: - Rename project from NBTCA_TUI to TUT - Update executable name from nbtca_tui to tut - Add all new source files to build - Include Makefile for environments without CMake - Update .gitignore for build artifacts Both CMake and Make build systems are now supported for maximum compatibility.
This commit is contained in:
parent
6fb70c91d6
commit
51ea15fd5e
3 changed files with 57 additions and 9 deletions
5
.gitignore
vendored
5
.gitignore
vendored
|
|
@ -1 +1,4 @@
|
||||||
build/
|
build/
|
||||||
|
*.o
|
||||||
|
tut
|
||||||
|
.DS_Store
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
cmake_minimum_required(VERSION 3.15)
|
cmake_minimum_required(VERSION 3.15)
|
||||||
project(NBTCA_TUI LANGUAGES CXX)
|
project(TUT LANGUAGES CXX)
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
|
@ -15,15 +15,16 @@ endif()
|
||||||
find_package(Curses REQUIRED)
|
find_package(Curses REQUIRED)
|
||||||
find_package(CURL REQUIRED)
|
find_package(CURL REQUIRED)
|
||||||
|
|
||||||
add_executable(nbtca_tui
|
add_executable(tut
|
||||||
src/main.cpp
|
src/main.cpp
|
||||||
src/ics_fetcher.cpp
|
src/http_client.cpp
|
||||||
src/ics_parser.cpp
|
src/html_parser.cpp
|
||||||
src/tui_view.cpp
|
src/text_renderer.cpp
|
||||||
src/calendar.cpp
|
src/input_handler.cpp
|
||||||
|
src/browser.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
target_include_directories(nbtca_tui PRIVATE ${CURSES_INCLUDE_DIR})
|
target_include_directories(tut PRIVATE ${CURSES_INCLUDE_DIR})
|
||||||
target_link_libraries(nbtca_tui PRIVATE ${CURSES_LIBRARIES} CURL::libcurl)
|
target_link_libraries(tut PRIVATE ${CURSES_LIBRARIES} CURL::libcurl)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
44
Makefile
Normal file
44
Makefile
Normal file
|
|
@ -0,0 +1,44 @@
|
||||||
|
# Makefile for TUT Browser
|
||||||
|
|
||||||
|
CXX = clang++
|
||||||
|
CXXFLAGS = -std=c++17 -Wall -Wextra -O2
|
||||||
|
LDFLAGS = -lncurses -lcurl
|
||||||
|
|
||||||
|
# 源文件
|
||||||
|
SOURCES = src/main.cpp \
|
||||||
|
src/http_client.cpp \
|
||||||
|
src/html_parser.cpp \
|
||||||
|
src/text_renderer.cpp \
|
||||||
|
src/input_handler.cpp \
|
||||||
|
src/browser.cpp
|
||||||
|
|
||||||
|
# 目标文件
|
||||||
|
OBJECTS = $(SOURCES:.cpp=.o)
|
||||||
|
|
||||||
|
# 可执行文件
|
||||||
|
TARGET = tut
|
||||||
|
|
||||||
|
# 默认目标
|
||||||
|
all: $(TARGET)
|
||||||
|
|
||||||
|
# 链接
|
||||||
|
$(TARGET): $(OBJECTS)
|
||||||
|
$(CXX) $(OBJECTS) $(LDFLAGS) -o $(TARGET)
|
||||||
|
|
||||||
|
# 编译
|
||||||
|
%.o: %.cpp
|
||||||
|
$(CXX) $(CXXFLAGS) -c $< -o $@
|
||||||
|
|
||||||
|
# 清理
|
||||||
|
clean:
|
||||||
|
rm -f $(OBJECTS) $(TARGET)
|
||||||
|
|
||||||
|
# 运行
|
||||||
|
run: $(TARGET)
|
||||||
|
./$(TARGET)
|
||||||
|
|
||||||
|
# 安装
|
||||||
|
install: $(TARGET)
|
||||||
|
install -m 755 $(TARGET) /usr/local/bin/
|
||||||
|
|
||||||
|
.PHONY: all clean run install
|
||||||
Loading…
Reference in a new issue