Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,17 @@ jobs:
python scripts/build_single_file.py --check || python scripts/build_single_file.py
echo "Generated dist/single_file/ab.cmake"

- name: Generate vcpkg registry port
shell: pwsh
run: ./scripts/build_vcpkg_port.ps1 -Tag "${{ steps.version.outputs.tag }}"

- name: Upload release artifact
uses: actions/upload-artifact@v4
with:
name: abcmake-${{ steps.version.outputs.tag }}
path: |
dist/single_file/ab.cmake
dist/vcpkg-port/

- name: Create GitHub Release
uses: softprops/action-gh-release@v2
Expand All @@ -49,6 +54,8 @@ jobs:
body: |
Automated release for ${{ steps.version.outputs.tag }}.
The single-file module and CMake package are attached as assets.

**vcpkg port**: ready-to-use port files are in the release artifacts.
files: |
dist/single_file/ab.cmake
env:
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [6.4.0] - 2026-02-08

### Added

- vcpkg port files (`ports/abcmake/`) for installation via vcpkg.

### Changed

- Install layout: LICENSE and README now placed in the cmake package directory instead of the install prefix root, for vcpkg compatibility.

## [6.3.0] - 2025-11-18

### Added
Expand Down
13 changes: 4 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,10 @@ install(FILES
)


# Copy installer and docs to package root (CMAKE_INSTALL_PREFIX)
install(CODE "
file(COPY ${CMAKE_CURRENT_LIST_DIR}/LICENSE
DESTINATION \"\${CMAKE_INSTALL_PREFIX}\")
file(COPY ${CMAKE_CURRENT_LIST_DIR}/README.md
DESTINATION \"\${CMAKE_INSTALL_PREFIX}\")

message(STATUS \"Package root files installed to: \${CMAKE_INSTALL_PREFIX}\")
")
# Install docs alongside the cmake package
install(FILES LICENSE README.md
DESTINATION ${ABCMAKE_INSTALL_CMAKEDIR}
)

# Display installation information
message(STATUS "abcmake version ${PROJECT_VERSION}")
Expand Down
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,18 @@ add_component(mylib)

Download [`ab.cmake`](https://github.com/an-dr/abcmake/releases/latest/download/ab.cmake) to your project root.

#### Option B: User/System-Wide
#### Option B: Package Manager (vcpkg, CPM)

```bash
vcpkg install abcmake # vcpkg
```

```cmake
CPMAddPackage("gh:an-dr/abcmake@6.4.0" DOWNLOAD_ONLY YES) # CPM
include(${abcmake_SOURCE_DIR}/src/ab.cmake)
```

#### Option C: User/System-Wide

```bash
git clone https://github.com/an-dr/abcmake.git
Expand Down
61 changes: 58 additions & 3 deletions docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,71 @@ This guide covers different methods to install and use abcmake in your projects.

## Table of Contents

- [Quick Installation](#quick-installation)
- [Using Package Managers](#using-package-managers)
- [vcpkg](#vcpkg)
- [CPM](#cpm)
- [Project-Scoped Installation](#project-scoped-installation)
- [User-Scoped Installation](#user-scoped-installation)
- [System-Wide Installation](#system-wide-installation)
- [Verification](#verification)
- [Troubleshooting](#troubleshooting)

## Quick Installation
## Using Package Managers

For most users, the **project-scoped** approach is the simplest and most portable option.
If your project already uses a C++ package manager, this is the easiest way to get abcmake.

### vcpkg

Install via the [vcpkg](https://vcpkg.io) registry:

```bash
vcpkg install abcmake
```

Or use the overlay port shipped in this repository:

```bash
vcpkg install abcmake --overlay-ports=/path/to/abcmake/ports
```

Then in your CMakeLists.txt:

```cmake
cmake_minimum_required(VERSION 3.15)
project(MyProject)

find_package(abcmake REQUIRED)
add_main_component(${PROJECT_NAME})
```

Configure with the vcpkg toolchain file as usual:

```bash
cmake -B build -DCMAKE_TOOLCHAIN_FILE=$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake
```

### CPM

Add abcmake with [CPM.cmake](https://github.com/cpm-cmake/CPM.cmake):

```cmake
cmake_minimum_required(VERSION 3.15)
project(MyProject)

include(cmake/CPM.cmake) # or however you bootstrap CPM

CPMAddPackage(
NAME abcmake
GITHUB_REPOSITORY an-dr/abcmake
VERSION 6.4.0
DOWNLOAD_ONLY YES
)
include(${abcmake_SOURCE_DIR}/src/ab.cmake)

add_main_component(${PROJECT_NAME})
```

`DOWNLOAD_ONLY YES` is used because abcmake is a pure CMake module - no compilation needed.

## Project-Scoped Installation

Expand Down
19 changes: 19 additions & 0 deletions ports/abcmake/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# This overlay port installs abcmake from the local source tree.
# For the official vcpkg registry, see the release artifacts which
# contain a portfile with the correct REF and SHA512.

set(SOURCE_PATH "${CMAKE_CURRENT_LIST_DIR}/../..")

# abcmake is a pure CMake module - no compilation needed
set(VCPKG_POLICY_EMPTY_INCLUDE_FOLDER enabled)

vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
)

vcpkg_cmake_install()

# Remove empty directories that vcpkg doesn't expect
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug")

vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
13 changes: 13 additions & 0 deletions ports/abcmake/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "abcmake",
"version": "6.4.0",
"description": "Simple, component-first CMake helper for small & medium C/C++ projects",
"homepage": "https://github.com/an-dr/abcmake",
"license": "MIT",
"dependencies": [
{
"name": "vcpkg-cmake",
"host": true
}
]
}
93 changes: 93 additions & 0 deletions scripts/build_vcpkg_port.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@

<#
.SYNOPSIS
Generates a vcpkg registry port for abcmake with the correct SHA512 hash.

.DESCRIPTION
Downloads the GitHub source tarball for a given tag, computes its SHA512,
and writes a ready-to-use portfile.cmake + vcpkg.json into dist/vcpkg-port/.

Can be run locally or from CI.

.PARAMETER Tag
The git tag to build the port for (e.g. "v6.4.0").
Defaults to the tag matching the version in src/version.cmake.

.EXAMPLE
.\scripts\build_vcpkg_port.ps1
.\scripts\build_vcpkg_port.ps1 -Tag v6.4.0
#>

param(
[string]$Tag
)

$ErrorActionPreference = "Stop"
Set-Location "$PSScriptRoot/.."

$RepoRoot = (Resolve-Path ".").Path
$OutDir = Join-Path $RepoRoot "dist/vcpkg-port"

# Read version from source if no tag provided
if (-not $Tag) {
$VersionLine = Get-Content (Join-Path $RepoRoot "src/version.cmake") -Raw
if ($VersionLine -match 'set\(ABCMAKE_VERSION\s+([^\)]+)\)') {
$Tag = "v$($Matches[1])"
} else {
Write-Error "Could not parse version from src/version.cmake"
exit 1
}
}

$Version = $Tag.TrimStart("v")
$Url = "https://github.com/an-dr/abcmake/archive/refs/tags/${Tag}.tar.gz"

Write-Host "Tag: $Tag"
Write-Host "Version: $Version"
Write-Host "URL: $Url"

# Download and compute SHA512
Write-Host "Downloading tarball..."
$TempFile = [System.IO.Path]::GetTempFileName()
try {
Invoke-WebRequest -Uri $Url -OutFile $TempFile -UseBasicParsing
$Hash = (Get-FileHash -Path $TempFile -Algorithm SHA512).Hash.ToLower()
Write-Host "SHA512: $Hash"
} finally {
Remove-Item $TempFile -ErrorAction SilentlyContinue
}

# Generate output
if (Test-Path $OutDir) { Remove-Item $OutDir -Recurse -Force }
New-Item -ItemType Directory -Path $OutDir | Out-Null

# portfile.cmake
$Portfile = @"
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO an-dr/abcmake
REF "$Tag"
SHA512 $Hash
)

set(VCPKG_POLICY_EMPTY_INCLUDE_FOLDER enabled)

vcpkg_cmake_configure(
SOURCE_PATH "`${SOURCE_PATH}"
)

vcpkg_cmake_install()

file(REMOVE_RECURSE "`${CURRENT_PACKAGES_DIR}/debug")

vcpkg_install_copyright(FILE_LIST "`${SOURCE_PATH}/LICENSE")
"@

Set-Content -Path (Join-Path $OutDir "portfile.cmake") -Value $Portfile -NoNewline

# vcpkg.json
$OverlayJson = Get-Content (Join-Path $RepoRoot "ports/abcmake/vcpkg.json") -Raw
$RegistryJson = $OverlayJson -replace '"version":\s*"[^"]*"', "`"version`": `"$Version`""
Set-Content -Path (Join-Path $OutDir "vcpkg.json") -Value $RegistryJson -NoNewline

Write-Host "Generated port in: $OutDir"
2 changes: 1 addition & 1 deletion src/version.cmake
Original file line number Diff line number Diff line change
@@ -1 +1 @@
set(ABCMAKE_VERSION 6.3.0)
set(ABCMAKE_VERSION 6.4.0)