Reorganize C++ samples to match other languages (cleanup only, no functionality changes)#727
Open
Wayne-Ch wants to merge 2 commits into
Open
Reorganize C++ samples to match other languages (cleanup only, no functionality changes)#727Wayne-Ch wants to merge 2 commits into
Wayne-Ch wants to merge 2 commits into
Conversation
Pure relocation, no functionality removed. All other language SDKs
(Python, JS, Rust, C#) keep samples under samples/<lang>/; the C++
SDK was unique in inlining samples under sdk/cpp/sample/. This moves
both samples to match the convention, and rewires the build system
so each sample becomes standalone-buildable like every other language.
Moves (git mv):
sdk/cpp/sample/main.cpp
-> samples/cpp/sdk-quickstart/main.cpp
sdk/cpp/sample/web-server-responses-vision/*
-> samples/cpp/web-server-responses-vision/*
sdk/cpp/CMakeLists.txt:
- Drop inline CppSdkSample and WebServerResponsesVision exe targets
(samples now self-build via add_subdirectory(sdk/cpp))
- Drop VS_STARTUP_PROJECT (no longer relevant to the SDK build)
- Update install() to source the vision sample from its new path
so the customer-facing SDK zip layout is unchanged
samples/cpp/sdk-quickstart/ (new build files):
- CMakeLists.txt mirrors samples/cpp/<other>/ pattern: find_package
with add_subdirectory fallback, target name CppSdkSample preserved
- CMakePresets.json, vcpkg.json, vcpkg-configuration.json added
samples/cpp/web-server-responses-vision/:
- CMakeLists.txt: SDK path updated (../.. -> ../../../sdk/cpp)
- CMakePresets.json: overlay-triplets path updated to the same
Both samples: re-derive FL_*_DLL_DIR before calling fl_copy_runtime_dlls.
The SDK sets those vars as non-CACHE, so they aren't visible to
sub-projects (a latent bug in the standalone build paths the samples'
READMEs already document). Re-deriving them locally is a one-line
workaround that fixes the standalone DLL copy without touching the SDK.
Docs:
- sdk/cpp/README.md: vision-sample section + tree diagram updated
- samples/README.md: add C++ row
Verified end-to-end:
- sdk/cpp builds (16/16 ninja steps), tests still compile
- samples/cpp/sdk-quickstart builds, exe + Foundry Local Core
DLL + ONNX Runtime DLLs all land in the build dir
- samples/cpp/web-server-responses-vision builds, same DLL set
lands in the build dir
- SDK install (cmake --install) produces byte-identical zip layout:
bin/ + cmake/ + include/ + lib/ + sample/web-server-responses-vision/
- git ls-files | grep "sdk/cpp/sample" returns nothing
- .github/workflows/ has no C++ sample references to update
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR reorganizes the C++ samples to live under samples/cpp/ (consistent with the other language SDKs), and updates the C++ SDK docs/build/install wiring accordingly.
Changes:
- Removed the inlined C++ sample targets from
sdk/cpp/CMakeLists.txtand moved the sample sources undersamples/cpp/. - Updated
sdk/cpp/README.mdandsamples/README.mdto point to the new sample locations. - Added standalone CMake + vcpkg manifests for the moved C++ samples, plus a local workaround to re-derive
FL_*_DLL_DIRbefore invokingfl_copy_runtime_dlls().
Reviewed changes
Copilot reviewed 10 out of 16 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| sdk/cpp/README.md | Updates documentation links/commands to reference the new samples/cpp/... locations. |
| sdk/cpp/CMakeLists.txt | Removes sample build targets from the SDK build; updates SDK install step to source the vision sample from samples/cpp/. |
| samples/README.md | Adds C++ to the top-level samples index and describes the C++ sample set. |
| samples/cpp/web-server-responses-vision/vcpkg.json | Adds vcpkg manifest dependencies for the vision Responses API sample. |
| samples/cpp/web-server-responses-vision/vcpkg-configuration.json | Pins the vcpkg baseline for the vision sample. |
| samples/cpp/web-server-responses-vision/test_image.jpg | Adds the default test image used by the vision sample. |
| samples/cpp/web-server-responses-vision/stb_impl.cpp | Adds the single translation unit for stb implementations. |
| samples/cpp/web-server-responses-vision/README.md | Updates the working directory path for building/running after the move. |
| samples/cpp/web-server-responses-vision/main.cpp | Adds the standalone C++ vision streaming (SSE) sample implementation. |
| samples/cpp/web-server-responses-vision/CMakePresets.json | Adds CMake presets to build the vision sample with vcpkg on Windows. |
| samples/cpp/web-server-responses-vision/CMakeLists.txt | Adds standalone CMake project that can consume the prebuilt SDK or build it from source. |
| samples/cpp/sdk-quickstart/vcpkg.json | Adds vcpkg manifest dependencies for the quickstart sample. |
| samples/cpp/sdk-quickstart/vcpkg-configuration.json | Pins the vcpkg baseline for the quickstart sample. |
| samples/cpp/sdk-quickstart/main.cpp | Adds the standalone C++ SDK quickstart sample implementation. |
| samples/cpp/sdk-quickstart/CMakePresets.json | Updates preset overlay triplet path for the new directory layout. |
| samples/cpp/sdk-quickstart/CMakeLists.txt | Adds standalone CMake project for the quickstart sample, including DLL copy workaround. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Resolves samples/README.md conflict: keep main's WinML EP verification description updates for C#/JS/Python/Rust and the bumped counts, keep this branch's C++ row (3 samples: sdk-quickstart, live-audio-transcription, web-server-responses-vision) in alphabetical order between C# and JavaScript.
Collaborator
Author
|
@microsoft-github-policy-service agree company="Microsoft" |
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.
Summary
Repo cleanup. Every other language SDK keeps its samples under
samples/<lang>/; only C++ inlined them undersdk/cpp/sample/. This moves both C++ samples tosamples/cpp/to match.samples/python/samples/js/samples/rust/samples/cs/sdk/cpp/sample/(unique)samples/cpp/(consistent)What moved
sdk/cpp/sample/main.cppsamples/cpp/sdk-quickstart/main.cppsdk/cpp/sample/web-server-responses-vision/*samples/cpp/web-server-responses-vision/*What did NOT change
.cpp/.hsource edits insdk/cpp/cmake --installproduces a byte-identical layoutCppSdkSamplekept (renaming would be a behavior change)CMakeLists.txtto re-deriveFL_*_DLL_DIRbefore the post-build DLL copy — fixes a pre-existing standalone-build latency without touching the SDK helper itselfRisk / follow-ups
sdk/cpp/sample/...will break. Recommend a quick docs sweep.FL_CORE_DLL_DIR/FL_ORT_DLL_DIR/FL_ORTGENAI_DLL_DIRtoCACHEvars insdk/cpp/CMakeLists.txtin a follow-up PR — that would let every future C++ sample callfl_copy_runtime_dlls()without the local workaround.samples/cpp/translation-perf-benchmark/(not in this PR) already lives under the new convention — heads-up before this merges.Verification
sdk/cppclean build: 16/16 ninja steps pass; tests still compilesamples/cpp/sdk-quickstartconfigure + build: succeeds; exe + Foundry Local Core DLL + ONNX Runtime DLLs land in the build dirsamples/cpp/web-server-responses-visionconfigure + build: succeeds; same DLL set lands in the build dircmake --installof the SDK: byte-identical zip layout (bin/+cmake/+include/+lib/+sample/web-server-responses-vision/)git ls-files | Select-String "sdk/cpp/sample"→ empty.github/workflows/has no C++ sample references to updateReviewer asks
sdk-quickstart?CppSdkSample?sample/web-server-responses-vision/for back-compat?