Add an in-tree Conan recipe, tested by CI - #1315
Open
ArthurSonzogni wants to merge 5 commits into
Open
Conversation
FTXUI is currently only consumable via Conan through the community-maintained recipe on Conan Center, which lags behind releases. This adds a conanfile.py at the repository root wrapping the existing CMake install, plus a test_package smoke test and a GitHub Actions workflow (Linux/macOS/Windows, static/shared) that runs `conan create .` on every push and PR. Related to #1296
|
GitHub Actions stringifies YAML booleans as lowercase true/false in
${{ }} interpolation, but Conan's shared option only accepts True/False.
- node.hpp: the friend declaration of Render() lacked FTXUI_EXPORT(DOM), conflicting with its later dllexport declaration and causing MSVC error C2375 on Windows shared-library builds. - conanfile.py: force the Ninja generator on Windows so Conan doesn't fall back to the multi-config "Visual Studio" generator, which installs libraries into lib/<CONFIG>/ instead of lib/, where Conan expects them. - conan.yaml: install ninja alongside conan on CI runners.
MSVC's dllexport/dllimport only applies to the first declarator in a comma-separated declaration; the rest are treated as redundantly re-declared with dll-interface, causing error C2487. Declare each static const Event constant on its own line so all of them pick up the class's dllexport/dllimport annotation correctly.
StringRef, ConstStringRef, and ConstStringListRef are exported (FTXUI_EXPORT(SCREEN)), but every one of their member functions -- including ones inherited from Ref<string>/ConstRef<string> -- is defined inline in the header and never odr-used from within libftxui-screen itself. MSVC only emits (and therefore dllexports) an inline member function into the DLL that first odr-uses it, so consumers linking against the dllimport declaration got LNK2001 unresolved externals. Add ref.cpp to the screen library across all build systems (CMake, Bazel, Meson) with a throwaway function that exercises every member, forcing MSVC to instantiate and export them.
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
conanfile.pyat the repository root: an in-tree Conan v2 recipe wrapping the existing CMake install (screen/dom/component components,shared/fPICoptions).test_package/— the standard Conan self-test invoked byconan create ., building and running a small example against the packaged library..github/workflows/conan.yaml— CI matrix (Linux/macOS/Windows x static/shared) runningconan create .on every push/PR tomain.doc/installation_conan.mdpointing at the new in-tree recipe.Related to #1296 — FTXUI currently only ships via the community-maintained Conan Center recipe, which lags behind releases. This doesn't replace that recipe, but gives the project its own tested recipe that can serve as the basis for keeping Conan Center up to date.
Verified locally with Conan 2.30.0:
conan create .andconan create . -o "&:shared=True"both succeed, package the three libraries, and the test_package example builds, links, and runs correctly.Test plan
conan create .(static) succeeds locallyconan create . -o "&:shared=True"(shared) succeeds locally.github/workflows/conan.yamlpasses on Linux/macOS/Windows