{"id":5881,"library":"cmeel-boost","title":"cmeel-boost: Boost C++ Libraries for CMake-based Python Wheels","description":"cmeel-boost is a cmeel distribution that packages the widely used Boost C++ source libraries. It enables Python projects that utilize `cmeel` as their build backend to seamlessly incorporate and link against Boost C++ components within their CMake-based build process. The library aims to simplify the distribution of Boost for Python wheels. Version 1.89.0 is the latest stable release, with a release cadence that often aligns with upstream Boost versions.","status":"active","version":"1.89.0","language":"en","source_language":"en","source_url":"https://github.com/cmake-wheel/cmeel-boost.git","tags":["C++","Boost","build system","CMake","packaging","wheel","native extension"],"install":[{"cmd":"pip install cmeel-boost","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"cmeel-boost is a distribution for cmeel; cmeel is required as the build backend to consume it.","package":"cmeel"}],"imports":[{"note":"cmeel-boost provides the Boost C++ libraries for use in C++ source files within a project built with cmeel. It does NOT provide Python symbols for direct import into Python code to expose Boost functionality. The 'import' is typically a C++ `#include` in your C++ source code.","symbol":"Boost C++ Headers/Libraries","correct":"#include <boost/..."}],"quickstart":{"code":"# Assume a C++ project 'my_cpp_lib' that uses Boost.\n#\n# 1. pyproject.toml for a Python package that depends on my_cpp_lib\n#    and needs cmeel-boost as a build dependency:\n#\n# [build-system]\n# requires = [\"cmeel[build]\", \"cmeel-boost~=1.89.0\"]\n# build-backend = \"cmeel.build\"\n#\n# [project]\n# name = \"my-python-package\"\n# version = \"0.1.0\"\n#\n# 2. CMakeLists.txt for my_cpp_lib (e.g., in a 'src' subdirectory):\n#\n# cmake_minimum_required(VERSION 3.15)\n# project(my_cpp_lib LANGUAGES CXX)\n#\n# # Find Boost components. cmeel-boost will have installed Boost\n# # in a location discoverable by CMake through CMAKE_PREFIX_PATH set by cmeel.\n# find_package(Boost 1.89.0 REQUIRED COMPONENTS system thread)\n#\n# add_library(my_cpp_lib SHARED my_cpp_lib.cpp)\n# target_include_directories(my_cpp_lib PUBLIC ${Boost_INCLUDE_DIRS})\n# target_link_libraries(my_cpp_lib PUBLIC Boost::system Boost::thread)\n#\n# 3. my_cpp_lib.cpp (example C++ file using Boost):\n#\n# #include <iostream>\n# #include <boost/version.hpp>\n# #include <boost/system/error_code.hpp>\n#\n# extern \"C\" void say_boost_version() {\n#    std::cout << \"Boost Version: \" << BOOST_VERSION / 100000 << \".\";\n#    std::cout << (BOOST_VERSION / 100 % 1000) << \".\";\n#    std::cout << (BOOST_VERSION % 100) << std::endl;\n#    boost::system::error_code ec;\n#    // Example use, not doing anything meaningful with ec here\n#    if (ec) {\n#        std::cerr << \"Error: \" << ec.message() << std::endl;\n#    }\n# }\n#\n# 4. To build a wheel for 'my-python-package':\n#    (Ensure your environment has a C++ compiler compatible with Boost.)\n#    python -m pip wheel .\n\n# Note: This code block demonstrates the C++/CMake usage. The `python -m cmeel cmake` command \n# is typically run internally by `pip` when building a `cmeel`-based package that depends on `cmeel-boost`.\n# For debugging or manual usage in a C++ project outside `cmeel`, you might run:\n# export CMAKE_PREFIX_PATH=$(python -m cmeel cmake)\n# cmake -S . -B build\n# cmake --build build\n\nimport os\n\n# Placeholder for a Python script that might invoke the C++ library (if bindings existed)\n# cmeel-boost itself does not provide Python callable functions.\nprint(\"cmeel-boost provides C++ libraries, not direct Python imports for Boost functionality.\")\nprint(\"To use it, your Python package must be built with cmeel and link against Boost in its CMake project.\")","lang":"python","description":"cmeel-boost is designed to be a build dependency for other Python packages that wrap C++ code requiring Boost. The quickstart illustrates how a `pyproject.toml` declares `cmeel-boost` as a build-system requirement. Subsequently, a `CMakeLists.txt` within the C++ portion of the project can locate and link against Boost components provided by `cmeel-boost` using standard CMake `find_package` commands. The actual C++ code would then include Boost headers and use its functionalities. The `cmeel` backend automatically sets `CMAKE_PREFIX_PATH` to enable CMake to find installed `cmeel` packages like `cmeel-boost`."},"warnings":[{"fix":"Do not attempt to `import cmeel_boost` to use Boost C++ features directly in Python. Instead, use `cmeel-boost` as a build dependency for your C++/Python project and interact with Boost in your C++ source code.","message":"cmeel-boost is a distribution of the *C++ Boost libraries* for `cmeel`-based Python wheels, not a Python wrapper library. You cannot `import cmeel_boost` in Python code and expect to access Boost C++ functionality directly through Python functions or classes. Its purpose is to provide the underlying C++ headers and compiled libraries for other C++/Python projects to link against.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ensure your system has a fully configured C++ development environment (e.g., Visual Studio Build Tools on Windows, `build-essential` on Linux) and a recent version of CMake. On Windows, `conda` is often recommended over `pip` for installing packages with complex C++ build dependencies.","message":"Building projects that depend on `cmeel-boost` (and thus `cmeel` and CMake) requires a robust C++ development environment, including a compatible C++ compiler and CMake. Build failures can occur due to missing toolchains, incorrect compiler versions, or environment misconfigurations, especially on Windows where `pip install` can be challenging for such projects.","severity":"breaking","affected_versions":"All versions"},{"fix":"Refer to CMake's `FindBoost` documentation and ensure your `CMakeLists.txt` correctly specifies Boost versions and components. `cmeel` automatically sets `CMAKE_PREFIX_PATH` to help CMake locate `cmeel-boost` installations. Ensure your build environment has a compatible C++ toolchain for the Boost version provided.","message":"When consuming `cmeel-boost` in your CMake project, ensure you use `find_package(Boost REQUIRED COMPONENTS ...)` correctly. While `cmeel-boost` provides the Boost libraries, CMake still needs to be instructed to find them and link them to your targets. Issues can arise if the Boost version requested by `find_package` is incompatible or if required components are not specified or available.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-14T00:00:00.000Z","next_check":"2026-07-13T00:00:00.000Z","problems":[]}