diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index de9e29d9ac..a6fd3cc875 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,12 +13,12 @@ jobs: strategy: fail-fast: false matrix: - os: [ windows-latest, ubuntu-22.04 ] + os: [ windows-2022, ubuntu-22.04 ] cpu: [ x64, x86, arm64, arm ] exclude: - - os: windows-latest + - os: windows-2022 cpu: x86 - - os: windows-latest + - os: windows-2022 cpu: arm include: @@ -38,20 +38,20 @@ jobs: cc: gcc-13 flags: '-DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 -DCMAKE_CXX_FLAGS_RELEASE="-static-libgcc -static-libstdc++ -s -DNDEBUG -Wall -Wextra -Wno-missing-field-initializers -Wno-psabi -Werror -Wno-unknown-pragmas"' triplet: x64-osx - - os: windows-latest + - os: windows-2022 platform: windows cpu: Win32 arch: x86 cxx: cl cc: cl - flags: '-DCMAKE_MSVC_RUNTIME_LIBRARY="MultiThreaded" -DCMAKE_EXE_LINKER_FLAGS_RELEASE="/DEBUG /OPT:REF /OPT:ICF" -DCMAKE_CXX_FLAGS_RELEASE="/MT /O2 /DNDEBUG /Zi /Zc:preprocessor /W4 /EHsc /bigobj /utf-8 /Zc:preprocessor" -A ' + flags: '-DCMAKE_MSVC_RUNTIME_LIBRARY="MultiThreaded" -DCMAKE_EXE_LINKER_FLAGS_RELEASE="/DEBUG /OPT:REF /OPT:ICF" -DCMAKE_CXX_FLAGS_RELEASE="/MT /O2 /DNDEBUG /Zi /Zc:preprocessor /W4 /EHsc /bigobj /utf-8 /constexpr:steps 10000000" -A ' triplet: x86-windows-static - - os: windows-latest + - os: windows-2022 cxx: cl - - os: windows-latest + - os: windows-2022 cpu: x64 triplet: x64-windows-static - - os: windows-latest + - os: windows-2022 cpu: arm64 triplet: arm64-windows-static - os: ubuntu-22.04 @@ -84,12 +84,12 @@ jobs: - os: ubuntu-22.04 flags: '-DCMAKE_CXX_FLAGS_RELEASE="-static -s -DNDEBUG -Wall -Wextra -Wno-missing-field-initializers -Wno-psabi -Werror -Wno-unknown-pragmas"' - - os: windows-latest - flags: '-DCMAKE_MSVC_RUNTIME_LIBRARY="MultiThreaded" -DCMAKE_EXE_LINKER_FLAGS_RELEASE="/DEBUG /OPT:REF /OPT:ICF" -DCMAKE_CXX_FLAGS_RELEASE="/MT /O2 /DNDEBUG /Zi /Zc:preprocessor /W4 /EHsc /bigobj /utf-8 /Zc:preprocessor" -A ' + - os: windows-2022 + flags: '-DCMAKE_MSVC_RUNTIME_LIBRARY="MultiThreaded" -DCMAKE_EXE_LINKER_FLAGS_RELEASE="/DEBUG /OPT:REF /OPT:ICF" -DCMAKE_CXX_FLAGS_RELEASE="/MT /O2 /DNDEBUG /Zi /Zc:preprocessor /W4 /EHsc /bigobj /utf-8 /constexpr:steps 10000000" -A ' - os: ubuntu-22.04 platform: linux - - os: windows-latest + - os: windows-2022 platform: windows - cpu: x64 @@ -117,13 +117,13 @@ jobs: sudo apt -y install ${{ matrix.apt }} - name: Clone and Bootstrap vcpkg (Windows) - if: matrix.os == 'windows-latest' + if: matrix.os == 'windows-2022' run: | git clone https://github.com/microsoft/vcpkg.git ${{ github.workspace }}/vcpkg ${{ github.workspace }}/vcpkg/bootstrap-vcpkg.bat -disableMetrics - name: Clone and Bootstrap vcpkg (POSIX) - if: matrix.os != 'windows-latest' + if: matrix.os != 'windows-2022' run: | git clone https://github.com/microsoft/vcpkg.git ${{ github.workspace }}/vcpkg ${{ github.workspace }}/vcpkg/bootstrap-vcpkg.sh -disableMetrics @@ -142,41 +142,41 @@ jobs: VCPKG_BINARY_SOURCES: "clear;files,${{ github.workspace }}/vcpkg_cache,readwrite" VCPKG_BUILD_TYPE: release MACOSX_DEPLOYMENT_TARGET: 11.0 - WIN32_RESOURCES: ${{ matrix.os == 'windows-latest' && '.resources/images/vtm.rc' || '' }} + WIN32_RESOURCES: ${{ matrix.os == 'windows-2022' && '.resources/images/vtm.rc' || '' }} run: | pwsh -Command "if (!(Test-Path '${{ github.workspace }}/vcpkg_cache')) { New-Item -ItemType Directory -Force -Path '${{ github.workspace }}/vcpkg_cache' }" - cmake -B ${{ steps.strings.outputs.bin }} -DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=${{ matrix.triplet }} ${{ matrix.flags }} ${{ matrix.os == 'windows-latest' && matrix.cpu || '' }} -DVCPKG_BUILD_TYPE=release -DCMAKE_BUILD_TYPE=Release -S ${{ github.workspace }} + cmake -B ${{ steps.strings.outputs.bin }} -DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=${{ matrix.triplet }} ${{ matrix.flags }} ${{ matrix.os == 'windows-2022' && matrix.cpu || '' }} -DVCPKG_BUILD_TYPE=release -DCMAKE_BUILD_TYPE=Release -S ${{ github.workspace }} - name: Build run: cmake --build ${{ steps.strings.outputs.bin }} --config Release -v - name: Pack (POSIX) - if: matrix.os != 'windows-latest' + if: matrix.os != 'windows-2022' run: | 7z a -ttar vtm_${{ matrix.platform }}_${{ matrix.arch }}.tar ${{ steps.strings.outputs.bin }}/vtm 7z a -mx9 -stl -y -r -t7z vtm_${{ matrix.platform }}_${{ matrix.arch }}.tar.7z vtm_${{ matrix.platform }}_${{ matrix.arch }}.tar - name: Pack (Windows) - if: matrix.os == 'windows-latest' + if: matrix.os == 'windows-2022' run: | 7z a -ssp -mx9 -stl -y -r -t7z vtm_${{ matrix.platform }}_${{ matrix.arch }}.7z ${{ steps.strings.outputs.bin }}/Release/vtm.exe - name: Upload Artifact (POSIX) - if: matrix.os != 'windows-latest' + if: matrix.os != 'windows-2022' uses: actions/upload-artifact@main with: name: vtm_${{ matrix.platform }}_${{ matrix.arch }} path: vtm_${{ matrix.platform }}_${{ matrix.arch }}.tar.7z - name: Upload Symbols (Windows) - if: matrix.os == 'windows-latest' + if: matrix.os == 'windows-2022' uses: actions/upload-artifact@main with: name: vtm_pdb_${{ matrix.platform }}_${{ matrix.arch }} path: ${{ steps.strings.outputs.bin }}/Release/vtm.pdb - name: Upload Artifact (Windows) - if: matrix.os == 'windows-latest' + if: matrix.os == 'windows-2022' uses: actions/upload-artifact@main with: name: vtm_${{ matrix.platform }}_${{ matrix.arch }} diff --git a/CMakeLists.txt b/CMakeLists.txt index a74fa44fa3..01be967ccc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,20 +24,50 @@ add_executable(vtm "src/vtm.cpp" $ENV{WIN32_RESOURCES}) find_package(Freetype REQUIRED) find_package(harfbuzz REQUIRED) find_package(Lua 5.4 REQUIRED) -find_package(lunasvg REQUIRED) -find_path(STB_INCLUDE_DIR "stb_image.h") +find_package(lunasvg QUIET) +find_package(Stb QUIET) + +if(lunasvg_FOUND) + message(STATUS "LunaSVG found via find_package.") +else() + message(STATUS "LunaSVG not found. Downloading via FetchContent...") + set(LUNASVG_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE) + set(LUNASVG_BUILD_TOOLS OFF CACHE BOOL "" FORCE) + FetchContent_Declare(lunasvg + GIT_REPOSITORY https://github.com/sammycage/lunasvg.git + GIT_TAG v3.5.0) + FetchContent_MakeAvailable(lunasvg) + add_library(lunasvg::lunasvg ALIAS lunasvg) +endif() + +if(Stb_FOUND) + message(STATUS "stb found via find_package.") + if(NOT TARGET stb::stb) + add_library(stb_interface INTERFACE) + target_include_directories(stb_interface INTERFACE ${Stb_INCLUDE_DIR}) + add_library(stb::stb ALIAS stb_interface) + endif() +else() + message(STATUS "stb not found. Downloading via FetchContent...") + FetchContent_Declare(stb + GIT_REPOSITORY https://github.com/nothings/stb + GIT_TAG master) + FetchContent_MakeAvailable(stb) + add_library(stb_interface INTERFACE) + target_include_directories(stb_interface INTERFACE ${stb_SOURCE_DIR}) + 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} - ${STB_INCLUDE_DIR}) + ${LUA_INCLUDE_DIR}) -target_link_libraries(vtm PRIVATE Lua::Lua Freetype::Freetype harfbuzz::harfbuzz lunasvg::lunasvg) -# target_link_libraries(term PRIVATE Lua::Lua Freetype::Freetype harfbuzz::harfbuzz lunasvg::lunasvg) -# target_link_libraries(calc PRIVATE Lua::Lua Freetype::Freetype harfbuzz::harfbuzz lunasvg::lunasvg) +target_link_libraries(vtm PRIVATE Lua::Lua Freetype::Freetype harfbuzz::harfbuzz lunasvg::lunasvg stb::stb) +# target_link_libraries(term PRIVATE Lua::Lua Freetype::Freetype harfbuzz::harfbuzz lunasvg::lunasvg stb::stb) +# target_link_libraries(calc PRIVATE Lua::Lua Freetype::Freetype harfbuzz::harfbuzz lunasvg::lunasvg stb::stb) if(NOT WIN32) install(TARGETS vtm DESTINATION bin) diff --git a/CMakeSettings.json b/CMakeSettings.json index 2e7d8e3251..aee0142540 100644 --- a/CMakeSettings.json +++ b/CMakeSettings.json @@ -5,7 +5,8 @@ // /bigobj Our event model spawns a large number of objects. By default, an object file can hold up to 65,279 (almost 2^16) addressable sections. This limit applies no matter which target platform is specified. /bigobj increases that address capacity to 4,294,967,296 (2^32). // /utf-8 All literals in our source code are in UTF-8 format. // /Zc:preprocessor Enable a new, modern preprocessor that is fully conformant to C99, C++11, and later standards. - "WIN32_CXX_FLAGS": "/EHsc /bigobj /utf-8 /Zc:preprocessor", + // /constexpr:steps Increase the constexpr evaluation limit. + "WIN32_CXX_FLAGS": "/EHsc /bigobj /utf-8 /Zc:preprocessor /constexpr:steps 10000000", // /MTd Static debug build (don't rely on the shared dlls). // /DDEBUG Define the preprocessor symbol DEBUG. // /Zi Generate complete debugging information (.PDB files) to allow for source-level debugging in Visual Studio. diff --git a/doc/architecture.md b/doc/architecture.md index 7ffa800db4..c221f36fff 100644 --- a/doc/architecture.md +++ b/doc/architecture.md @@ -298,6 +298,7 @@ In Classic VT mode, a vtm process parses input from multiple standard sources an - SGR mouse reporting sequences `\x1b[ - @@ -1161,7 +1161,6 @@ Notes -