lib/neutron/cc.rb in neutron-0.1.0 vs lib/neutron/cc.rb in neutron-0.2.0

- old
+ new

@@ -3,22 +3,34 @@ module Neutron::CC def self.link(*files, target, **opts) o = { prog: 'cc', debug: false, - args: '' + args: '', + shared: false }.merge(opts) - Neutron.execute("#{o[:prog]} -o #{target} #{files.join(' ')} #{'-g' if o[:debug]} #{o[:args]}", must_success: true) + specific = '' + if o[:shared] + specific << ' -shared' + end + files.map! do |file| + File.expand_path(file) + end + Neutron.execute( + "#{o[:prog]} #{specific} -Wl,-rpath=./ -Wall -fpic -o #{target} #{files.join(' ')} #{'-g' if o[:debug]} #{o[:args]}", + must_success: true + ) end def self.cc(*files, **opts) o = { prog: 'cc', debug: false, args: '' }.merge(opts) files.each do |file| + file = File.expand_path(file) Neutron.execute("#{o[:prog]} -c #{file} #{'-g' if o[:debug]} #{o[:args]}", must_success: true) end end def self.cpp(*files, **opts) @@ -26,9 +38,10 @@ prog: 'c++', debug: false, args: '' }.merge(opts) files.each do |file| + file = File.expand_path(file) Neutron.execute("#{o[:prog]} -c #{file} #{'-g' if o[:debug]} #{o[:args]}", must_success: true) end end end \ No newline at end of file