Skip to content

Conversion to vcpkg - #24

Open
alexanderbock wants to merge 2 commits into
masterfrom
vcpkg
Open

Conversion to vcpkg#24
alexanderbock wants to merge 2 commits into
masterfrom
vcpkg

Conversation

@alexanderbock

Copy link
Copy Markdown
Member

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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 installed codegen::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 ()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants