cmake: make the repo consumable via add_subdirectory / FetchContent#146
Merged
Conversation
the kicad plugin repos will pin circuitcore as a dependency instead of copying code, so the build has to behave as a guest: - CMAKE_SOURCE_DIR leaked the parent projects root in 6 places (third_party includes on ui/pdnkit_pi/sikit_si, the repo-root include on both widgets libs, the vtk patch script includes in mpkit/widgets). all now use circuitcore_SOURCE_DIR. - new CIRCUITCORE_BUILD_APPS option gates the four executables + CLI11. apps, tests and mpkit widgets (vtk) default OFF when circuitcore is not the top-level project, ON as before when it is. - stop FORCE-caching CMAKE_BUILD_TYPE when embedded. - aliases for the engines: pdnkit::pi, sikit::si, emikit::emi. - bare PUBLIC include dirs wrapped in BUILD_INTERFACE (field, emikit, mpkit, kits) so install(EXPORT) stays possible later. - tests/consumer: standalone project that add_subdirectory()s the repo, links circuitcore::kicad + pdnkit::widgets + emikit::emi, parses the tiny_pdn fixture and checks a target-z number. wired into ci after the test step, including asserts that apps/tests stayed off. - readme: short section on consuming the repo + target list. no source changes, no behavior change for the standalone build.
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.
groundwork for the kicad plugin repos (pdnkit-kicad etc): they pin circuitcore via FetchContent/submodule instead of copying code, which means this repo has to work as an embedded subproject. it did not -- six CMAKE_SOURCE_DIR uses resolved into the parent project, the GUI/CLI11/tests/VTK were unconditional, and CMAKE_BUILD_TYPE got FORCE-cached into the parents cache.
changes:
deliberately NOT in scope: install()/export()/find_package support. the kits bare header layout (pdnkit/render/ vs sikit/render/) collides under a shared install prefix; FetchContent consumption doesnt need it and the plugin repos dont either. that can come later if the headers ever get namespaced.
verified on the box: embedded consumer configures in 0.4s with no CLI11/Catch2/VTK, 129 lib targets, smoke binary runs green, apps+tests confirmed absent. full top-level build + suite also green (see ci).