robin/cdl
cute fetch client written in zig
git clone https://git.robinwobin.dev/robin/cdl
4a5e316
main
1const std =@import ( "std" ); 2 3pub fn build ( b : * std . Build ) void { 4const target =b . standardTargetOptions (.{}); 5const optimize =b . standardOptimizeOption (.{}); 6 7const mod =b . addModule ( "cdl" , .{ 8. root_source_file =b . path ( "src/root.zig" ), 9. target =target , 10. optimize =optimize , 11}); 12 13const exe =b . addExecutable (.{ 14. name ="cdl" , 15. root_module =b . createModule (.{ 16. root_source_file =b . path ( "src/main.zig" ), 17. target =target , 18. optimize =optimize , 19}), 20}); 21 22exe . root_module . addImport ( "cdl" , mod ); 23 24b . installArtifact ( exe ); 25 26// deps =================================================================== 27 28const c_wchar =b . addTranslateC (.{ 29. root_source_file =b . path ( "src/wchar.h" ), 30. target =target , 31. optimize =optimize , 32}); 33 34mod . addImport ( "wchar" , c_wchar . createModule ()); 35 36// run ==================================================================== 37 38const run_step =b . step ( "run" , "Run" ); 39 40const run_cmd =b . addRunArtifact ( exe ); 41run_step . dependOn ( & run_cmd . step ); 42 43run_cmd . step . dependOn ( b . getInstallStep ()); 44 45if ( b . args ) | args | { 46run_cmd . addArgs ( args ); 47} 48 49// test =================================================================== 50 51const test_step =b . step ( "test" , "Test" ); 52 53const test_step_run =b . addRunArtifact ( b . addTest (.{ 54. root_module =mod , 55})); 56test_step . dependOn ( & test_step_run . step ); 57}