Buck: halide_library()

halide_library()

This is liable to change in the future.

A halide_library() rule represents a set of Halide sources, along with the "compiler" code needed to compile them into object format (see the Halide site for information about Halide and about static compilation of Halide pipelines). The object code will be generated for the target architecture.

Arguments

  • name (required) #

    The name of the rule.

  • srcs (required) #

    The set of halide sources to compile for this rule. The sources will be compiled and linked for the host architecture, and the resulting binary will be run to produce the object code for the Halide pipeline.

  • deps (defaults to []) #

    The dependencies of the generated halide pipeline code. This is useful if, for exmaple, your pipeline calls an external function using Halide::Func::define_extern.

  • compiler_deps (defaults to []) #

    The dependencies of the halide compiler itself. Targets that depend on the halide_library rule will not include or link the outputs of these targets.

  • compiler_flags (defaults to []) #

    Flags to use when compiling any of the above sources (which require compilation).

  • platform_compiler_flags (defaults to []) #

    Platform specific compiler flags. 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 flags to use when compiling the target's sources. See compiler_flags for more information.

  • linker_flags (defaults to []) #

    Flags to use whenever this rule is involved in a link operation (e.g linked into an executable or shared library).

  • platform_linker_flags (defaults to []) #

    Platform specific linker flags. 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 flags to use when this target is involved in a link operation. See linker_flags for more information.

  • supported_platforms_regex (defaults to None) #

    If present, an un-anchored regex (in java.util.regex.Pattern syntax) that matches all platforms that this library supports. It will not be built for other platforms.

  • 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

halide_library(
  # Your library name.
  name = 'brighter',

  # Your pipeline + compiler sources.
  srcs = ['halide/main.cpp'],

  # Any dependencies for your compiler. Note that targets that depend on
  # this rule WILL NOT include or link the output(s) of these targets.
  compiler_deps = [
    # You'll need libHalide to use this rule; in our example, we assume it's
    # located in the 'third-party/halide' directory.
    '//third-party/halide:halide'
  ],

  # Any dependencies for your generated shader. Targets that depend on this
  # rule will include and/or link the output(s) of these targets.
  deps = [
    # ...
  ],
)