Add gdb targets to build.ninja

Since ninja run each build job with its own stdin/out/err we can’t launch gdb itself in a build job, so we use osascript to launch gdb in a new window.

I used Terminal for this only because it is simpler to script than iTerm2.
This commit is contained in:
Allan Odgaard
2012-08-15 17:42:33 +02:00
parent 4a22d1af54
commit 218551185b

View File

@@ -444,10 +444,12 @@ def static_executable(target)
libs = prepend('-l', all_values_for_key(target, 'LIBS'))
res << " RAVE_FLAGS = #{fws} #{libs}\n"
res << "build #{dst}.run: run_executable #{dst}\n"
res << "build #{dst}.run: run_executable #{dst}\n"
res << "build #{dst}.debug: debug_executable #{dst}\n"
res << "build #{target[:name]}: phony #{dst}\n"
res << "build #{target[:name]}/run: phony #{dst}.run\n"
res << "build #{target[:name]}: phony #{dst}\n"
res << "build #{target[:name]}/run: phony #{dst}.run\n"
res << "build #{target[:name]}/debug: phony #{dst}.debug\n"
res
end
@@ -510,12 +512,14 @@ def app_bundle(target)
res << "build #{dst}: phony | #{deps.join(' ')}\n"
res << "build #{dst}.sign: sign_executable #{dst}\n"
res << "build #{dst}.run: run_application #{dst} | #{dst}.sign\n"
res << "build #{dst}.sign: sign_executable #{dst}\n"
res << "build #{dst}.run: run_application #{dst} | #{dst}.sign\n"
res << " appname = #{target[:name]}\n"
res << "build #{dst}.debug: debug_executable #{dst}/Contents/MacOS/#{target[:name]}\n"
res << "build #{target[:name]}: phony #{dst}.sign\n"
res << "build #{target[:name]}/run: phony #{dst}.run\n"
res << "build #{target[:name]}: phony #{dst}.sign\n"
res << "build #{target[:name]}/run: phony #{dst}.run\n"
res << "build #{target[:name]}/debug: phony #{dst}.debug\n"
target[:rsrc_info] = all_files
@@ -662,6 +666,7 @@ open("#{builddir}/build.ninja", "w") do |io|
io << "\n"
io << "build run: phony #{variables.find { |k, _| k == 'APP_NAME' }.last}/run\n"
io << "build deploy: phony #{variables.find { |k, _| k == 'APP_NAME' }.last}/deploy\n"
io << "build debug: phony #{variables.find { |k, _| k == 'APP_NAME' }.last}/debug\n"
io << "default run\n"
end
@@ -712,6 +717,10 @@ rule run_executable
command = $in
description = Run $in
rule debug_executable
command = osascript >/dev/null -e $$'tell app "Terminal" \n activate \n do script "gdb $in" \n end tell'
description = Debug $in
rule run_application
command = { $
if pgrep -q "$appname"; then $