==> src/build.h <==1/* mesh-build-programs: the program catalog from programs/<name>/. */
2#ifndef MESH_BUILD_PROGRAMS_H
3#define MESH_BUILD_PROGRAMS_H
4#include <stdbool.h>
5#include <stddef.h>
6
7typedef struct {
8 const char *root; /* the workspace (holds programs/ and packages/) */
9 const char *out; /* the catalog: MESH_PROGRAMS_OUT, default <root>/out/programs */
10 const char *arch; /* MESH_PTX_ARCH, default sm_86 */
11 const char *sexc; /* the sexc to build with */
12 const char *ptx_link; /* mesh-ptx-link */
13 bool wasm_only; /* MESH_WASM_ONLY=1 */
14 bool native_only; /* MESH_NATIVE_ONLY=1 */
15 bool skip_wasm; /* MESH_SKIP_WASM=1: no wasm images (a GPU-only catalog) */
16} mbp_opts;
17
18/* Builds the named programs (all when n == 0). 0 ok, 1 on the first error (printed). */
19int mbp_run(const mbp_opts *o, char *const *names, size_t n);
20
21/* "@ajax/mesh-prog-hello" -> "ajax-mesh-prog-hello" (sexc's package id). Caller frees. */
22char *mbp_pkg_id(const char *name);
23/* MESH_PTX_ARCH's rule: sm_NN or sm_NNN, optionally a or f. */
24bool mbp_valid_arch(const char *a);
25/* This machine's target triple, as meshd's native executor names it. */
26const char *mbp_triple(void);
27/* A string field of a sexc.json ("name", "kind", "bin"); NULL when absent. Caller frees. */
28char *mbp_json_field(const char *json, const char *key);
29#endif