diff --git a/.gitignore b/.gitignore index f7595dd..54b7224 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,7 @@ *.csv main main.o +.zig-cache zig-cache zig-out +result diff --git a/build.zig b/build.zig index a5f282f..9a26412 100644 --- a/build.zig +++ b/build.zig @@ -29,11 +29,16 @@ pub fn build(b: *std.Build) void { const optimize = b.standardOptimizeOption(.{}); // Module declarations - const strings = b.addModule("sonic-strings", .{ .root_source_file = .{ .path = "src/strings.zig" } }); - const sonic = b.addModule("sonic", .{ .root_source_file = .{ .path = "src/records.zig" } }); + const strings = b.addModule("sonic-strings", .{ .root_source_file = b.path("src/strings.zig") }); + const sonic = b.addModule( + "sonic", + .{ .root_source_file = b.path("src/records.zig") }, + ); sonic.addImport("strings", strings); - const fastaModule = b.addModule("sonic-fasta", .{ .root_source_file = .{ .path = "src/fasta-lib.zig" } }); + const fastaModule = b.addModule("sonic-fasta", .{ + .root_source_file = b.path("src/fasta-lib.zig"), + }); fastaModule.addImport("strings", strings); fastaModule.addImport("sonic", sonic); @@ -41,11 +46,9 @@ pub fn build(b: *std.Build) void { .name = "pdb2fasta", // In this case the main source file is merely a path, however, in more // complicated build scripts, this could be a generated file. - .root_source_file = .{ .path = "src/fasta.zig" }, + .root_source_file = b.path("src/fasta.zig"), .target = target, .optimize = optimize, - .use_lld = false, - .use_llvm = false, }); fasta.root_module.addImport("sonic-fasta", fastaModule); fasta.root_module.addImport("sonic", sonic); @@ -61,11 +64,9 @@ pub fn build(b: *std.Build) void { .name = "sonic-pdb-parser", // In this case the main source file is merely a path, however, in more // complicated build scripts, this could be a generated file. - .root_source_file = .{ .path = "src/main.zig" }, + .root_source_file = b.path("src/main.zig"), .target = target, .optimize = optimize, - .use_lld = false, - .use_llvm = false, }); exe.root_module.addImport("sonic", sonic); exe.root_module.addImport("strings", strings); @@ -101,11 +102,9 @@ pub fn build(b: *std.Build) void { // Creates a step for unit testing. This only builds the test executable // but does not run it. const unit_tests = b.addTest(.{ - .root_source_file = .{ .path = "src/main.zig" }, + .root_source_file = b.path("src/main.zig"), .target = target, .optimize = optimize, - .use_llvm = false, - .use_lld = false, }); unit_tests.root_module.addImport("sonic", sonic); unit_tests.root_module.addImport("strings", strings); @@ -114,8 +113,6 @@ pub fn build(b: *std.Build) void { .root_source_file = b.path("src/records.zig"), .target = target, .optimize = optimize, - .use_llvm = false, - .use_lld = false, }); sonic_test.root_module.addImport("strings", strings); @@ -123,8 +120,6 @@ pub fn build(b: *std.Build) void { .root_source_file = b.path("src/strings.zig"), .target = target, .optimize = optimize, - .use_llvm = false, - .use_lld = false, }); const run_unit_tests = b.addRunArtifact(unit_tests); diff --git a/flake.lock b/flake.lock index 6d42d82..aa618a6 100644 --- a/flake.lock +++ b/flake.lock @@ -3,11 +3,11 @@ "flake-compat": { "flake": false, "locked": { - "lastModified": 1673956053, - "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", "owner": "edolstra", "repo": "flake-compat", - "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", "type": "github" }, "original": { @@ -35,12 +35,15 @@ } }, "flake-utils_2": { + "inputs": { + "systems": "systems_2" + }, "locked": { - "lastModified": 1659877975, - "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", + "lastModified": 1705309234, + "narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=", "owner": "numtide", "repo": "flake-utils", - "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", + "rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26", "type": "github" }, "original": { @@ -71,11 +74,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1713596654, - "narHash": "sha256-LJbHQQ5aX1LVth2ST+Kkse/DRzgxlVhTL1rxthvyhZc=", + "lastModified": 1723221148, + "narHash": "sha256-7pjpeQlZUNQ4eeVntytU3jkw9dFK3k1Htgk2iuXjaD8=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "fd16bb6d3bcca96039b11aa52038fafeb6e4f4be", + "rev": "154bcb95ad51bc257c2ce4043a725de6ca700ef6", "type": "github" }, "original": { @@ -108,6 +111,21 @@ "type": "github" } }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, "zig-overlay": { "inputs": { "flake-compat": "flake-compat", @@ -117,11 +135,11 @@ ] }, "locked": { - "lastModified": 1713572548, - "narHash": "sha256-bYNsY9HwrV8+eJGRYvfLEP6/Sgf2Kr9qNbnB91OYMMM=", + "lastModified": 1723291738, + "narHash": "sha256-C3DobEyzw47Rvs9tRpe8XGrqGl4hLABu1wocjxczJ/U=", "owner": "mitchellh", "repo": "zig-overlay", - "rev": "76bccd85db6a182dfcbf8a5f4b540953f029a12c", + "rev": "d132903f2088ee03cf3561368a81cd3bd850f5ff", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index bece495..faf5048 100644 --- a/flake.nix +++ b/flake.nix @@ -21,7 +21,7 @@ flake-utils.lib.eachSystem systems (system: let pkgs = nixpkgs.legacyPackages.${system}; - zig = zig-overlay.packages.${system}.master; + zig = zig-overlay.packages.${system}."0.13.0"; in rec { formatter = nixpkgs.legacyPackages.${system}.nixpkgs-fmt; diff --git a/src/fasta-lib.zig b/src/fasta-lib.zig index 7b3ba59..ff47ad1 100644 --- a/src/fasta-lib.zig +++ b/src/fasta-lib.zig @@ -3,7 +3,7 @@ const strings = @import("strings"); const records = @import("sonic"); const Record = records.Record; -const newTerms = std.ComptimeStringMap(u8, .{ +const newTerms = std.StaticStringMap(u8).initComptime(.{ .{ "ALA", 'A' }, .{ "VAL", 'V' }, .{ "PHE", 'F' },