TUT/CMakeLists.txt
m1ngsama 430e70d7b6 refactor: Major simplification following Unix philosophy
Removed ~45% dead code and simplified architecture:

Dead Code Removal (~1,687 LOC):
- calendar.cpp/h - Unused calendar stub
- ics_fetcher.cpp/h - Orphaned ICS fetching
- ics_parser.cpp/h - Abandoned iCalendar parsing
- tui_view.cpp/h - Separate UI implementation

Build System:
- Simplified Makefile to CMake wrapper
- Added install target to CMakeLists.txt
- Improved .gitignore for build artifacts
- Removed Chinese comments, replaced with English

Code Simplification:
- Removed unimplemented features:
  * VISUAL/VISUAL_LINE modes (no actual functionality)
  * YANK action (copy not implemented)
  * Tab support (NEXT_TAB, PREV_TAB, etc.)
  * TOGGLE_MOUSE (mouse always enabled)
- Removed process_visual_mode() function (~36 lines)
- Removed gt/gT keybindings for tabs
- Updated help text to remove placeholders

HTML Entity Decoding:
- Made entity list static const (performance)
- Added numeric entity support ({, «)
- Added UTF-8 encoding for decoded entities
- Cleaner, more complete implementation

This brings the browser closer to Unix principles:
- Do one thing well (browse, don't manage calendar)
- Keep it simple (removed over-engineered features)
- Clear, focused codebase (2,058 LOC vs 3,745)

Build tested successfully with only minor warnings.
2025-12-17 15:39:23 +08:00

41 lines
913 B
CMake

cmake_minimum_required(VERSION 3.15)
project(TUT VERSION 1.0 LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Prefer wide character support (ncursesw)
set(CURSES_NEED_WIDE TRUE)
# macOS: Use Homebrew ncurses if available
if(APPLE)
set(CMAKE_PREFIX_PATH "/opt/homebrew/opt/ncurses" ${CMAKE_PREFIX_PATH})
endif()
find_package(Curses REQUIRED)
find_package(CURL REQUIRED)
# Executable
add_executable(tut
src/main.cpp
src/http_client.cpp
src/html_parser.cpp
src/text_renderer.cpp
src/input_handler.cpp
src/browser.cpp
)
target_include_directories(tut PRIVATE ${CURSES_INCLUDE_DIR})
target_link_libraries(tut PRIVATE ${CURSES_LIBRARIES} CURL::libcurl)
# Compiler warnings
target_compile_options(tut PRIVATE
-Wall -Wextra -Wpedantic
$<$<CONFIG:RELEASE>:-O2>
$<$<CONFIG:DEBUG>:-g -O0>
)
# Installation
install(TARGETS tut DESTINATION bin)