git2wrapC++20 wrapper for libgit2 | 
          
| git clone git://git.dimitrijedobrota.com/git2wrap.git | 
| Log | Files | Refs | README | LICENSE | HACKING | CONTRIBUTING | CODE_OF_CONDUCT | BUILDING | 
| commit | 5426c1d26386c66ad73be96c6153bb179e361571 | 
| parent | 44c4919b203c5f0ba0e349daf034c8f36b634b3b | 
| author | Dimitrije Dobrota < mail@dimitrijedobrota.com > | 
| date | Sat, 3 May 2025 13:34:56 +0200 | 
Cleanup project files and vcpkg support
| M | BUILDING.md | | | ++++ | 
| M | CMakeLists.txt | | | + - | 
| M | CMakePresets.json | | | +++++++++++++++++++++++++++ ----------------------- | 
| M | HACKING.md | | | ++++++++++++ -------------------------- | 
| M | README.md | | | ++++ ------ | 
| M | cmake/coverage.cmake | | | +++++++ -- | 
| M | cmake/install-config.cmake | | | ++++++ - | 
| M | test/CMakeLists.txt | | | ++++++++++ -------- | 
| A | vcpkg-configuration.json | | | +++++++++++++++ | 
| A | vcpkg.json | | | +++++++++++++++++++++++ | 
10 files changed, 109 insertions(+), 67 deletions(-)
diff --git a/ BUILDING.md b/ BUILDING.md
@@ -1,5 +1,9 @@
# Building with CMake
          ## Dependencies
          For a list of dependencies, please refer to [vcpkg.json](vcpkg.json).
          ## Build
          This project doesn't require any special command-line flags to build to keep
        
        diff --git a/ CMakeLists.txt b/ CMakeLists.txt
          @@ -4,7 +4,7 @@ 
          include(cmake/prelude.cmake)
        
        
          project(
              git2wrap
              VERSION 0.2.1
              VERSION 0.3.0
              DESCRIPTION "C++ 20 wrapper for libgit2"
              HOMEPAGE_URL "https://git.dimitrijedobrota.com/git2wrap.git"
              LANGUAGES CXX
        
        diff --git a/ CMakePresets.json b/ CMakePresets.json
@@ -7,26 +7,25 @@
  },
            "configurePresets": [
              {
                "name": "cmake-pedantic",
                "name": "dev-mode",
                "hidden": true,
                "warnings": {
                  "dev": true,
                  "deprecated": true,
                  "uninitialized": true,
                  "unusedCli": true,
                  "systemVars": false
                },
                "errors": {
                  "dev": true,
                  "deprecated": true
                "cacheVariables": {
                  "git2wrap_DEVELOPER_MODE": "ON",
                  "VCPKG_MANIFEST_FEATURES": "test"
                }
              },
              {
                "name": "dev-mode",
                "name": "vcpkg",
                "hidden": true,
                "cacheVariables": {
                  "CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"
                }
              },
              {
                "name": "vcpkg-win64-static",
                "hidden": true,
                "inherits": "cmake-pedantic",
                "cacheVariables": {
                  "git2wrap_DEVELOPER_MODE": "ON"
                  "VCPKG_TARGET_TRIPLET": "x64-windows-static-md"
                }
              },
              {
        
        @@ -93,7 +92,10 @@
      "name": "ci-darwin",
                "inherits": ["flags-appleclang", "ci-std"],
                "generator": "Xcode",
                "hidden": true
                "hidden": true,
                "cacheVariables": {
                  "CMAKE_CATCH_DISCOVER_TESTS_DISCOVERY_MODE": "PRE_TEST"
                }
              },
              {
                "name": "ci-win64",
        
        @@ -110,14 +112,15 @@
      "cacheVariables": {
                  "ENABLE_COVERAGE": "ON",
                  "CMAKE_BUILD_TYPE": "Coverage",
                  "CMAKE_CXX_FLAGS_COVERAGE": "-Og -g --coverage -fkeep-inline-functions -fkeep-static-functions",
                  "CMAKE_CXX_FLAGS_COVERAGE": "-O0 -g --coverage -fkeep-inline-functions -fkeep-static-functions",
                  "CMAKE_EXE_LINKER_FLAGS_COVERAGE": "--coverage",
                  "CMAKE_SHARED_LINKER_FLAGS_COVERAGE": "--coverage"
                  "CMAKE_SHARED_LINKER_FLAGS_COVERAGE": "--coverage",
                  "CMAKE_MAP_IMPORTED_CONFIG_COVERAGE": "Coverage;RelWithDebInfo;Release;Debug;"
                }
              },
              {
                "name": "ci-coverage",
                "inherits": ["coverage-linux", "dev-mode"],
                "inherits": ["coverage-linux", "dev-mode", "vcpkg"],
                "cacheVariables": {
                  "COVERAGE_HTML_COMMAND": ""
                }
        
        @@ -125,10 +128,11 @@
    {
                "name": "ci-sanitize",
                "binaryDir": "${sourceDir}/build/sanitize",
                "inherits": ["ci-linux", "dev-mode"],
                "inherits": ["ci-linux", "dev-mode", "vcpkg"],
                "cacheVariables": {
                  "CMAKE_BUILD_TYPE": "Sanitize",
                  "CMAKE_CXX_FLAGS_SANITIZE": "-U_FORTIFY_SOURCE -O2 -g -fsanitize=address,undefined -fno-omit-frame-pointer -fno-common"
                  "CMAKE_CXX_FLAGS_SANITIZE": "-U_FORTIFY_SOURCE -O2 -g -fsanitize=address,undefined -fno-omit-frame-pointer -fno-common",
                  "CMAKE_MAP_IMPORTED_CONFIG_SANITIZE": "Sanitize;RelWithDebInfo;Release;Debug;"
                }
              },
              {
        
        @@ -146,15 +150,15 @@
    },
              {
                "name": "ci-macos",
                "inherits": ["ci-build", "ci-darwin", "dev-mode", "ci-multi-config"]
                "inherits": ["ci-build", "ci-darwin", "dev-mode", "ci-multi-config", "vcpkg"]
              },
              {
                "name": "ci-ubuntu",
                "inherits": ["ci-build", "ci-linux", "clang-tidy", "cppcheck", "dev-mode"]
                "inherits": ["ci-build", "ci-linux", "clang-tidy", "vcpkg", "cppcheck", "dev-mode"]
              },
              {
                "name": "ci-windows",
                "inherits": ["ci-build", "ci-win64", "dev-mode", "ci-multi-config"]
                "inherits": ["ci-build", "ci-win64", "dev-mode", "ci-multi-config", "vcpkg", "vcpkg-win64-static"]
              }
            ]
          }
        
        diff --git a/ HACKING.md b/ HACKING.md
          @@ -41,7 +41,7 @@ 
          the project:
        
        
              {
                "name": "dev",
                "binaryDir": "${sourceDir}/build/dev",
                "inherits": ["dev-mode", "ci-<os>"],
                "inherits": ["dev-mode", "vcpkg", "ci-<os>"],
                "cacheVariables": {
                  "CMAKE_BUILD_TYPE": "Debug"
                }
        
        
          @@ -87,6 +87,17 @@ 
          in the terminal.
        
        
          > in `Tools > Options > CMake` **prior to opening the project**, after which
          > you can manually configure using `Project > Configure Cache`.
          ### Dependency manager
          The above preset will make use of the [vcpkg][vcpkg] dependency manager. After
          installing it, make sure the `VCPKG_ROOT` environment variable is pointing at
          the directory where the vcpkg executable is. On Windows, you might also want
          to inherit from the `vcpkg-win64-static` preset, which will make vcpkg install
          the dependencies as static libraries. This is only necessary if you don't want
          to setup `PATH` to run tests.
          [vcpkg]: https://github.com/microsoft/vcpkg
          ### Configure, build and test
          If you followed the above instructions, then you can configure, build and test
        
        
          @@ -145,30 +156,5 @@ 
          These targets run the codespell tool on the codebase to check errors and to fix
        
        
          them respectively. Customization available using the `SPELL_COMMAND` cache
          variable.
          ## Running tests on Windows with `BUILD_SHARED_LIBS=ON`
          If you are building a shared library on Windows, you must add the path to the
          DLL file to `PATH` when you want to run tests. One way you could do that is by
          using PowerShell and writing a script for it, e.g. `env.ps1` at the project
          root:
          ```powershell
          $oldPrompt = (Get-Command prompt).ScriptBlock
          function prompt() { "(Debug) $(& $oldPrompt)" }
          $VsInstallPath = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -Property InstallationPath
          $Env:Path += ";$VsInstallPath\Common7\IDE;$Pwd\build\dev\Debug"
          ```
          Then you can source this script by running `. env.ps1`. This particular
          example will only work for Debug builds.
          ### Passing `PATH` to editors
          Make sure you launch your editor of choice from the console with the above
          script sourced. Look for `(Debug)` in the prompt to confirm, then run e.g.
          `code .` for VScode or `devenv .` for Visual Studio.
          [1]: https://cmake.org/cmake/help/latest/manual/cmake-presets.7.html
          [2]: https://cmake.org/download/
        
        diff --git a/ README.md b/ README.md
          @@ -13,8 +13,7 @@ 
          a long way until full coverage.
        
        
          ## Dependencies
          * CMake 3.14 or latter
          * Compiler with C++20 support (tested: clang 18.1.8, gcc 14.2.1)
          * [`libgit2 1.9`](https://github.com/libgit2/libgit2)
          * Compiler with C++20 support (tested on gcc 14.2.1 and clang 19.1.7)
          ## Building and installing
        
        
          @@ -24,7 +23,7 @@ 
          See the [`BUILDING`](BUILDING.md) document.
        
        
          ## Usage
          > Please reference [startgit](https://github.com/DimitrijeDobrota/startgit) for relevant usage example
          > Please reference [startgit](https://github.com/DimitrijeDobrota/startgit) for relevant usage examples.
          ## Version History
        
        
          @@ -42,10 +41,9 @@ 
          See the [`BUILDING`](BUILDING.md) document.
        
        
          See the [`CONTRIBUTING`](CONTRIBUTING.md) document.
          # Licensing
          ## License
          This project is licensed under the MIT License
          - see the [`LICENSE`](LICENSE.md) document for details
          This project is licensed under the MIT License - see the [`LICENSE`](LICENSE.md) file for details
          ## Acknowledgments
        
        diff --git a/ cmake/coverage.cmake b/ cmake/coverage.cmake
@@ -1,20 +1,25 @@
# ---- Variables ----
          find_program(LCOV lcov REQUIRED)
          find_program(GENHTML genhtml REQUIRED)
          # We use variables separate from what CTest uses, because those have
          # customization issues
          set(
              COVERAGE_TRACE_COMMAND
              lcov -c -q
              ${LCOV} -c -q
              -o "${PROJECT_BINARY_DIR}/coverage.info"
              -d "${PROJECT_BINARY_DIR}"
              --include "${PROJECT_SOURCE_DIR}/*"
              --capture
              --all
              CACHE STRING
              "; separated command to generate a trace for the 'coverage' target"
          )
          set(
              COVERAGE_HTML_COMMAND
              genhtml --legend -f -q
              ${GENHTML} --legend -f -q
              "${PROJECT_BINARY_DIR}/coverage.info"
              -p "${PROJECT_SOURCE_DIR}"
              -o "${PROJECT_BINARY_DIR}/coverage_html"
        
        diff --git a/ cmake/install-config.cmake b/ cmake/install-config.cmake
@@ -1,1 +1,6 @@
include("${CMAKE_CURRENT_LIST_DIR}/git2wrapTargets.cmake")
          include(CMakeFindDependencyMacro)
          find_dependency(libgit2)
          if(libgit2_FOUND)
            include("${CMAKE_CURRENT_LIST_DIR}/git2wrapTargets.cmake")
          endif()
        
        diff --git a/ test/CMakeLists.txt b/ test/CMakeLists.txt
          @@ -7,18 +7,20 @@ 
          include(../cmake/folders.cmake)
        
        
          # ---- Dependencies ----
          if(PROJECT_IS_TOP_LEVEL)
            find_package(git2wrap REQUIRED)
            enable_testing()
          endif()
          find_package(Catch2 REQUIRED)
          include(Catch)
          # ---- Tests ----
          add_executable(git2wrap_test source/git2wrap_test.cpp)
          target_link_libraries(git2wrap_test PRIVATE git2wrap::git2wrap)
          target_compile_features(git2wrap_test PRIVATE cxx_std_20)
          function(add_test NAME)
            add_executable("${NAME}" "source/${NAME}.cpp")
            target_link_libraries("${NAME}" PRIVATE based::based)
            target_link_libraries("${NAME}" PRIVATE Catch2::Catch2WithMain)
            target_compile_features("${NAME}" PRIVATE cxx_std_20)
            catch_discover_tests("${NAME}")
          endfunction()
          add_test(NAME git2wrap_test COMMAND git2wrap_test)
          add_test(git2wrap_test)
          # ---- End-of-file commands ----
          diff --git a/ vcpkg-configuration.json b/ vcpkg-configuration.json
@@ -0,0 +1,15 @@
{
            "default-registry": {
              "kind": "git",
              "baseline": "566f9496b7e00ee0cc00aca0ab90493d122d148a",
              "repository": "https://github.com/microsoft/vcpkg"
            },
            "registries": [
          	{
                "kind": "git",
                "repository": "git://git.dimitrijedobrota.com/vcpkg-registry.git",
                "baseline": "cc7113e63d7bb988a70e6b6dd91c5cd1af04bdfb",
                "packages": []
              }
            ]
          }
        
        diff --git a/ vcpkg.json b/ vcpkg.json
@@ -0,0 +1,23 @@
{
            "name": "hemplate",
            "version-semver": "0.4.0",
            "dependencies": [
                {
                    "name": "libgit2",
                    "version>=": "1.9.0"
                }
            ],
            "default-features": [],
            "features": {
              "test": {
                "description": "Dependencies for testing",
                "dependencies": [
                  {
                    "name": "catch2",
                    "version>=": "3.7.1"
                  }
                ]
              }
            },
            "builtin-baseline": "ce613c41372b23b1f51333815feb3edd87ef8a8b"
          }