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

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

  • 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 add to the linker command line whenever the output from this rule is used in a link operation, such as linked into an executable or a shared library.

  • platform_linker_flags (defaults to []) #

    Platform-specific linker flags. This argument is specified as a list of pairs where the first element in each pair is an un-anchored regex against which the platform name is matched. The regex should use java.util.regex.Pattern syntax. The second element in each pair is a list of linker flags. If the regex matches the platform, these flags are added to the linker command line when the output from this rule is used in a link operation.

  • 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 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

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 = [
    # ...
  ],
)