Project Management
A Zynx project is a directory containing a zynx.json configuration file, which defines the workspace, targets, and dependencies.
Creating a Project
zynx new my-app
cd my-app
Select from:
executable: Application with an entry point.library: Reusable module.ffi: Dedicated C bindings project.
Standard Layout
my-app/
├── src/
│ └── main.zx # Entry point
└── zynx.json # Manifest
The zynx.json Manifest
{
"name": "my-app",
"version": "0.1.0",
"entry": "src/main.zx",
"zynx": {
"target": {
"arch": "x86_64",
"platform": "linux",
"abi": "gnu",
"sdk": "system"
}
}
}
entry: Main source file.zynx.target: CPU architecture, OS, ABI, and SDK mode (systemormanaged).
Development Workflow
Build and Run
- Build:
zynx build(useszynx.jsondefaults). - Run:
zynx run(builds and executes the entry point). - Test:
zynx test(runs alltestblocks in the project).
Managing SDKs
For cross-compilation, use managed SDKs:
zynx sdk add <triple> --source <path>
zynx sdk list
Dependencies
Zynx Packages
Add a package to zynx.json:
zynx add <name> --version ^1.0.0
zynx lock
zynx install
C Interop (FFI)
Add local C code:
zynx add mylib --kind ffi --header c/lib.h --source c/lib.c
zynx sync mylib
This compiles the C code and generates Zynx bindings automatically.
Summary Workflow
- Initialize:
zynx new my-app - Configure: Edit
zynx.jsonfor targets and dependencies. - Develop:
zynx build,zynx run, andzynx test. - Extend:
zynx addfor packages or FFI modules.