Conversion to vcpkg - #24
Open
alexanderbock wants to merge 2 commits into
Open
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The manifest-sync script has inverted JSON error checks (making it unreliable), and the consumer test uses an imported target name directly in add_test instead of an executable path.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR converts codegen to build and integrate via vcpkg manifest mode and an in-repo overlay port, including install/export rules to make codegen consumable via find_package(codegen CONFIG REQUIRED).
Changes:
- Added vcpkg manifests/configuration (root manifest + in-repo overlay port) and a CMake script intended to keep manifest/port dependencies in sync.
- Updated CMake build/install/export logic to support
find_package(codegen)and an installedcodegen::codegen-tool. - Added a minimal “consumer” project to validate linking/running against the installed port, and updated tests to use
find_package(Catch2).
File summaries
| File | Description |
|---|---|
| vcpkg.json | Adds root vcpkg manifest + overlay-port configuration. |
| tests/CMakeLists.txt | Switches Catch2 linkage to find_package(Catch2) + imported target. |
| support/vcpkg/ports/codegen/vcpkg.json | Adds overlay port manifest for in-repo consumption. |
| support/vcpkg/ports/codegen/usage | Documents exported targets and tool availability. |
| support/vcpkg/ports/codegen/portfile.cmake | Defines the in-repo overlay port build/install behavior. |
| support/vcpkg/check-manifest-sync.cmake | Adds a manifest-vs-port sync check script. |
| support/consumer-test/vcpkg.json | Adds a vcpkg manifest for the consumer regression project. |
| support/consumer-test/main.cpp | Adds a basic compile/link-time consumer check. |
| support/consumer-test/CMakeLists.txt | Adds a minimal consumer build and CTest integration. |
| support/cmake/codegenConfig.cmake.in | Adds package config template for find_package(codegen). |
| README.md | Documents vcpkg/presets-based build + consumption guidance. |
| LICENSE.md | Adds license file to the repo. |
| lib/CMakeLists.txt | Converts library to static + adds header file-set + export interface details. |
| CMakePresets.json | Adds presets to drive vcpkg toolchain builds on Windows/Linux. |
| CMakeLists.txt | Adds top-level project structure, test option gating, and install/export rules. |
| .gitmodules | Moves common-compile-settings submodule under support/cmake/. |
| .gitignore | Updates ignored build outputs and vcpkg install tree artifacts. |
Review details
Suppressed comments (2)
support/vcpkg/check-manifest-sync.cmake:139
- The dependencies lookup error check for the port manifest is inverted: when "dependencies" exists, the code currently overwrites it with an empty array, which prevents the script from detecting dependency divergence.
string(JSON portDependencies ERROR_VARIABLE portDepsError GET "${portJson}" "dependencies")
if (NOT portDepsError STREQUAL "NOTFOUND")
set(portDependencies "[]")
endif ()
support/vcpkg/check-manifest-sync.cmake:154
- The features lookup error check for the port manifest is inverted: when "features" exists, the code currently overwrites it with "{}", which prevents the script from detecting mismatches in feature names/dependencies.
string(JSON portFeatures ERROR_VARIABLE portFeaturesError GET "${portJson}" "features")
if (NOT portFeaturesError STREQUAL "NOTFOUND")
set(portFeatures "{}")
endif ()
- Files reviewed: 16/18 changed files
- Comments generated: 5
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+64
to
+84
| string(JSON features ERROR_VARIABLE featuresError GET "${entry}" "features") | ||
| set(featureList "") | ||
| if (featuresError STREQUAL "NOTFOUND") | ||
| string(JSON featureCount LENGTH "${features}") | ||
| if (featureCount GREATER 0) | ||
| math(EXPR lastFeature "${featureCount} - 1") | ||
| foreach (j RANGE ${lastFeature}) | ||
| string(JSON feature GET "${features}" ${j}) | ||
| list(APPEND featureList "${feature}") | ||
| endforeach () | ||
| list(SORT featureList) | ||
| endif () | ||
| endif () | ||
| list(JOIN featureList "+" featureText) | ||
|
|
||
| string(JSON defaults ERROR_VARIABLE defaultsError GET "${entry}" "default-features") | ||
| if (NOT defaultsError STREQUAL "NOTFOUND") | ||
| set(defaults "ON") | ||
| endif () | ||
|
|
||
| list(APPEND result "${name}[${featureText}](default-features=${defaults})") |
| # The exported executable target has to be runnable for a superproject that drives codegen | ||
| # as a build step. Point it at an empty directory so it does a clean no-op run (exit 0) | ||
| file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/emptyscan) | ||
| add_test(NAME CodegenTool COMMAND codegen::codegen-tool ${CMAKE_CURRENT_BINARY_DIR}/emptyscan) |
Comment on lines
+120
to
+123
| string(JSON deps ERROR_VARIABLE depsError GET "${features}" "${feature}" "dependencies") | ||
| if (NOT depsError STREQUAL "NOTFOUND") | ||
| set(deps "[]") | ||
| endif () |
Comment on lines
+133
to
+135
| if (NOT manifestDepsError STREQUAL "NOTFOUND") | ||
| set(manifestDependencies "[]") | ||
| endif () |
Comment on lines
+148
to
+150
| if (NOT manifestFeaturesError STREQUAL "NOTFOUND") | ||
| set(manifestFeatures "{}") | ||
| endif () |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.