Skip to content

Commit 9382dc8

Browse files
committed
Summary
- Created diagnostic message tests - Added new networking example - Examples no longer use CMake - each has its own Makefile - Fixed Meson warning about missing check parameters in run_command() calls - Recreated lost cpo-generator examples in `docs/examples.md` - Updated checkin.sh to reflect path changes Signed-off-by: Greg von Winckel <gregvw@gmail.com>
1 parent 182e24c commit 9382dc8

40 files changed

+4282
-951
lines changed

Makefile

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# TInCuP - Documentation and Examples Makefile
2+
#
3+
# This Makefile provides convenient targets for documentation generation
4+
# and example management. For C++ builds, use CMake as usual.
5+
6+
# Python command (try python3, fall back to python)
7+
PYTHON := $(shell command -v python3 2> /dev/null || echo python)
8+
9+
# Documentation targets
10+
.PHONY: docs examples single-header help clean-docs examples-help
11+
12+
# Default target
13+
help:
14+
@echo "TInCuP - Documentation and Examples"
15+
@echo "====================================="
16+
@echo ""
17+
@echo "Documentation targets:"
18+
@echo " examples - Regenerate docs/examples.md from JSON config"
19+
@echo " single-header - Regenerate single_include/tincup.hpp"
20+
@echo " examples-help - Show help for individual example projects"
21+
@echo " clean-docs - Clean generated documentation files"
22+
@echo " help - Show this help message"
23+
@echo ""
24+
@echo "Example projects (self-contained with own Makefiles):"
25+
@echo " examples/serialize/ - Basic CPO serialization example"
26+
@echo " examples/networking/ - Production-ready networking serialization"
27+
@echo ""
28+
@echo "Quick start:"
29+
@echo " make examples # Regenerate examples documentation"
30+
@echo " cd examples/serialize && make run # Try basic example"
31+
@echo " cd examples/networking && make run # Try advanced example"
32+
@echo ""
33+
@echo "For C++ library builds, use CMake:"
34+
@echo " mkdir build && cd build"
35+
@echo " cmake .. && make"
36+
37+
# Regenerate examples documentation from JSON
38+
examples:
39+
@echo "Regenerating examples documentation..."
40+
$(PYTHON) scripts/generate_examples_doc.py
41+
@echo "Examples documentation updated in docs/examples.md"
42+
43+
# Regenerate single header
44+
single-header:
45+
@echo "Regenerating single header..."
46+
$(PYTHON) scripts/generate_single_header.py
47+
@echo "Single header updated in single_include/tincup.hpp"
48+
49+
# Show help for example projects
50+
examples-help:
51+
@echo "Example Projects Help"
52+
@echo "===================="
53+
@echo ""
54+
@echo "Serialize Example (Basic):"
55+
@echo " cd examples/serialize"
56+
@echo " make help # Show available targets"
57+
@echo " make run # Build and run example"
58+
@echo ""
59+
@echo "Networking Example (Advanced):"
60+
@echo " cd examples/networking"
61+
@echo " make help # Show available targets"
62+
@echo " make run # Build and run simple example"
63+
@echo " make full # Try to build comprehensive example"
64+
@echo ""
65+
@echo "Both examples are self-contained with their own documentation."
66+
67+
# Clean generated documentation
68+
clean-docs:
69+
@echo "Cleaning generated documentation..."
70+
@rm -f docs/examples.md
71+
@echo "Generated documentation files removed"
72+
73+
# Test that Python tools are available
74+
test-python:
75+
@echo "Testing Python environment..."
76+
@$(PYTHON) --version
77+
@$(PYTHON) -c "import json, subprocess, pathlib; print('Required modules available')"
78+
@echo "Python environment OK"

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ TInCuP bridges the gap between `tag_invoke`'s theoretical benefits and practical
6767

6868
Want to experiment with TInCuP before installing? Use our Compiler Explorer examples:
6969

70-
- Compiler flags used: `-std=c++20 -O2 -DTINCUP_DIAGNOSTIC_LEVEL=2`
70+
- Compiler flags used: `-std=c++20 -O2 -DTINCUP_DIAGNOSTIC_LEVEL=3`
7171
* [Basic Printing](https://godbolt.org/z/3945vq437)
7272
* [Bool Dispatch](https://godbolt.org/z/K1xcqqPad)
7373
* Enhanced Error Diagnostics:
@@ -97,6 +97,10 @@ Troubleshooting CLI on macOS/Linux:
9797

9898
For full documentation, including guides on the C++ library, code generator, build system integration, and more, please see the **[TInCuP Documentation](docs/index.md)**.
9999

100+
**Want to see examples?** Check out:
101+
- **[Generated CPO Examples](docs/examples.md)** - Auto-generated examples showing different CPO patterns
102+
- **[Working Examples](examples/)** - Complete, buildable projects demonstrating real-world usage
103+
100104
## Get, Feedback, Contribute
101105

102106
- **Obtain**:

build_systems/cmake/CMakeLists.txt

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,6 @@ if(TINCUP_ENABLE_TESTING)
4949
enable_testing()
5050
endif()
5151

52-
# Only add the examples if they are enabled AND we are building the main project,
53-
# not an external project (like the smoke test) that includes this one.
54-
message(STATUS "TINCUP DEBUG: ENABLE_EXAMPLES=${ENABLE_EXAMPLES}, TINCUP_IS_MAIN_PROJECT=${TINCUP_IS_MAIN_PROJECT}, CMAKE_PROJECT_NAME=${CMAKE_PROJECT_NAME}, PROJECT_NAME=${PROJECT_NAME}")
55-
if(ENABLE_EXAMPLES AND TINCUP_IS_MAIN_PROJECT)
56-
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../../examples
57-
${CMAKE_CURRENT_BINARY_DIR}/../../examples)
58-
endif()
59-
6052
# --- Tests ---
6153
# Build and register tests only when testing is enabled and this is the main project
6254
if(TINCUP_ENABLE_TESTING AND TINCUP_IS_MAIN_PROJECT)

build_systems/make/Makefile

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Makefile for tincup project
22
# Provides convenient targets for development workflow
33

4-
.PHONY: test test-patterns test-verification test-coverage install-dev clean help ci-local ci-quick test-cmake test-meson test-examples test-headers update-readme-examples preview-readme-examples
4+
.PHONY: test test-patterns test-verification test-coverage install-dev clean help ci-local ci-quick test-cmake test-meson test-examples test-headers generate-examples-docs preview-examples-docs
55

66
# Default target
77
help:
@@ -26,8 +26,8 @@ help:
2626
@echo " install-dev - Install development dependencies"
2727
@echo " verify-cpos - Verify CPO patterns in project"
2828
@echo " generate-cpo-registry - Scan headers and write docs/cpo_registry.{json,md}"
29-
@echo " update-readme-examples - Update README.md examples with current generator output"
30-
@echo " preview-readme-examples - Preview README.md examples updates without applying"
29+
@echo " generate-examples-docs - Generate docs/examples.md with current generator output"
30+
@echo " preview-examples-docs - Preview examples documentation updates without applying"
3131
@echo " clean - Clean up generated files"
3232

3333
# Run all tests
@@ -58,13 +58,13 @@ verify-cpos:
5858
generate-cpo-registry:
5959
python3 cpo_tools/cpo_registry.py --root include --out docs
6060

61-
# Update README.md examples with current generator output (JSON-driven)
62-
update-readme-examples:
63-
python3 scripts/update_readme_examples.py
61+
# Generate docs/examples.md with current generator output (JSON-driven)
62+
generate-examples-docs:
63+
cd ../.. && python3 scripts/generate_examples_doc.py
6464

65-
# Preview README.md examples updates without applying
66-
preview-readme-examples:
67-
python3 scripts/update_readme_examples.py --dry-run
65+
# Preview examples documentation updates without applying
66+
preview-examples-docs:
67+
cd ../.. && python3 scripts/generate_examples_doc.py --dry-run
6868

6969
# Git hook for pre-commit CPO verification
7070
install-git-hook:

build_systems/meson/meson.build

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@ project('tincup', 'cpp',
44
version : run_command('sh', '-c',
55
'if [ -f ../../VERSION ]; then cat ../../VERSION; '
66
+ 'elif [ -f VERSION ]; then cat VERSION; '
7-
+ 'else echo 0.0.0; fi').stdout().strip(),
7+
+ 'else echo 0.0.0; fi',
8+
check: false).stdout().strip(),
89
# Grab license type from the first line of LICENSE; fallback to BSD 3-Clause
910
license : run_command('sh', '-c',
1011
'if [ -f ../../LICENSE ]; then head -n1 ../../LICENSE; '
1112
+ 'elif [ -f LICENSE ]; then head -n1 LICENSE; '
12-
+ 'else echo BSD 3-Clause License; fi').stdout().strip(),
13+
+ 'else echo BSD 3-Clause License; fi',
14+
check: false).stdout().strip(),
1315
default_options : ['cpp_std=c++20', 'warning_level=3'])
1416

1517
# Reference the header within this subproject's directory structure

0 commit comments

Comments
 (0)