Search code examples
boostbuild

`./b2 headers` command in Boost build process


I found that boost's building formula in homebrew do ./b2 headers before ./b2 install.

While the commit message mentions it generates headers, I'm unsure about the specific arguments needed.

./b2 \
    --prefix=$my_install_prefix \
    --build-dir=$my_build_workspace \
    headers \
    threading=multi \
    link=shared \
    variant=release
  • --prefix=$my_install_prefix: Does this argument have any effect with ./b2 headers, or is it only relevant for ./b2 install
  • --build-dir=$my_build_workspace: During building process, this command do leave some object files and logs. Hence I think we may need this argument.
  • threading=multi: For multi-thread environment.
  • link=shared, variant=release: Maybe we don't need it since it's just generate header?

Solution

  • The headers target creates the symlinks from each individual library subproject to the main boost/ include directory.

    Header inclusions are a compiletime action, so none of the compiletime flags are relevant (prefix affects installation, build-dir affects non-header-only library compilation, the variants and threading options affect preprocessor flags, which, again only affect compilation or linkage).

    Just

    ./b2 headers
    

    is always enough.