Install pkg-config files for libf3d and libf3d_c_api - #3451
Conversation
|
\ci fast |
|
\ci extended |
So how did you test this locally ? Im a bit confused. |
I didn’t have VTK available locally, so I couldn’t build the full project. What I tested locally was rendering the .pc.in templates with configure_file() in a small standalone CMake project, then validating the generated files with pkg-config --validate, --cflags, and --libs. This confirmed the .pc files themselves. The actual install() wiring in library/CMakeLists.txt and c/CMakeLists.txt was then tested through \ci fast and \ci extended with a real VTK build, and both passed, providing the full end-to-end confirmation. |
Not acceptable, here is the guide to build VTK and F3D. We are not interested by "passing by contributors" by the way. |
Fair enough — I’ll get a proper local build going. I don’t have VTK installed right now, so I’m setting that up first. The repo already has a vcpkg preset that builds VTK from the pinned manifest, so I’ll use that instead of relying on a potentially outdated system package. Once it’s built, I’ll test the actual pkg-config output locally and report back with the results rather than just relying on CI. |
c/CMakeLists.txt calls its own project(f3d_c_api), which resets the generic PROJECT_DESCRIPTION/PROJECT_HOMEPAGE_URL variables for that subdirectory scope. Use the name-qualified F3D_DESCRIPTION/F3D_HOMEPAGE_URL variables instead, which stay tied to the top-level F3D project regardless of nested project() calls.
I followed the guide and did a full local build rather than just relying on the earlier template test.
This also caught a real issue that the CI and standalone template test didn't catch. I fixed this by using the name-qualified The fix is pushed in commit |
Reviewer flagged the top-level project() HOMEPAGE_URL addition as unrelated scope creep for a pkg-config-only change. The URL is a static value, so hardcode it directly in both .pc.in templates instead of threading it through a new CMake project() argument.
mwestphal
left a comment
There was a problem hiding this comment.
Looks good!
Please add simple c and c++ examples in examples/libf3d in order to be able to test this easily.
Plain Makefile-based examples (no CMake) demonstrating how to build against libf3d/libf3d_c_api using the new .pc files, matching the check-engine example's minimal style. Not wired into the CMake example test suite since they intentionally use pkg-config instead of find_package(f3d), same as external-glfw/qt6/fltk being standalone. Built and run locally against a real VTK 9.7.0 + F3D build.
Added both I also built and ran both examples locally against a real VTK 9.7.0 + F3D build to make sure they actually work. One small thing I ran into: VTK doesn't provide a Pushed as |
mwestphal
left a comment
There was a problem hiding this comment.
Nice examples, next please add a step in linux generic ci that configure and build both examples
Yes, expected |
Adds a step after the existing example tests that discovers the installed f3d.pc/f3d_c_api.pc and VTK's lib directory, then builds and runs both pkg-config examples with the sdk component's .pc files, mirroring what a real downstream user would do.
Reviewer pointed out find is unnecessary since the install and dependency paths are already known/used elsewhere in this file.
Hope that answers your questions above. |
|
nevermind, CI is failing already: https://github.com/f3d-app/f3d/actions/runs/32662549287/job/97250874383?pr=3451 |
…docs .pc files baked in the literal (possibly relative) CMAKE_INSTALL_PREFIX string, which broke when read from a different working directory than the build dir - exactly what happened in CI (-DCMAKE_INSTALL_PREFIX=../install). Resolve it to an absolute path before substitution instead. Also confirmed LD_LIBRARY_PATH alone (exported before both building and running) is enough for a non-standard VTK install, since ld also consults it at link time for transitive symbols - drops the separate -Wl,-rpath-link LDFLAGS from both example Makefiles and the CI step.
Fixed the root cause: the .pc files were getting the literal relative CMAKE_INSTALL_PREFIX (../install) baked into them. That worked during cmake --install, but broke when pkg-config read the files from a different working directory. I’ve changed it to resolve the install path to an absolute path before generating the .pc files. Also followed your LD_LIBRARY_PATH suggestion further. Confirmed that exporting it once before both make and running the examples is enough, since the linker also uses it when resolving transitive dependencies. So I removed the separate -Wl,-rpath-link flags from both Makefiles and the CI step. Verified everything locally with a full rebuild using the same relative install prefix as CI, then ran both pkg-config examples end-to-end successfully. Pushed in 803c819. |
|
\ci full |
Hope that answers your questions above. |
|
@Meakk wanna take a look ? |
Describe your changes
.pcpkg-config files forlibf3d(f3d) andlibf3d_c_api(f3d_c_api), installed alongside the existing CMake config files.cmake/f3d.pc.inandcmake/f3d_c_api.pc.intemplates, rendered usingconfigure_file(... @ONLY).library/CMakeLists.txtandc/CMakeLists.txtas part of the existingsdkinstall component.HOMEPAGE_URLto the top-levelproject()call soPROJECT_HOMEPAGE_URLcan be used for the.pcURL:field.Requires.private: f3dtof3d_c_api.pc, matching the private dependency between the two targets..pctemplates instead ofcmake-pcfilegeneratordue to its GPL-3.0 license and its generated library name (-llibf3d) not matching F3D's actualOUTPUT_NAME(-lf3d).pkg-config --validateandpkg-config --cflags --libs.Issue ticket number and link if any
Closes [#3432]
Checklist for finalizing the PR
.github/workflows/versions.json, I have updateddocker_timestampAI Disclosure
I have not used AI to generate any of the content of this pull request
I have used AI to generate code in this pull request:
Used Claude (Anthropic, Claude Sonnet 5, via Claude Code) to help write
cmake/f3d.pc.inandcmake/f3d_c_api.pc.in, theconfigure_file()/install()wiring inlibrary/CMakeLists.txtandc/CMakeLists.txt, and theHOMEPAGE_URLline in the top-levelCMakeLists.txt....
Continuous integration
Please write a comment to run CI, eg:
\ci fast.See here for more info.(https://f3d.app/dev/CONTRIBUTING#continuous-integration) for more info.