Buck: prebuilt_cxx_library_group()
Support Ukraine. Help Provide Humanitarian Aid to Ukraine.

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 short name for this build target.

  • 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. This has two effects:

    • Exported dependencies will also be included in the link line of dependents of this rules, but normal dependencies will not.
    • When reexport_all_header_dependencies = False, only exported headers of the rules specified here are re-exported.

  • exported_platform_deps (defaults to []) #

    Platform specific dependencies that will also appear to belong to any rules that depend on this one. These should be specified as a list of pairs where the first element is an un-anchored regex (in java.util.regex.Pattern syntax) against which the platform name is matched, and the second element is a list of external dependencies (same format as exported_deps) that are exported if the platform matches the regex. See exported_deps for more information.

  • visibility (defaults to []) #

    List of build target patterns that identify the build rules that can include this rule as a dependency, for example, by listing it in their deps or exported_deps attributes. For more information, see visibility.

  • 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',
  },
)