Skip to main content

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 (system or managed).

Development Workflow

Build and Run

  • Build: zynx build (uses zynx.json defaults).
  • Run: zynx run (builds and executes the entry point).
  • Test: zynx test (runs all test blocks 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

  1. Initialize: zynx new my-app
  2. Configure: Edit zynx.json for targets and dependencies.
  3. Develop: zynx build, zynx run, and zynx test.
  4. Extend: zynx add for packages or FFI modules.