diff --git a/.gitignore b/.gitignore index b00f64a..d53a13d 100644 --- a/.gitignore +++ b/.gitignore @@ -18,4 +18,6 @@ x64/ *.log *.pdb *.py -*.tlog \ No newline at end of file +*.tlog +.zig-cache/ +zig-out/ diff --git a/build.zig b/build.zig new file mode 100644 index 0000000..9df33f3 --- /dev/null +++ b/build.zig @@ -0,0 +1,52 @@ +const std = @import("std"); + +pub fn build(b: *std.Build) void { + const target = b.standardTargetOptions(.{}); + const optimize = b.standardOptimizeOption(.{}); + + const exe_mod = b.createModule(.{ + .target = target, + .optimize = optimize, + }); + + const exe = b.addExecutable(.{ + .name = "Beryl", + .root_module = exe_mod, + }); + + const eigen = b.dependency("Eigen", .{ + .target = target, + .optimize = optimize, + }); + + exe.addCSourceFiles(.{ + .root = b.path(""), + .files = &.{ + "cmdLine.cpp", + "globals.cpp", + "main.cpp", + "permutation.cpp", + "solver.cpp", + "symmetry.cpp", + "util.cpp", + }, + .flags = &.{"-std=c++17"}, + }); + + exe.addIncludePath(eigen.path("")); + + exe.linkLibCpp(); + + b.installArtifact(exe); + + const run_cmd = b.addRunArtifact(exe); + + run_cmd.step.dependOn(b.getInstallStep()); + + if (b.args) |args| { + run_cmd.addArgs(args); + } + + const run_step = b.step("run", "Run the app"); + run_step.dependOn(&run_cmd.step); +} diff --git a/build.zig.zon b/build.zig.zon new file mode 100644 index 0000000..bbf0c63 --- /dev/null +++ b/build.zig.zon @@ -0,0 +1,37 @@ +.{ + .name = .Beryl, + + .version = "0.0.0", + + .fingerprint = 0x565a8f7bc37099d, // Changing this has security and trust implications. + + .minimum_zig_version = "0.14.0", + + .dependencies = .{ + .Eigen = .{ + .url = "https://gitlab.com/libeigen/eigen/-/archive/3.4.0/eigen-3.4.0.tar.gz", + .hash = "N-V-__8AABPI6wAbBLaww8cKO-HchZ0ft-BxUOEOyQtTSccD", + }, + }, + .paths = .{ + "build.zig", + "build.zig.zon", + "cmdLine.cpp", + "cmdLine.h", + "globals.cpp", + "globals.h", + "LICENSE", + "main.cpp", + "permutation.cpp", + "permutation.h", + "plane.h", + "README.md", + "solver.cpp", + "solver.h", + "symmetry.cpp", + "symmetry.h", + "types.h", + "util.cpp", + "util.h", + }, +}