build.zig
1 // SPDX-License-Identifier: AGPL-3.0-or-later 2 // SPDX-FileCopyrightText: 2025 Hyperpolymath Contributors 3 // 4 // build.zig - Build the Bebop-V-FFI shared library 5 // 6 // Usage: 7 // zig build # Debug build 8 // zig build -Drelease # Release build 9 // zig build test # Run tests 10 11 const std = @import("std"); 12 13 pub fn build(b: *std.Build) void { 14 const target = b.standardTargetOptions(.{}); 15 const optimize = b.standardOptimizeOption(.{}); 16 17 // Build the shared library 18 const lib = b.addSharedLibrary(.{ 19 .name = "bebop_v_ffi", 20 .root_source_file = b.path("src/bridge.zig"), 21 .target = target, 22 .optimize = optimize, 23 }); 24 25 // Also build static library for linking flexibility 26 const static_lib = b.addStaticLibrary(.{ 27 .name = "bebop_v_ffi", 28 .root_source_file = b.path("src/bridge.zig"), 29 .target = target, 30 .optimize = optimize, 31 }); 32 33 // Install both artifacts 34 b.installArtifact(lib); 35 b.installArtifact(static_lib); 36 37 // Install the header for consumers 38 b.installFile("../../include/bebop_v_ffi.h", "include/bebop_v_ffi.h"); 39 40 // Unit tests 41 const unit_tests = b.addTest(.{ 42 .root_source_file = b.path("src/bridge.zig"), 43 .target = target, 44 .optimize = optimize, 45 }); 46 47 const run_unit_tests = b.addRunArtifact(unit_tests); 48 const test_step = b.step("test", "Run unit tests"); 49 test_step.dependOn(&run_unit_tests.step); 50 }