Workspaces
A workspace is a folder with a sexc.json that has workspaces in it. sexc finds it by walking up from wherever you are, so commands work from any folder inside. A lone package with no workspace above it works too.
{
"name": "sexc-monorepo",
"private": true,
"workspaces": ["packages/*", "apps/*"],
"cflags": ["-std=c17", "-Wall", "-Wextra", "-Werror"],
"profiles": {
"debug": { "cflags": ["-g", "-O0"] },
"release": { "cflags": ["-O2", "-DNDEBUG"] }
}
}ROOT FIELDS
- workspaces
- Globs of package folders, like
["packages/*", "apps/*"]. Any folder they match that has asexc.jsonis a package. - cflags
- Flags for every compile in the workspace, before each package's own.
- ldflags
- Flags for every link.
- profiles
- Named sets of
cflagsandldflags:debugis used unless you pass--profileor--release.
HOW A BUILD GOES
- Packages are ordered so each builds after what it depends on. A cycle is an error that names every package in it.
- Every source in every package compiles at once, one compiler per CPU. Errors from parallel compiles never interleave.
- A file recompiles when it, any header it includes, or its command line changed. Nothing else does.
- Libraries are archived, programs linked, each only when an input changed.
- Each source file is compiled with
-DSX_PACKAGE_NAMEand-DSX_PACKAGE_VERSIONfrom its package's manifest.
OUTPUT
.sexc/out/<profile>/obj/... objects, with .d and .cmd
.sexc/out/<profile>/lib/ lib<package>.a
.sexc/out/<profile>/bin/ programs
.sexc/out/<profile>/test/ test programs
compile_commands.json for clangd and editorsEverything under .sexc/ can be deleted at any time; sexc clean does it.