ppx_executable Last updated Mar 27, 2025

load("@rules_ppx//build:rules.bzl", "ppx_executable")

Generates a PPX executable. Provides: [OcamlExecutableMarker](providers_ppx.md#ppxexecutableprovider).

Attributes

Name Description Type Mandatory Default

name

A unique name for this target.

Name

required

data

Runtime data dependencies. E.g. a file used by %%import from ppx_optcomp.

List of labels

optional

[]

archive_deps

-

Boolean

optional

False

bin

Precompiled ppx executable

Label

optional

None

cc_deps

C/C++ library dependencies

Dictionary: Label -> String

optional

{}

cc_linkall

True: use -whole-archive (GCC toolchain) or -force_load (Clang toolchain). Deps in this attribute must also be listed in cc_deps.

List of labels

optional

[]

cc_linkopts

List of C/C link options. E.g. `["-lstd"]`.

List of strings

optional

[]

data_prefix_map

Map for replacing path prefixes of data files. May be used to strip a path prefix (set value to empty string "").

Dictionary: String -> String

optional

{}

env

Env variables

Dictionary: String -> String

optional

{}

epilogue

List of OCaml dependencies.

List of labels

optional

[]

exe

Name for output executable file. Overrides 'name' attribute.

String

optional

""

exe_name

By default, executable name is derived from 'name' attribute; use this to override.

String

optional

""

force_archived_libdeps

Force archiving of library dependencies

Boolean

optional

False

main

A module to be listed after those in 'prologue' and before those in 'epilogue'. For more information see [Main Module](../ug/ppx.md#main_module).

Label

required

opts

List of compile options; overrides configurable default options. Supports -no- prefix for each option; for example, -no-linkall.

List of strings

optional

[]

ppx_codeps

List of non-opam adjunct dependencies (labels).

List of labels

optional

[]

prologue

List of OCaml dependencies.

List of labels

optional

[]

runtime

runtime to use

Label

optional

"@rules_ocaml//rt:std"

vm_linkage

custom, dynamic or static. Custom means link with -custom flag; static with -output-complete-exe

String

optional

"custom"