Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ The `examples/` directory contains several demonstrations:
Demonstrates homomorphic integer addition using a full adder circuit:

```bash
zig build add_two_numbers -Doptimize=ReleaseFast -Dcpu=native
zig build add_two_numbers
```

This example adds two 16-bit numbers (402 + 304 = 706) entirely in the encrypted domain using homomorphic XOR, AND, and OR gates. See [examples/README.md](examples/README.md) for details.
Expand All @@ -109,9 +109,9 @@ zig build test
Run specific test modules:

```bash
zig test src/gates.zig --test-filter "gates all" -Doptimize=ReleaseFast -Dcpu=native
zig test src/utils.zig -Doptimize=ReleaseFast -Dcpu=native
zig test src/key.zig --test-filter "secret key" -Doptimize=ReleaseFast -Dcpu=native
zig test src/gates.zig --test-filter "gates all"
zig test src/utils.zig
zig test src/key.zig --test-filter "secret key"
```

**Note**: The full test suite includes cloud key generation which takes ~30 seconds. Use test filters to run faster subsets during development.
Expand Down
20 changes: 18 additions & 2 deletions build.zig
Original file line number Diff line number Diff line change
@@ -1,8 +1,24 @@
const std = @import("std");

pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
// Default to native CPU with all features for best performance
const target = b.standardTargetOptions(.{
.default_target = .{
.cpu_arch = null, // Use native architecture
.os_tag = null, // Use native OS
.abi = null, // Use native ABI
.cpu_model = .native, // Use native CPU model (enables CPU-specific optimizations)
},
});

// Default to ReleaseFast for optimal performance
// TFHE is computationally intensive, so we want fast execution by default
// Can still override with -Doptimize=Debug for debugging
const optimize = b.option(
std.builtin.OptimizeMode,
"optimize",
"Prioritize performance, safety, or binary size (-O flag)",
) orelse .ReleaseFast;

// Create a module for the main source
const main_module = b.addModule("main", .{
Expand Down
Loading