Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
3ab13f2
Adding installation support (again)
sean-parent Nov 11, 2025
b69d45f
Update README.md
sean-parent Nov 11, 2025
e4d9f54
Fixing quoting issue.
sean-parent Nov 11, 2025
bcb610f
Update ci.yml
sean-parent Nov 12, 2025
79bc0a0
Update ci.yml
sean-parent Nov 12, 2025
7d2ce0b
Fixing quotes for Windows bash.
sean-parent Nov 12, 2025
eb92bfd
Trying again to fix quoting...
sean-parent Nov 12, 2025
b2d8e3c
Removing CPMFindPackage CI test
sean-parent Nov 12, 2025
e927f5b
Update ci.yml
sean-parent Nov 12, 2025
832313c
making the ci.yml file into a cmake template
sean-parent Nov 12, 2025
77c30bc
Fixing force init for CI and simplifying CI template.
sean-parent Nov 12, 2025
13cf43f
Adding contracts for CMake functions.
sean-parent Nov 12, 2025
562ad63
Update CI workflow to conditionally run CMake steps
sean-parent Nov 12, 2025
69e1aff
Merge branch 'sean-parent/install' of https://github.com/stlab/cpp-li…
sean-parent Nov 12, 2025
49eaf58
Add PACKAGE_NAME to install setup and improve version detection
sean-parent Nov 14, 2025
fc7d4e4
Automate find_dependency generation for installed packages
sean-parent Nov 14, 2025
c1bce1c
Refactor to use PACKAGE_NAME for target and CI consistency
sean-parent Nov 17, 2025
39419e2
Add custom dependency mapping for CMake package generation
sean-parent Nov 17, 2025
e940916
Refactor template and CI setup to use PACKAGE_NAME
sean-parent Nov 18, 2025
0516b9b
Remove redundant install-test job from CI workflow
sean-parent Nov 18, 2025
e4a3ee5
Improve dependency mapping and version override support
sean-parent Nov 18, 2025
4f09b3b
Update CI to set compiler env vars conditionally
sean-parent Nov 18, 2025
579b1ed
Update README for CPM repository naming compatibility
sean-parent Nov 20, 2025
f13bae3
Add interactive setup script and update README
sean-parent Nov 21, 2025
a4670d0
Improve setup instructions and input handling - WIP
sean-parent Nov 23, 2025
3c81f5e
Add CI workflow and comprehensive dependency mapping tests
sean-parent Dec 12, 2025
05b463e
Update docs and install logic; add troubleshooting
sean-parent Dec 12, 2025
da92c05
Update ci.yml
sean-parent Dec 12, 2025
256d0e7
Simplify CI workflow to use only Ubuntu and update test names
sean-parent Dec 12, 2025
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
143 changes: 143 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
# CI workflow for cpp-library project itself

name: CI

on:
push:
branches: [main, develop]
pull_request:
branches: [main]

jobs:
unit-tests:
name: Unit Tests
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v5

- name: Run dependency mapping tests
run: cmake -P tests/install/CMakeLists.txt

integration-tests:
name: Integration Tests
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v5

- name: Download CPM.cmake
run: |
mkdir -p cmake
wget -q -O cmake/CPM.cmake https://github.com/cpm-cmake/CPM.cmake/releases/latest/download/get_cpm.cmake

- name: Create test project
run: |
mkdir -p test-project/include/testlib
cd test-project

# Create CMakeLists.txt that uses cpp-library
cat > CMakeLists.txt << 'EOF'
cmake_minimum_required(VERSION 3.20)
project(mylib VERSION 1.0.0)

include(../cmake/CPM.cmake)
CPMAddPackage(NAME cpp-library SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/..)
include(${cpp-library_SOURCE_DIR}/cpp-library.cmake)

# Create a simple test library
cpp_library_setup(
DESCRIPTION "Test library for cpp-library"
NAMESPACE testlib
HEADERS mylib.hpp
)
EOF

# Create a simple header
cat > include/testlib/mylib.hpp << 'EOF'
#pragma once
namespace testlib {
inline int get_value() { return 42; }
}
EOF

- name: Configure test project
run: |
cd test-project
cmake -B build -DCMAKE_BUILD_TYPE=Release

- name: Build test project
run: |
cd test-project
cmake --build build

- name: Install test project
run: |
cd test-project
cmake --install build --prefix ${{ runner.temp }}/install

- name: Verify installation
run: |
# Check that package config was installed
if [ ! -f "${{ runner.temp }}/install/lib/cmake/testlib-mylib/testlib-mylibConfig.cmake" ]; then
echo "Error: Package config not found"
exit 1
fi
echo "✓ Installation successful"

- name: Test find_package
run: |
mkdir -p test-consumer
cd test-consumer

# Create a consumer project
cat > CMakeLists.txt << 'EOF'
cmake_minimum_required(VERSION 3.20)
project(test-consumer)

find_package(testlib-mylib REQUIRED)

add_executable(consumer main.cpp)
target_link_libraries(consumer PRIVATE testlib::mylib)
EOF

# Create main.cpp
cat > main.cpp << 'EOF'
#include <testlib/mylib.hpp>
#include <iostream>
int main() {
std::cout << "Value: " << testlib::get_value() << std::endl;
return 0;
}
EOF

# Configure with installed package
cmake -B build -DCMAKE_PREFIX_PATH=${{ runner.temp }}/install

# Build
cmake --build build

echo "✓ Consumer project built successfully"

documentation:
name: Documentation Test
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v5

- name: Check README examples
run: |
# Extract and validate code blocks from README
grep -A 20 '```cmake' README.md | head -50
echo "✓ README documentation looks valid"

- name: Validate template files
run: |
# Check that all template files exist
test -f templates/CMakePresets.json
test -f templates/Config.cmake.in
test -f templates/Doxyfile.in
test -f templates/custom.css
echo "✓ All template files present"

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.DS_Store
9 changes: 9 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"cSpell.words": [
"clangd",
"ctest",
"doctest",
"MSVC",
"mylib"
]
}
Loading