colcon-pkg-config

0.1.0 · active · verified Fri Apr 17

colcon-pkg-config is a colcon extension that provides an environment hook to correctly set the `PKG_CONFIG_PATH` during `colcon build` operations. It ensures that `share/pkgconfig` directories of previously installed packages within the workspace are added to `PKG_CONFIG_PATH`, making `pkg-config` files discoverable for subsequent builds. The current version is 0.1.0, and its release cadence is infrequent, typically aligning with colcon core developments or specific ROS releases.

Common errors

Warnings

Install

Quickstart

colcon-pkg-config is a plugin, not a library with direct user-facing Python imports or functions. Its quickstart involves installation and then simply running `colcon build` within a workspace, where it automatically enhances the build environment. The example above illustrates the conceptual steps, as `colcon build` is a shell command.

# colcon-pkg-config is a colcon extension and does not provide direct Python APIs for userland code.
# Its functionality is automatically integrated into the 'colcon build' process once installed.

# To use:
# 1. Install colcon-pkg-config in the same Python environment as colcon-core:
#    pip install colcon-pkg-config

# 2. Set up a colcon workspace with packages that produce and consume .pc files.
#    For example, 'pkg_a' installs 'libpkg_a.pc' and 'pkg_b' uses 'pkg-config --cflags --libs libpkg_a'.
#    mkdir -p my_colcon_ws/src/pkg_a
#    mkdir -p my_colcon_ws/src/pkg_b
#    # (populate pkg_a's CMakeLists.txt to install a .pc file to share/pkgconfig)
#    # (populate pkg_b's CMakeLists.txt to use find_package(PkgConfig) and pkg_check_modules(libpkg_a ...))

# 3. Build your colcon workspace from the root of 'my_colcon_ws':
#    import os
#    if os.path.exists('src'): # Simulate running in a colcon workspace
#        print('Building colcon workspace. colcon-pkg-config will automatically augment PKG_CONFIG_PATH.')
#        # This conceptual command would be run in a shell:
#        # os.system('colcon build --symlink-install')
#    else:
#        print('Please run this conceptual quickstart within a colcon workspace root.')

# The extension ensures that pkg_b correctly finds pkg_a's .pc file without manual PKG_CONFIG_PATH setup.

view raw JSON →