Buck: prebuilt_cxx_library_group()

prebuilt_cxx_library_group()

This is liable to change in the future.

A prebuilt_cxx_library_group() rule represents a group of native libraries which should be handled together in a single rule, perhaps using special link-line construction.

Arguments

  • name (required) #

    The name of the rule.

  • exported_preprocessor_flags (defaults to []) #

    Just as preprocessor_flags, flags to use when preprocessing any of the above sources (which require preprocessing). However, unlike preprocessor_flags, these preprocessor flags are also used by rules that transitively depend on this rule when preprocessing their own sources.

  • static_libs (defaults to []) #

    The paths to the libraries used when using the static link style. The static_link parameter should refer to these libs using their index number.

  • static_pic_libs (defaults to []) #

    The paths to the libraries used when using the static link style. The static_pic_link parameter should refer to these libs using their index number.

  • shared_libs (defaults to {}) #

    The map of shared library names to paths used when using the shared link style. The shared_link parameter should refer to these libs using their library name.

  • provided_shared_libs (defaults to {}) #

    The map of system-provided shared library names to paths used when using the shared link style. The shared_link parameter should refer to these libs using their library name.

  • exported_deps (defaults to []) #

    Dependencies that will also appear to belong to any rules that depend on this one. Currently, this only affects linking: exported dependencies will also be included in the link line of dependents of this rules, but normal dependencies will not.

  • visibility (defaults to []) #

    List of build target patterns that identify the build rules that can include this rule in its deps.

  • licenses (defaults to []) #

    Set of license files for this library. To get the list of license files for a given build rule and all of its dependencies, you can use buck query.

  • labels (defaults to []) #

    Set of arbitrary strings which allow you to annotate a build rule with tags that can be searched for over an entire dependency tree using buck query attrfilter.

Examples

A prebuilt library group wrapping two libraries that must be linked together.

prebuilt_cxx_library_group(
  name = 'util',
  static_link = [
    '-Wl,--start-group',
    '$(lib 0)',
    '$(lib 1)',
    '-Wl,--end-group',
  ],
  static_libs = [
    'lib/liba.a',
    'lib/libb.a',
  ],
  static_pic_link = [
    '-Wl,--start-group',
    '$(lib 0)',
    '$(lib 1)',
    '-Wl,--end-group',
  ],
  static_libs = [
    'lib/liba_pic.a',
    'lib/libb_pic.a',
  ],
  shared_link = [
    '$(rel-lib liba.so)',
    '$(rel-lib libb.so)',
  ],
  shared_libs = {
    'liba.so': 'lib/liba.so',
  },
  provided_shared_libs = {
    'libb.so': 'lib/libb.so',
  },
)