grace/tpb
Tee your Paste Board
git clone https://git.gae.moe/grace/tpb
c6a3242
main
1const std =@import ( "std" ); 2 3pub fn build ( b : * std . Build ) void { 4const target =b . standardTargetOptions (.{}); 5const optimize =b . standardOptimizeOption (.{}); 6const sdk =b . option ([] const u8 , "sdk" , "Path to the macOS SDK" ); 7const exe =b . addExecutable (.{ 8. name ="tpb" , 9. root_module =b . createModule (.{ 10. root_source_file =b . path ( "src/main.zig" ), 11. target =target , 12. optimize =optimize , 13}), 14}); 15 16b . installArtifact ( exe ); 17 18const tests =b . addTest (.{ 19. name ="tpb" , 20. root_module =b . createModule (.{ 21. root_source_file =b . path ( "src/main.zig" ), 22. target =target , 23. optimize =optimize , 24}), 25}); 26 27if ( target . result . os . tag == . macos ) { 28exe . root_module . link_libc = true ; 29tests . root_module . link_libc = true ; 30 31exe . root_module . addCSourceFiles (.{ 32. files =& .{ "src/Clip/NSPBBridge.m" }, 33. language =. objective_c , 34. flags =& .{ "-fobjc-arc" }, 35}); 36tests . root_module . addCSourceFiles (.{ 37. files =& .{ "src/Clip/NSPBBridge.m" }, 38. language =. objective_c , 39. flags =& .{ "-fobjc-arc" }, 40}); 41 42if ( sdk ) | root | { 43for ([ _ ] * std . Build . Module { exe . root_module , tests . root_module }) |module |{ 44module . addSystemFrameworkPath (.{ . cwd_relative =b . pathJoin ( & .{ root , "System/Library/Frameworks" }) }); 45module . addSystemIncludePath (.{ . cwd_relative =b . pathJoin ( & .{ root , "usr/include" }) }); 46module . addLibraryPath (.{ . cwd_relative =b . pathJoin ( & .{ root , "usr/lib" }) }); 47} 48} 49 50exe . root_module . linkFramework ( "Cocoa" , .{}); 51tests . root_module . linkFramework ( "Cocoa" , .{}); 52} 53 54const test_step =b . step ( "test" , "Run tests" ); 55const run_tests =b . addRunArtifact ( tests ); 56test_step . dependOn ( & run_tests . step ); 57 58const interface_step =b . step ( "interface" , "Check interface (compile tests only)" ); 59const check_interface =b . addInstallArtifact ( tests , .{}); 60interface_step . dependOn ( & check_interface . step ); 61 62const run_step =b . step ( "run" , "Run the app" ); 63 64const run_cmd =b . addRunArtifact ( exe ); 65run_step . dependOn ( & run_cmd . step ); 66 67run_cmd . step . dependOn ( b . getInstallStep ()); 68 69run_cmd . addPassthruArgs (); 70}