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.
{
"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 itsinclude/.executablebuilds a program.ptxbuilds GPU code: its sources and every library it depends on are compiled by clang fornvptx64-nvidia-cudaand linked into one.sexc/out/<profile>/ptx/<id>.ptx.wasmbuilds a freestanding WebAssembly module,.sexc/out/<profile>/wasm/<id>.wasm, exporting its own non-static functions.- ptx_arch
ptxpackages: the GPU architecture, such assm_86(the default) orsm_90a.$SEXC_PTX_ARCHoverrides 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 aptxorwasmpackage 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(). Defaultsrc/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
includewhen 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; aptxorwasmpackage'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 awasmpackage they go towasm-ld(e.g.--allow-undefined). - private
truekeeps 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 eachA 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
{
"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.