Skip to content

Install

00JCIV00 edited this page Oct 2, 2024 · 2 revisions

Package Manager

  1. Find the latest v#.#.# commit here.
  2. Copy the full SHA for the commit.
  3. Add the dependency to build.zig.zon:
zig fetch --save "https://github.com/00JCIV00/cova/archive/<GIT COMMIT SHA FROM STEP 2 HERE>.tar.gz"
  1. Add the dependency and module to build.zig:
// Cova Dependency
const cova_dep = b.dependency("cova", .{ .target = target, .optimize = optimize });
// Cova Module
const cova_mod = cova_dep.module("cova");
// Executable
const exe = b.addExecutable(.{
    .name = "cova_example",
    .root_source_file = .{ .path = "src/main.zig" },
    .target = target,
    .optimize = optimize,
});
// Add the Cova Module to the Executable
exe.root_module.addImport("cova", cova_mod);

Package Manager - Alternative

Note, this method makes Cova easier to update by simply re-running zig fetch --save https://github.com/00JCIV00/cova/archive/[BRANCH].tar.gz. However, it can lead to non-reproducible builds because the url will always point to the newest commit of the provided branch. Details can be found in this discussion.

  1. Choose a branch to stay in sync with.
  • main is the latest stable branch.
  • The highest v#.#.# is the development branch.
  1. Add the dependency to build.zig.zon:
zig fetch --save https://github.com/00JCIV00/cova/archive/[BRANCH FROM STEP 1].tar.gz
  1. Continue from Step 4 above.

Build the Basic-App Demo from source

  1. Use Zig v0.12 for your system. Available here.
  2. Run the following in whichever directory you'd like to install to:
git clone https://github.com/00JCIV00/cova.git
cd cova
zig build basic-app -Doptimize=ReleaseSafe
  1. Try it out!
cd bin 
./basic-app help