From 57d44cd455b4d4ba80a05aa7149727b26ef5b35a Mon Sep 17 00:00:00 2001 From: Dmitry Sapozhnikov <11535558+o-sdn-o@users.noreply.github.com> Date: Sun, 28 Jun 2026 16:42:11 +0500 Subject: [PATCH 1/7] #944: Sync harfbuzz with freetype when fetching via cmake --- CMakeLists.txt | 29 +++++++++++++++++++++++------ doc/build.md | 17 +++++++++++------ 2 files changed, 34 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 77f4877272..86f08d02a1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,16 +29,17 @@ elseif (CMAKE_CXX_COMPILER_ID MATCHES "GNU") target_compile_options(vtm PRIVATE -fconstexpr-loop-limit=100000000) endif() +find_package(Lua 5.4 REQUIRED) find_package(Freetype 2.13.2 QUIET) -find_package(harfbuzz REQUIRED) -find_package(Lua 5.4 REQUIRED) -find_package(lunasvg QUIET) -find_package(Stb QUIET) +find_package(harfbuzz QUIET) +find_package(lunasvg QUIET) +find_package(Stb QUIET) -if(Freetype_FOUND) +if(Freetype_FOUND AND harfbuzz_FOUND) message(STATUS "Suitable FreeType found via find_package: ${FREETYPE_VERSION_STRING}") + message(STATUS "Suitable HarfBuzz found via find_package: ${harfbuzz_VERSION}") else() - message(STATUS "Suitable FreeType NOT found (min 2.13.2 required). Downloading via FetchContent...") + message(STATUS "FreeType or HarfBuzz not found/outdated (FT 2.13.2 and HB 12.2.0 required). Downloading both via FetchContent...") set(FT_WITH_ZLIB OFF CACHE BOOL "" FORCE) set(FT_WITH_BZIP2 OFF CACHE BOOL "" FORCE) set(FT_WITH_PNG OFF CACHE BOOL "" FORCE) @@ -50,8 +51,24 @@ else() if(NOT TARGET Freetype::Freetype) add_library(Freetype::Freetype ALIAS freetype) endif() + set(HB_HAVE_FREETYPE ON CACHE BOOL "" FORCE) + set(HB_BUILD_TESTS OFF CACHE BOOL "" FORCE) + set(HB_BUILD_UTILS OFF CACHE BOOL "" FORCE) + set(HB_HAVE_GOBJECT OFF CACHE BOOL "" FORCE) + set(HB_HAVE_INTROSPECTION OFF CACHE BOOL "" FORCE) + set(HB_BUILD_DOCS OFF CACHE BOOL "" FORCE) + set(HB_BUILD_SUBSET OFF CACHE BOOL "" FORCE) + FetchContent_Declare(harfbuzz + GIT_REPOSITORY https://github.com/harfbuzz/harfbuzz.git + GIT_TAG 12.2.0) + FetchContent_MakeAvailable(harfbuzz) + if(NOT TARGET harfbuzz::harfbuzz) + add_library(harfbuzz::harfbuzz ALIAS harfbuzz) + endif() set(FREETYPE_INCLUDE_DIRS "${freetype_SOURCE_DIR}/include" "${freetype_BINARY_DIR}/include") + set(HARFBUZZ_INCLUDE_DIRS "${harfbuzz_SOURCE_DIR}/src" + "${harfbuzz_BINARY_DIR}/src") endif() if(lunasvg_FOUND) diff --git a/doc/build.md b/doc/build.md index bff467b5c3..d922a7f617 100644 --- a/doc/build.md +++ b/doc/build.md @@ -8,24 +8,29 @@ Build-time dependencies - `C++20 compiler`: [GCC 12](https://gcc.gnu.org/projects/cxx-status.html) or [Clang 16](https://clang.llvm.org/cxx_status.html) - `cmake` (minimum version v3.22) - `git` - - `FreeType` (minimum version v2.13.2, will be fetched automatically via CMake if not found) - - `HarfBuzz` + - `FreeType` (minimum version v2.13.2) + - `HarfBuzz` (minimum version v12.2.0) - `Lua` (minimum version v5.4) - - `LunaSVG` (Will be built automatically from source via CMake if not found in the system) - - `stb` (Will be fetched automatically via CMake if not found) + - `LunaSVG` + - `stb` + +Note: +- `FreeType`/`HarfBuzz`/`LunaSVG`/`stb` will be fetched automatically via CMake if not found in the system. Examples of installing dependencies: OS | Dependency installation command | Notes --------|---------------------------------|------ -Linux | `sudo apt install libfreetype-dev libharfbuzz-dev liblua5.4-dev git cmake` | `stb` and `LunaSVG` are managed automatically during CMake configuration. +Linux | `sudo apt install libfreetype-dev libharfbuzz-dev liblua5.4-dev git cmake` FreeBSD | `pkg install freetype2 harfbuzz lua54 cmake` | Best results with GCC compiler and 6GB of RAM. -MacOS | `brew install freetype harfbuzz lua cmake` +macOS | `brew install freetype harfbuzz lua cmake` Use any terminal as a build environment ``` git clone https://github.com/directvt/vtm.git +# Specify required compiler if needed: +#export CXX=/usr/bin/g++-12 cd vtm cmake . -B bin cmake --build bin From f36a1bbcbe4cb3ead1fde93374b55fb2e4d7d07c Mon Sep 17 00:00:00 2001 From: Dmitry Sapozhnikov <11535558+o-sdn-o@users.noreply.github.com> Date: Sun, 28 Jun 2026 17:31:37 +0500 Subject: [PATCH 2/7] #944: Sync harfbuzz with freetype when fetching via cmake --- CMakeLists.txt | 17 ++++++++---- doc/build.md | 72 +++++++++++++++++++++++++++++--------------------- 2 files changed, 54 insertions(+), 35 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 86f08d02a1..762a615fbd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,7 +31,7 @@ endif() find_package(Lua 5.4 REQUIRED) find_package(Freetype 2.13.2 QUIET) -find_package(harfbuzz QUIET) +find_package(harfbuzz 12.2.0 QUIET) find_package(lunasvg QUIET) find_package(Stb QUIET) @@ -40,6 +40,10 @@ if(Freetype_FOUND AND harfbuzz_FOUND) message(STATUS "Suitable HarfBuzz found via find_package: ${harfbuzz_VERSION}") else() message(STATUS "FreeType or HarfBuzz not found/outdated (FT 2.13.2 and HB 12.2.0 required). Downloading both via FetchContent...") + + unset(Freetype_FOUND CACHE) + unset(harfbuzz_FOUND CACHE) + set(FT_WITH_ZLIB OFF CACHE BOOL "" FORCE) set(FT_WITH_BZIP2 OFF CACHE BOOL "" FORCE) set(FT_WITH_PNG OFF CACHE BOOL "" FORCE) @@ -51,6 +55,7 @@ else() if(NOT TARGET Freetype::Freetype) add_library(Freetype::Freetype ALIAS freetype) endif() + set(HB_HAVE_FREETYPE ON CACHE BOOL "" FORCE) set(HB_BUILD_TESTS OFF CACHE BOOL "" FORCE) set(HB_BUILD_UTILS OFF CACHE BOOL "" FORCE) @@ -58,6 +63,9 @@ else() set(HB_HAVE_INTROSPECTION OFF CACHE BOOL "" FORCE) set(HB_BUILD_DOCS OFF CACHE BOOL "" FORCE) set(HB_BUILD_SUBSET OFF CACHE BOOL "" FORCE) + set(Freetype_DIR "${freetype_BINARY_DIR}" CACHE PATH "" FORCE) + set(FREETYPE_INCLUDE_DIR_ft2build "${freetype_SOURCE_DIR}/include" CACHE PATH "" FORCE) + set(FREETYPE_INCLUDE_DIR_freetype2 "${freetype_SOURCE_DIR}/include" CACHE PATH "" FORCE) FetchContent_Declare(harfbuzz GIT_REPOSITORY https://github.com/harfbuzz/harfbuzz.git GIT_TAG 12.2.0) @@ -65,10 +73,9 @@ else() if(NOT TARGET harfbuzz::harfbuzz) add_library(harfbuzz::harfbuzz ALIAS harfbuzz) endif() - set(FREETYPE_INCLUDE_DIRS "${freetype_SOURCE_DIR}/include" - "${freetype_BINARY_DIR}/include") - set(HARFBUZZ_INCLUDE_DIRS "${harfbuzz_SOURCE_DIR}/src" - "${harfbuzz_BINARY_DIR}/src") + + set(FREETYPE_INCLUDE_DIRS "${freetype_SOURCE_DIR}/include" "${freetype_BINARY_DIR}/include") + set(HARFBUZZ_INCLUDE_DIRS "${harfbuzz_SOURCE_DIR}/src" "${harfbuzz_BINARY_DIR}/src") endif() if(lunasvg_FOUND) diff --git a/doc/build.md b/doc/build.md index d922a7f617..00734c6f0e 100644 --- a/doc/build.md +++ b/doc/build.md @@ -4,34 +4,40 @@ ### Unix -Build-time dependencies - - `C++20 compiler`: [GCC 12](https://gcc.gnu.org/projects/cxx-status.html) or [Clang 16](https://clang.llvm.org/cxx_status.html) - - `cmake` (minimum version v3.22) - - `git` - - `FreeType` (minimum version v2.13.2) - - `HarfBuzz` (minimum version v12.2.0) - - `Lua` (minimum version v5.4) - - `LunaSVG` - - `stb` +#### Required System Dependencies -Note: -- `FreeType`/`HarfBuzz`/`LunaSVG`/`stb` will be fetched automatically via CMake if not found in the system. +- `C++20 compiler`: [GCC 12+](https://gcc.gnu.org/projects/cxx-status.html) or [Clang 16+](https://clang.llvm.org/cxx_status.html) +- `CMake` (minimum version v3.22) +- `Git` +- `Lua` (minimum version v5.4) -Examples of installing dependencies: +#### Optional Dependencies -OS | Dependency installation command | Notes ---------|---------------------------------|------ -Linux | `sudo apt install libfreetype-dev libharfbuzz-dev liblua5.4-dev git cmake` -FreeBSD | `pkg install freetype2 harfbuzz lua54 cmake` | Best results with GCC compiler and 6GB of RAM. -macOS | `brew install freetype harfbuzz lua cmake` +The following libraries are required but will be automatically downloaded and built via CMake if they are missing or outdated in your system: +- `FreeType` (minimum version v2.13.2) +- `HarfBuzz` (minimum version v12.2.0) +- `LunaSVG` (minimum version v3.5.0) +- `stb` -Use any terminal as a build environment +#### Examples of installing system dependencies: -``` +OS | Dependency installation command | Notes +-----------------------|---------------------------------|--- + Linux (Ubuntu/Debian) | `sudo apt install liblua5.4-dev git cmake build-essential` | Uses FetchContent for FreeType/HarfBuzz on older distros. + FreeBSD | `pkg install lua54 cmake git` | Best results with GCC compiler and 6GB of RAM. + macOS | `brew install lua cmake git` + +#### Build Steps + +Run the following commands in your terminal: + +```bash git clone https://github.com/directvt/vtm.git -# Specify required compiler if needed: -#export CXX=/usr/bin/g++-12 cd vtm + +# Specify the required compiler if needed: +# export CXX=/usr/bin/g++-12 + cmake . -B bin cmake --build bin sudo cmake --install bin @@ -39,17 +45,18 @@ vtm ``` > Installation Note: -> - By default, files are installed to system directories (e.g., `/usr/local/bin/`). If you want to install vtm to a user directory without using sudo (e.g., `$HOME/.local/`; ensure that this directory is added to your $PATH), use the `CMAKE_INSTALL_PREFIX` flag during the cmake configuration step: -> ```bash -> cmake . -B bin -DCMAKE_INSTALL_PREFIX=$HOME/.local -> cmake --build bin -> cmake --install bin -> ``` +> - By default, files are installed to system directories (e.g., `/usr/local/bin/`). If you want to install `vtm` to a user directory without using `sudo` (e.g., `$HOME/.local/bin/`), specify the `CMAKE_INSTALL_PREFIX` flag during the configuration step. Ensure that this directory is added to your `$PATH`: +> ```bash +> cmake . -B bin -DCMAKE_INSTALL_PREFIX=\$HOME/.local +> cmake --build bin +> cmake --install bin +> ``` ### Windows -Build-time dependencies - - [MSVC](https://visualstudio.microsoft.com/downloads/) +#### Build-time Dependencies + + - [`Visual Studio 2022`](https://visualstudio.microsoft.com/downloads/) with the following workloads enabled: - Desktop Development with C++ - C++ CMake tools for Windows - Git for Windows @@ -61,4 +68,9 @@ Build-time dependencies - `LunaSVG` - `stb` -To manually compile vtm, launch Visual Studio and clone the repository https://github.com/directvt/vtm.git, after cloning is complete, double-click on the Folder View in Solution Explorer, wait for the dependencies to initialize (may take several minutes), select the required configuration on the top menu toolbar, and click the `Build All` menu button. \ No newline at end of file +#### Build Steps + +- Launch Visual Studio and clone the repository: `https://github.com/directvt/vtm`. +- Wait for the CMake generation and dependencies initialization to complete (this may take several minutes). +- Select your target build configuration (e.g., `1.Win-x64-Debug` or `PROD-Win-x64`) from the top toolbar configuration dropdown. +- Open the `Build` menu and click `Build All`. From 03f341f6661e671a13190988846e3469a86f3e96 Mon Sep 17 00:00:00 2001 From: Dmitry Sapozhnikov <11535558+o-sdn-o@users.noreply.github.com> Date: Sun, 28 Jun 2026 19:55:03 +0500 Subject: [PATCH 3/7] #944: Fix cmake 4.x compatibility for freetype fetch --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 762a615fbd..6c666e5422 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,6 +5,7 @@ project("vtm" CXX) # project("term") # project("calc") +set(CMAKE_POLICY_VERSION_MINIMUM "3.5" CACHE STRING "" FORCE) set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) From 3aae30f799f7bd31d4ade53cb6fdec9466305df2 Mon Sep 17 00:00:00 2001 From: Dmitry Sapozhnikov <11535558+o-sdn-o@users.noreply.github.com> Date: Sun, 28 Jun 2026 22:04:14 +0500 Subject: [PATCH 4/7] #944: Make lua fetched automatically via cmake if not found --- CMakeLists.txt | 41 +++++++++++++++++++++++++++++++++++++---- doc/build.md | 12 ++++++------ 2 files changed, 43 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6c666e5422..46644e008e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,12 +30,48 @@ elseif (CMAKE_CXX_COMPILER_ID MATCHES "GNU") target_compile_options(vtm PRIVATE -fconstexpr-loop-limit=100000000) endif() -find_package(Lua 5.4 REQUIRED) +find_package(Lua 5.4 QUIET) find_package(Freetype 2.13.2 QUIET) find_package(harfbuzz 12.2.0 QUIET) find_package(lunasvg QUIET) find_package(Stb QUIET) +if(Lua_FOUND) + message(STATUS "Suitable Lua found via find_package: ${LUA_VERSION_STRING}") + if(NOT TARGET Lua::Lua) + add_library(Lua::Lua INTERFACE IMPORTED) + set_target_properties(Lua::Lua PROPERTIES INTERFACE_LINK_LIBRARIES "${LUA_LIBRARIES}") + set(LUA_INCLUDE_DIR "${LUA_INCLUDE_DIR}") + endif() +else() + message(STATUS "Lua 5.4 NOT found in the system. Downloading clean source from lua.org...") + if(POLICY CMP0135) + cmake_policy(SET CMP0135 NEW) + endif() + FetchContent_Declare(lua_source + URL https://www.lua.org/ftp/lua-5.4.8.tar.gz + URL_HASH SHA256=4f18ddae154e793e46eeab727c59ef1c0c0c2b744e7b94219710d76f530629ae + SOURCE_SUBDIR "DONOTEXIST") + FetchContent_MakeAvailable(lua_source) + set(LUA_CUSTOM_CMAKE "${lua_source_BINARY_DIR}/CMakeLists.txt") + file(WRITE "${LUA_CUSTOM_CMAKE}" [====[ + cmake_minimum_required(VERSION 3.22) + project(lua C) + file(GLOB LUA_CORE_SRC "src/*.c") + list(REMOVE_ITEM LUA_CORE_SRC "${CMAKE_CURRENT_SOURCE_DIR}/src/lua.c" "${CMAKE_CURRENT_SOURCE_DIR}/src/luac.c") + add_library(lua STATIC ${LUA_CORE_SRC}) + target_include_directories(lua PUBLIC src) + target_compile_definitions(lua PRIVATE LUA_USE_DLOPEN=0 LUA_DL_DLL=0 LUA_DL_DLOPEN=0) + ]====]) + file(COPY "${LUA_CUSTOM_CMAKE}" DESTINATION "${lua_source_SOURCE_DIR}") + add_subdirectory("${lua_source_SOURCE_DIR}" "${lua_source_BINARY_DIR}") + + if(NOT TARGET Lua::Lua) + add_library(Lua::Lua ALIAS lua) + endif() + set(LUA_INCLUDE_DIR "${lua_source_SOURCE_DIR}/src") +endif() + if(Freetype_FOUND AND harfbuzz_FOUND) message(STATUS "Suitable FreeType found via find_package: ${FREETYPE_VERSION_STRING}") message(STATUS "Suitable HarfBuzz found via find_package: ${harfbuzz_VERSION}") @@ -113,9 +149,6 @@ else() add_library(stb::stb ALIAS stb_interface) endif() -add_library(Lua::Lua INTERFACE IMPORTED) -set_target_properties(Lua::Lua PROPERTIES INTERFACE_LINK_LIBRARIES "${LUA_LIBRARIES}") - target_include_directories(vtm PRIVATE ${FREETYPE_INCLUDE_DIRS} ${HARFBUZZ_INCLUDE_DIRS} ${LUA_INCLUDE_DIR}) diff --git a/doc/build.md b/doc/build.md index 00734c6f0e..e194353f2f 100644 --- a/doc/build.md +++ b/doc/build.md @@ -9,7 +9,6 @@ - `C++20 compiler`: [GCC 12+](https://gcc.gnu.org/projects/cxx-status.html) or [Clang 16+](https://clang.llvm.org/cxx_status.html) - `CMake` (minimum version v3.22) - `Git` -- `Lua` (minimum version v5.4) #### Optional Dependencies @@ -17,15 +16,16 @@ The following libraries are required but will be automatically downloaded and bu - `FreeType` (minimum version v2.13.2) - `HarfBuzz` (minimum version v12.2.0) - `LunaSVG` (minimum version v3.5.0) +- `Lua` (minimum version v5.4) - `stb` #### Examples of installing system dependencies: -OS | Dependency installation command | Notes ------------------------|---------------------------------|--- - Linux (Ubuntu/Debian) | `sudo apt install liblua5.4-dev git cmake build-essential` | Uses FetchContent for FreeType/HarfBuzz on older distros. - FreeBSD | `pkg install lua54 cmake git` | Best results with GCC compiler and 6GB of RAM. - macOS | `brew install lua cmake git` +OS | Dependency installation command | Notes +-----------------------|----------------------------------------------|------ + Linux (Ubuntu/Debian) | `sudo apt install git cmake build-essential` | + FreeBSD | `pkg install lua54 cmake git` | Best results with GCC compiler and 6GB of RAM. + macOS | `brew install lua cmake git` | #### Build Steps From b26beb3f68890c5b644e8d97628942fad627c564 Mon Sep 17 00:00:00 2001 From: Dmitry Sapozhnikov <11535558+o-sdn-o@users.noreply.github.com> Date: Sun, 28 Jun 2026 22:05:35 +0500 Subject: [PATCH 5/7] v2026.06.29 --- src/netxs/desktopio/application.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/netxs/desktopio/application.hpp b/src/netxs/desktopio/application.hpp index 189dbb06c7..05e028c8c0 100644 --- a/src/netxs/desktopio/application.hpp +++ b/src/netxs/desktopio/application.hpp @@ -22,7 +22,7 @@ namespace netxs::app namespace netxs::app::shared { - static const auto version = "v2026.06.28"; + static const auto version = "v2026.06.29"; static const auto repository = "https://github.com/directvt/vtm"; static const auto usr_config = "~/.config/vtm/settings.xml"s; static const auto sys_config = "/etc/vtm/settings.xml"s; From 12221ef599ed48236bfb8c0a7e07d991caf12869 Mon Sep 17 00:00:00 2001 From: Dmitry Sapozhnikov <11535558+o-sdn-o@users.noreply.github.com> Date: Sun, 28 Jun 2026 23:10:53 +0500 Subject: [PATCH 6/7] Fix builds with vcpkg --- CMakeLists.txt | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 46644e008e..4de97d8828 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,12 +30,27 @@ elseif (CMAKE_CXX_COMPILER_ID MATCHES "GNU") target_compile_options(vtm PRIVATE -fconstexpr-loop-limit=100000000) endif() -find_package(Lua 5.4 QUIET) -find_package(Freetype 2.13.2 QUIET) -find_package(harfbuzz 12.2.0 QUIET) +find_package(Freetype CONFIG QUIET) +find_package(harfbuzz CONFIG QUIET) find_package(lunasvg QUIET) find_package(Stb QUIET) +if(NOT Freetype_FOUND) + find_package(Freetype 2.13.2 QUIET) +endif() +if(NOT harfbuzz_FOUND) + find_package(harfbuzz 12.2.0 QUIET) +endif() +if(WIN32 OR VCPKG_TOOLCHAIN) + message(STATUS "Windows/vcpkg environment detected. Using built-in Lua target.") + if(NOT TARGET Lua::Lua AND TARGET lua) + add_library(Lua::Lua ALIAS lua) + endif() + set(Lua_FOUND TRUE) +else() + find_package(Lua 5.4 QUIET) +endif() + if(Lua_FOUND) message(STATUS "Suitable Lua found via find_package: ${LUA_VERSION_STRING}") if(NOT TARGET Lua::Lua) From adfe852c740ea44e2d3386a090881fd8b8155c1c Mon Sep 17 00:00:00 2001 From: Dmitry Sapozhnikov <11535558+o-sdn-o@users.noreply.github.com> Date: Mon, 29 Jun 2026 00:50:59 +0500 Subject: [PATCH 7/7] Try to fix ga builds --- CMakeLists.txt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4de97d8828..335dddfcd4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -43,9 +43,7 @@ if(NOT harfbuzz_FOUND) endif() if(WIN32 OR VCPKG_TOOLCHAIN) message(STATUS "Windows/vcpkg environment detected. Using built-in Lua target.") - if(NOT TARGET Lua::Lua AND TARGET lua) - add_library(Lua::Lua ALIAS lua) - endif() + find_package(Lua 5.4 REQUIRED) set(Lua_FOUND TRUE) else() find_package(Lua 5.4 QUIET)