Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

capnproto: add lite_mode option #26282

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

mologie
Copy link
Contributor

@mologie mologie commented Jan 1, 2025

Summary

Changes to recipe: capnproto/all

Motivation

Cap'n Proto's build scripts provide a "lite mode" build option, where only libkj and a subset of libcapnp (no reflection) is built. This PR exposes it via a Conan option, so that lite mode can be used by Conan packages that do not depend on full functionality and need to be small or more portable (e.g. for old Androids).

Details

The changes to enable lite mode are minimal: This merely modified the value of --enable-reflection/CAPNP_LITE, and updates the components list depending on the option value.

Users can use Cap'n Proto like so to compile schema files in their CMakeLists, while using a stripped-down version of Cap'n Proto in their application (cross-)build.

self.requires("capnproto/1.1.0", options={"lite_mode": True})
self.tool_requires("capnproto/1.1.0")

Tested on macOS 15.2 and cross-compiled to Android with NDK r27 and iOS 18.


@mologie
Copy link
Contributor Author

mologie commented Jan 1, 2025

Hi maintainers, when you get a chance, please also check out PR #23787 from last April; it is relevant to the same project that got me to create this PR. I'd have all customized recipes upstreamed once that one is merged too. Thanks!

Cap'n Proto's lite mode disables all reflection and I/O features, so
that a lean library for encoding and decoding messages remains. This
especially is required for targeting Android with API level 21,
because libkj-async requires API level 23 or later for sigtimedwait.

It may be necessary to additionally add a tool_requires("capnproto")
when using lite mode, just like when cross-compiling, so that capnpc
is available to the lite build of libcapnp and libkj.
@mologie mologie force-pushed the capnproto-lite-mode branch from 1651fdf to 4949ba4 Compare January 2, 2025 13:02
@mologie
Copy link
Contributor Author

mologie commented Jan 2, 2025

kj-test is built in lite mode too, which is now reflected in the recipe

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.

1 participant