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