cppo

load("@tools_ocaml//rules:cppo.bzl", "cppo")

Process file with cppo.

Example:

cppo(
    name = "ExtArray.cppo_mli",
    srcs = ["extArray.mli"],
    opts = ["-I", "foo"],
    defines = [
        "OCAML 407"
    ] + WORD_SIZE + HAS_BYTES_FLAG,
    undefines = ["FOO"],
    exts = {
        "lowercase": 'tr "[A-Z]" "[a-z]"'
    }
)

Output has same name as input, but is output to a Bazel-controlled dir (e.g. bazel-bin/src)

ATTRIBUTES for rule cppo:

Name Description Type Mandatory Default

name

A unique name for this target.

Name

required

srcs

-

List of labels

optional

[]

outs

-

List of labels

optional

[]

defines

CPPO -D (define) declarations.

List of strings

optional

[]

exts

Defines custom preprocessor target section (-x parameter)

Dictionary: String -> String

optional

{}

msg

-

String

optional

""

opts

-

List of strings

optional

[]

undefines

CPPO -U (undefine) declarations.

List of strings

optional

[]

vars

Dictionary of cppo VAR (-V) options. Keys: label. Values: string VAR name.

Dictionary: Label -> String

optional

{}