typhoon/build.zig

82 lines
1.9 KiB
Zig
Raw Normal View History

2024-06-28 04:30:37 -04:00
const std = @import("std");
const system = @import("system");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
// Typhoon library
const tempest = b.addStaticLibrary(.{
.name = "tempest",
.target = target,
.optimize = optimize
});
// Link C++ standard library
tempest.linkLibCpp();
// Add system detection defines
system.add_defines(tempest);
// Get dependencies
const squall = b.dependency("squall", .{});
// Link storm
tempest.linkLibrary(squall.artifact("storm"));
// Include Typhoon project directory
tempest.addIncludePath(b.path("."));
const tempest_compiler_flags = [_][]const u8 {
"-std=c++11",
};
const tempest_sources = [_][]const u8 {
"tempest/matrix/C44Matrix.cpp",
"tempest/quaternion/C4Quaternion.cpp",
"tempest/rect/CRect.cpp",
"tempest/vector/C2Vector.cpp",
"tempest/vector/C3Vector.cpp",
"tempest/vector/CImVector.cpp"
};
tempest.addCSourceFiles(.{
.files = &tempest_sources,
.flags = &tempest_compiler_flags
});
2024-07-03 14:43:55 -04:00
tempest.installHeadersDirectory(b.path("tempest"), "tempest", .{ .include_extensions = &.{"hpp"} });
2024-06-28 04:30:37 -04:00
// TempestTest executable
const tempest_test_exe = b.addExecutable(.{
.name = "TempestTest",
.target = target,
.optimize = optimize
});
// Link C++ standard library
tempest_test_exe.linkLibCpp();
// Add system detection defines
system.add_defines(tempest_test_exe);
2024-07-03 15:05:37 -04:00
// Link tempest
2024-06-28 04:30:37 -04:00
tempest_test_exe.linkLibrary(tempest);
2024-07-03 15:05:37 -04:00
// Link storm
tempest_test_exe.linkLibrary(squall.artifact("storm"));
2024-06-28 04:30:37 -04:00
tempest_test_exe.addIncludePath(b.path("."));
tempest_test_exe.addCSourceFiles(.{
.files = &.{
"test/Math.cpp",
"test/Matrix.cpp",
"test/Rect.cpp",
"test/Test.cpp",
"test/Vector.cpp"
},
.flags = &tempest_compiler_flags
});
b.installArtifact(tempest_test_exe);
b.installArtifact(tempest);
}