From c46060cc9a728564ce23c220c5531d57f1991db2 Mon Sep 17 00:00:00 2001 From: PerdixOfMars Date: Sat, 28 Mar 2026 12:08:32 +0100 Subject: [PATCH 1/5] feat: add attributes for sane cross-platform line endings --- .gitattributes | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..7c73364 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,55 @@ +* text=auto eol=lf + +# Source and build files +*.c text eol=lf +*.cc text eol=lf +*.cpp text eol=lf +*.cxx text eol=lf +*.h text eol=lf +*.hh text eol=lf +*.hpp text eol=lf +*.hxx text eol=lf +*.inl text eol=lf +*.ipp text eol=lf +CMakeLists.txt text eol=lf +*.cmake text eol=lf +CMakePresets.json text eol=lf +CTestPresets.json text eol=lf + +# Project and config files +*.txt text eol=lf +*.md text eol=lf +*.json text eol=lf +*.yml text eol=lf +*.yaml text eol=lf +*.toml text eol=lf +*.ini text eol=lf +*.cfg text eol=lf +*.conf text eol=lf +*.clang-format text eol=lf +*.clang-tidy text eol=lf +*.clangd text eol=lf +.gitignore text eol=lf +.gitattributes text eol=lf +.gitmodules text eol=lf +.editorconfig text eol=lf +Dockerfile text eol=lf +Doxyfile.in text eol=lf + +# Scripts +*.sh text eol=lf +*.bash text eol=lf +*.py text eol=lf +*.bat text eol=crlf +*.cmd text eol=crlf +*.ps1 text eol=crlf + +# Binary assets +*.png binary +*.gif binary +*.jpg binary +*.jpeg binary +*.ico binary +*.zip binary +*.gz binary +*.7z binary From 3c391acbb94eca2e5f2980638e39e84208ad71db Mon Sep 17 00:00:00 2001 From: PerdixOfMars Date: Sat, 28 Mar 2026 12:21:32 +0000 Subject: [PATCH 2/5] Add transitive dependencies to CMake package config --- cmake/consolepp-config.cmake.in | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmake/consolepp-config.cmake.in b/cmake/consolepp-config.cmake.in index 7fca994..e244b9e 100644 --- a/cmake/consolepp-config.cmake.in +++ b/cmake/consolepp-config.cmake.in @@ -1,4 +1,8 @@ @PACKAGE_INIT@ +include(CMakeFindDependencyMacro) + +find_dependency(Boost 1.69.0) + include(${CMAKE_CURRENT_LIST_DIR}/consolepp-targets.cmake) check_required_components(consolepp) From b7c875775a1761e05719d0661139b2564ef77e2e Mon Sep 17 00:00:00 2001 From: PerdixOfMars Date: Sun, 29 Mar 2026 11:37:31 +0200 Subject: [PATCH 3/5] Generated files now generated in binary directory --- CMakeLists.txt | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 99432e3..d5833ae 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -69,12 +69,21 @@ endif() add_library(consolepp) add_library(KazDragon::consolepp ALIAS consolepp) +set(CONSOLEPP_GENERATED_INCLUDE_DIR + "${PROJECT_BINARY_DIR}/generated/include") +set(CONSOLEPP_GENERATED_EXPORT_HEADER + "${CONSOLEPP_GENERATED_INCLUDE_DIR}/consolepp/detail/export.hpp") +set(CONSOLEPP_GENERATED_VERSION_HEADER + "${CONSOLEPP_GENERATED_INCLUDE_DIR}/consolepp/version.hpp") + +file(MAKE_DIRECTORY "${CONSOLEPP_GENERATED_INCLUDE_DIR}/consolepp/detail") + target_sources(consolepp PRIVATE - include/consolepp/detail/export.hpp + ${CONSOLEPP_GENERATED_EXPORT_HEADER} include/consolepp/console.hpp include/consolepp/core.hpp - include/consolepp/version.hpp + ${CONSOLEPP_GENERATED_VERSION_HEADER} src/console.cpp ) @@ -86,6 +95,7 @@ target_link_libraries(consolepp target_include_directories(consolepp PUBLIC + $ $ $ ) @@ -117,12 +127,12 @@ target_compile_options(consolepp ) generate_export_header(consolepp - EXPORT_FILE_NAME "${PROJECT_SOURCE_DIR}/include/consolepp/detail/export.hpp" + EXPORT_FILE_NAME "${CONSOLEPP_GENERATED_EXPORT_HEADER}" ) configure_file( ${PROJECT_SOURCE_DIR}/include/consolepp/version.hpp.in - ${PROJECT_SOURCE_DIR}/include/consolepp/version.hpp + ${CONSOLEPP_GENERATED_VERSION_HEADER} @ONLY) include(GNUInstallDirs) @@ -178,6 +188,20 @@ install( ${CMAKE_INSTALL_INCLUDEDIR}/consolepp-${CONSOLEPP_VERSION} ) +install( + FILES + "${CONSOLEPP_GENERATED_EXPORT_HEADER}" + DESTINATION + ${CMAKE_INSTALL_INCLUDEDIR}/consolepp-${CONSOLEPP_VERSION}/consolepp/detail +) + +install( + FILES + "${CONSOLEPP_GENERATED_VERSION_HEADER}" + DESTINATION + ${CMAKE_INSTALL_INCLUDEDIR}/consolepp-${CONSOLEPP_VERSION}/consolepp +) + install( FILES "${CMAKE_CURRENT_BINARY_DIR}/consolepp-config.cmake" From 1f9e057ca9dfe672defb3c708eee596fdf680b4f Mon Sep 17 00:00:00 2001 From: PerdixOfMars Date: Sun, 29 Mar 2026 12:22:59 +0200 Subject: [PATCH 4/5] Adapt CI to use vcpkg for dependencies --- .github/workflows/build.yml | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index dfcdd4c..1d65fae 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,20 +17,21 @@ jobs: - build_type: Release env: - EXTERNAL_ROOT: /home/runner/3party BUILD_TYPE: ${{ matrix.build_type }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - - name: Install latest Boost - shell: bash - run: | - sudo apt-add-repository ppa:mhier/libboost-latest - sudo apt install libboost1.74-dev + - name: Setup vcpkg (with binary caching) + uses: lukka/run-vcpkg@v11 + with: + runVcpkgInstall: false + vcpkgDirectory: "${{ github.workspace }}/.vcpkg" + vcpkgGitCommitId: "58950f88544e4637524dbd6a01d0317cf4cb77fc" - - name: Install dependencies from source - run: .ci/fetch_system_dependencies.sh + - name: Install dependencies + shell: bash + run: $VCPKG_ROOT/vcpkg install boost-asio boost-signals2 boost-smart-ptr gtest - name: Create Build Environment run: cmake -E make_directory ${{runner.workspace}}/build @@ -38,7 +39,7 @@ jobs: - name: Configure CMake shell: bash working-directory: ${{runner.workspace}}/build - run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_PREFIX_PATH=$EXTERNAL_ROOT + run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_TOOLCHAIN_FILE=$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake - name: Build shell: bash @@ -48,7 +49,7 @@ jobs: - name: Test working-directory: ${{runner.workspace}}/build shell: bash - run: ctest -C $BUILD_TYPE + run: ctest -C $BUILD_TYPE --output-on-failure build-docs: runs-on: ubuntu-latest From b2d71f83146b01f4977a5b5c7523c680c7e16ce2 Mon Sep 17 00:00:00 2001 From: PerdixOfMars Date: Sun, 29 Mar 2026 12:30:42 +0200 Subject: [PATCH 5/5] Fix Threads::Threads dependency from gtest issue --- CMakeLists.txt | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d5833ae..ef510ec 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,11 +1,6 @@ -if (POLICY CMP0048) - cmake_policy(SET CMP0048 NEW) - project(CONSOLEPP VERSION 0.1.1) -else() - project(CONSOLEPP) -endif() - cmake_minimum_required(VERSION 3.22 FATAL_ERROR) +cmake_policy(VERSION 3.22) +project(CONSOLEPP VERSION 0.1.1) option(CONOSOLEPP_COVERAGE "Build with code coverage options") option(CONSOLEPP_SANITIZE "Build using sanitizers" "") @@ -45,12 +40,15 @@ set (CMAKE_EXPORT_COMPILE_COMMANDS ON) # If we are building with tests, then we require the GTest library if (${CONSOLEPP_WITH_TESTS}) - find_package(GTest REQUIRED) + find_package(GTest CONFIG REQUIRED) endif() # Console++ requires at least Boost 1.69. find_package(Boost 1.69.0 REQUIRED) +# GTest imported targets depend on Threads::Threads in this toolchain. +find_package(Threads REQUIRED) + # When building shared objects, etc., we only want to export certain symbols. # Therefore, we need to generate a header suitable for declaring which # symbols should be included. @@ -223,8 +221,8 @@ if (CONSOLEPP_WITH_TESTS) target_link_libraries(consolepp_tester PRIVATE consolepp - GTest::GTest - GTest::Main + GTest::gtest + GTest::gtest_main ) add_test(consolepp_test consolepp_tester)