mirror of
https://github.com/m1ngsama/TUT.git
synced 2025-12-26 12:04:11 +00:00
Major improvements: - Add proper DOM tree structure (dom_tree.cpp/h) with hierarchical node representation - Refactor HTML parser to use DOM tree instead of flat ContentElement structure - Enhance text renderer with improved inline content handling and UTF-8 support - Improve browser interactive element tracking with byte-accurate positioning - Add comprehensive HTML entity decoding (80+ named entities + numeric) - Enhance form handling with better field tracking and submission Code quality improvements: - Fix all compiler warnings (unused parameters/variables) - Clean build with zero warnings - Better separation of concerns between parsing and rendering Testing: - Add test_table.html for table rendering verification This change enables better handling of complex HTML structures while maintaining the Unix philosophy of simplicity and focus.
58 lines
1.1 KiB
CMake
58 lines
1.1 KiB
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)
|
|
|
|
# Find gumbo-parser for HTML parsing
|
|
find_package(PkgConfig REQUIRED)
|
|
pkg_check_modules(GUMBO REQUIRED gumbo)
|
|
|
|
# Executable
|
|
add_executable(tut
|
|
src/main.cpp
|
|
src/http_client.cpp
|
|
src/dom_tree.cpp
|
|
src/html_parser.cpp
|
|
src/text_renderer.cpp
|
|
src/input_handler.cpp
|
|
src/browser.cpp
|
|
)
|
|
|
|
target_include_directories(tut PRIVATE
|
|
${CURSES_INCLUDE_DIR}
|
|
${GUMBO_INCLUDE_DIRS}
|
|
)
|
|
|
|
target_link_directories(tut PRIVATE
|
|
${GUMBO_LIBRARY_DIRS}
|
|
)
|
|
|
|
target_link_libraries(tut PRIVATE
|
|
${CURSES_LIBRARIES}
|
|
CURL::libcurl
|
|
${GUMBO_LIBRARIES}
|
|
)
|
|
|
|
# Compiler warnings
|
|
target_compile_options(tut PRIVATE
|
|
-Wall -Wextra -Wpedantic
|
|
$<$<CONFIG:RELEASE>:-O2>
|
|
$<$<CONFIG:DEBUG>:-g -O0>
|
|
)
|
|
|
|
# Installation
|
|
install(TARGETS tut DESTINATION bin)
|
|
|
|
|