add photo support for multiple targets

This commit is contained in:
King Kévin 2014-03-26 12:45:42 +01:00
parent 488c214153
commit 3ed46214f2
1 changed files with 22 additions and 24 deletions

View File

@ -39,37 +39,31 @@ end
desc "main building task"
#task :default => [:version,:print,:notes,:photo,:gerber]
task :default => [:version,:print]
task :default => [:version,:print,:notes,:photo]
desc "create release file"
release = "hardware-release_v#{version}.tar.gz"
task :release => release
CLOBBER.include(release) if File.exist? release
CLOBBER.include(release)
desc "set version in schematic and layout"
versions = targets.collect{|target| [target[:vsch],target[:vpcb]]}.flatten
task :version => versions
versions.each do |version|
CLEAN.include(version) if File.exist? version
end
CLEAN.include(versions)
targets.each do |target|
CLOBBER.include("#{target[:name]}_*.sch") if File.exist? "#{target[:name]}_*.sch"
CLOBBER.include("#{target[:name]}_*.pcb") if File.exist? "#{target[:name]}_*.pcb"
CLOBBER.include("#{target[:name]}_*.sch")
CLOBBER.include("#{target[:name]}_*.pcb")
end
desc "print schematic and layout (as pdf)"
prints = targets.collect{|target| ["#{target[:name]}_schematic.pdf","#{target[:name]}_layout.pdf"]}.flatten
task :print => prints
prints.each do |print|
CLEAN.include(print) if File.exist? print
end
CLEAN.include(prints)
desc "export notes from schematic"
notes = targets.collect{|target| "#{target[:name]}_notes.txt"}
task :notes => notes
notes.each do |note|
CLEAN.include(note) if File.exist? note
end
CLEAN.include(notes)
=begin
desc "verify schematic attributes"
@ -94,12 +88,14 @@ desc "convert schematic to pcb layout"
task :sch2pcb => vsch do |t|
sh "gsch2pcb #{t.prerequisites[0]} --elements-dir #{File.dirname(__FILE__)}/lib/footprints --skip-m4 --output-name #{target}"
end
=end
PHOTOS = ["#{target}_layout-top.png","#{target}_layout-bottom.png"]
photos = targets.collect{|target| ["#{target[:name]}_layout-top.png","#{target[:name]}_layout-bottom.png"]}.flatten
desc "render layout"
task :photo => PHOTOS
CLOBBER.include(PHOTOS)
task :photo => photos
CLOBBER.include(photos)
=begin
GERBERS = [".top.gbr",".topmask.gbr",".toppaste.gbr",".topsilk.gbr",".bottom.gbr",".bottommask.gbr",".bottompaste.gbr",".bottomsilk.gbr",".outline.gbr",".fab.gbr",".plated-drill.cnc",".unplated-drill.cnc"].collect{|suffix| target+suffix}
desc "export gerber"
task :gerber => GERBERS
@ -156,7 +152,7 @@ def bom2(schematic, attributes)
end
return to_return
end
CLEAN.include("attribs") if File.exist? "attribs"
CLEAN.include("attribs")
# ===============
# file generation
@ -222,19 +218,21 @@ targets.each do |target|
end
end
=begin
desc "generate photo realistic picture from layout (front side)"
file "#{target}_layout-top.png" => vpcb do |t|
# sh "pcb -x png --dpi 600 --format PNG --photo-mode --outfile #{target}_layout-top.png #{t.prerequisites.join(' ')}"
sh "pcb -x png --format PNG --photo-mode --outfile #{target}_layout-top.png #{t.prerequisites.join(' ')}"
targets.each do |target|
file "#{target[:name]}_layout-top.png" => target[:vpcb] do |t|
sh "pcb -x png --dpi 600 --format PNG --photo-mode --outfile #{t.name} #{t.prerequisites.join(' ')}"
end
end
desc "generate photo realistic picture from layout (bottom side)"
file "#{target}_layout-bottom.png" => vpcb do |t|
# sh "pcb -x png --dpi 600 --format PNG --photo-mode --photo-flip-x --outfile #{target}_layout-bottom.png #{t.prerequisites.join(' ')}"
sh "pcb -x png --format PNG --photo-mode --photo-flip-x --outfile #{target}_layout-bottom.png #{t.prerequisites.join(' ')}"
targets.each do |target|
file "#{target[:name]}_layout-bottom.png" => target[:vpcb] do |t|
sh "pcb -x png --dpi 600 --format PNG --photo-mode --photo-flip-x --outfile #{t.name} #{t.prerequisites.join(' ')}"
end
end
=begin
desc "export gerber (and drill) files from layout"
GERBERS.each do |gerber|
file gerber => vpcb do |t|