skip to content
[readonly]

sexc.json

Every package has one at its root. It's JSON, it's strict, and an unknown field is an error rather than a silent typo.

sexc.json
{
  "name": "@sexc/web",
  "version": "0.1.0",
  "kind": "executable",
  "bin": "sexc-web",
  "sources": ["src/*.c", "src/pages/*.c"],
  "dependencies": {
    "@sexc/core": "workspace:*",
    "@sexc/http": "workspace:*",
    "@sexc/ui": "workspace:*"
  }
}

FIELDS

name
Required. Lowercase letters, digits, ., _ and -, optionally under a scope: @you/thing.
version
Required. Semantic versioning: 0.1.0, 1.2.3-beta.1.
description
One line: what it is.
kind
library (the default) builds a static archive others link against; with no sources it is header-only and lends just its include/. executable builds a program. ptx builds GPU code: its sources and every library it depends on are compiled by clang for nvptx64-nvidia-cuda and linked into one .sexc/out/<profile>/ptx/<id>.ptx. wasm builds a freestanding WebAssembly module, .sexc/out/<profile>/wasm/<id>.wasm, exporting its own non-static functions.
ptx_arch
ptx packages: the GPU architecture, such as sm_86 (the default) or sm_90a. $SEXC_PTX_ARCH overrides it.
targets
Libraries: what they may be compiled for, any of host, nvptx64, wasm32. Default all three. A library is compiled for a device target only when a ptx or wasm package depends on it, and a package's dependencies must build for everything it builds for.
bin
Executables: the program's file name. Defaults to the name without its scope.
main
Executables: the source holding main(). Default src/main.c. Tests link every other object, so they can call your code.
sources
Globs, relative to the package. Default ["src/*.c"].
include
Public headers. Default include when it exists. Packages that depend on this one see it; nobody else does.
tests
Globs for test programs. Default ["tests/*.c"]. Each one is its own program; exit 0 to pass. Tests are host programs for every kind; a ptx or wasm package's tests find the built module in $SEXC_ARTIFACT.
dependencies
An object of package names to versions: a range such as "^1.2.0" from the registry, or "workspace:*" for a package in the same workspace. Only libraries can be dependencies.
cflags
Extra compiler flags for this package's own sources.
ldflags
Extra linker flags, such as -lpthread. Programs that link this package get them too. For a wasm package they go to wasm-ld (e.g. --allow-undefined).
private
true keeps it from ever being published.

LAYOUT

packages/http/
  sexc.json
  include/sexc/http.h   # public: dependents see it
  src/*.c               # private, -I'd for itself
  tests/*.c             # one program each
strict

A package compiles with its own include/ and src/, plus the include/ of each package it depends on, directly or not. If you didn't declare it, you can't include it.

GPU AND WASM

sexc.json
{
  "name": "@you/kernels",
  "version": "0.1.0",
  "kind": "ptx",
  "ptx_arch": "sm_86",
  "dependencies": {"@you/abi": "workspace:*"}
}

Device code is freestanding C: no libc, -ffreestanding, and the profile's sanitizer and debug flags are left out. A kernel is a function with __attribute__((nvptx_kernel)). clang, llvm-link (for ptx) and wasm-ld (for wasm) are found on PATH, as <tool>-21 .. <tool>-15, or in /usr/lib/llvm-*/bin; set $SEXC_CLANG, $SEXC_LLVM_LINK or $SEXC_WASM_LD to choose.

The workspace root has a manifest of its own: see workspaces.txt.