Sha256: 5fa4ba011b99fa807a880c25db37323fd4cc135fd2e32c168bcfe52a9f386f63

Contents?: true

Size: 1.05 KB

Versions: 2

Compression:

Stored size: 1.05 KB

Contents

require 'neutron'

module Neutron::CC
  def self.link(*files, target, **opts)
    o = {
      prog: 'cc',
      debug: false,
      args: '',
      shared: false
    }.merge(opts)
    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)
    o = {
      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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
neutron-0.2.1 lib/neutron/cc.rb
neutron-0.2.0 lib/neutron/cc.rb