Skip to content

fix: add STDEXEC_BUILD_SYSTEM_CONTEXT option and fix Conan recipe for header-only vs compiled package#1930

Open
solarispika wants to merge 2 commits intoNVIDIA:mainfrom
solarispika:fix-conan-system-context
Open

fix: add STDEXEC_BUILD_SYSTEM_CONTEXT option and fix Conan recipe for header-only vs compiled package#1930
solarispika wants to merge 2 commits intoNVIDIA:mainfrom
solarispika:fix-conan-system-context

Conversation

@solarispika
Copy link

Fixes #1540

Problem

The Conan recipe had two related issues:

  1. CMake always built system_context — there was no option to skip it, even though the README says the library is header-only.
  2. package_id() called self.info.clear() unconditionally — this treated the package as always header-only, even when system_context (a compiled binary) was included. The cpp_info.libs = ["system_context"] entry was also generating an incorrect/missing CMake target.

Changes

CMake (CMakeLists.txt, test/CMakeLists.txt)

  • Added STDEXEC_BUILD_SYSTEM_CONTEXT option (default OFF) to match the README's header-only claim
  • Wrapped system_context library target creation and installation in if(STDEXEC_BUILD_SYSTEM_CONTEXT)
  • Wrapped test.system_context_replaceability test target in the same guard

Conan (conanfile.py)

  • Added system_context option (default False)
  • Added configure() to set package_type dynamically ("header-library" or "static-library")
  • Fixed package_id() to only clear settings when system_context=False (i.e. header-only)
  • Fixed package_info() to declare system_context as a component so CMakeDeps correctly generates the STDEXEC::system_context CMake target

Test package (test_package/CMakeLists.txt, test_package/test.cpp)

  • Use $<TARGET_NAME_IF_EXISTS:STDEXEC::system_context> to link conditionally
  • Use if(TARGET STDEXEC::system_context) to set STDEXEC_TEST_SYSTEM_CONTEXT compile definition
  • test.cpp selects between exec::get_parallel_scheduler() and exec::static_thread_pool at compile time via #ifdef

Testing

# Header-only (default) — package_id is empty hash (da39a3ee...)
conan create . --build=missing -tf test_package

# With system_context — package_id reflects platform/compiler settings
conan create . -o system_context=True --build=missing -tf test_package

…_context

system_context is an optional compiled component; defaults to OFF to match
the README claim that stdexec is header-only. Users who need
exec::get_system_scheduler() opt in by setting this option to ON.
…package_id

- Add system_context option (default False) to reflect that stdexec is
  header-only by default; opt in to build the compiled system_context library
- Set package_type dynamically in configure(): header-library or static-library
- package_id() clears settings only when system_context=False (header-only)
- Pass STDEXEC_BUILD_SYSTEM_CONTEXT to CMake based on the option
- Declare system_context as a Conan component so CMakeDeps generates the
  STDEXEC::system_context target for consumers
- test_package: conditionally link and test system_context when available
@copy-pr-bot
Copy link

copy-pr-bot bot commented Mar 13, 2026

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

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.

To Be Header-Only or Not to Be?

1 participant