Class: Take::Compiler::GCC
Constant Summary collapse
- DEBUG_OPTIONS =
{ default: "0", normal: "1", more: "2", max: "3", debug: "g", fast: "fast", size: "s" }.freeze
Class Method Summary collapse
Instance Method Summary collapse
- #[]=(key, value) ⇒ Object
- #defines ⇒ Object
- #directories ⇒ Object
-
#initialize ⇒ GCC
constructor
A new instance of GCC.
- #language=(lang) ⇒ Object
- #libraries ⇒ Object
- #object ⇒ Object
- #optimize_mode=(mode) ⇒ Object
- #output=(file) ⇒ Object
- #run ⇒ Object
- #standard=(standard) ⇒ Object
- #stop_after(stage = nil) ⇒ Object
- #warnings ⇒ Object
Methods inherited from Base
Constructor Details
#initialize ⇒ GCC
Returns a new instance of GCC.
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/take/compiler/gcc.rb', line 26 def initialize super @options[:libraries] = [] @options[:directories] = { include: [], quote: [], library: [] }.freeze @options[:defines] = {} @options[:optimize] = DEBUG_OPTIONS.fetch(:default) @options[:warnings] = ["all", "extra"] end |
Class Method Details
.command ⇒ Object
22 23 24 |
# File 'lib/take/compiler/gcc.rb', line 22 def self.command "gcc".freeze end |
.on_platform? ⇒ Boolean
15 16 17 18 19 20 |
# File 'lib/take/compiler/gcc.rb', line 15 def self.on_platform? @_on_platform ||= begin runner = Command::Runner.new(command, "--version") runner.run.successful? end end |
Instance Method Details
#[]=(key, value) ⇒ Object
60 61 62 |
# File 'lib/take/compiler/gcc.rb', line 60 def []=(key, value) @options[:extra][key] = value end |
#defines ⇒ Object
72 73 74 |
# File 'lib/take/compiler/gcc.rb', line 72 def defines @options[:defines] end |
#directories ⇒ Object
68 69 70 |
# File 'lib/take/compiler/gcc.rb', line 68 def directories @options[:directories] end |
#language=(lang) ⇒ Object
41 42 43 |
# File 'lib/take/compiler/gcc.rb', line 41 def language=(lang) @options[:lang] = lang || "none" end |
#libraries ⇒ Object
64 65 66 |
# File 'lib/take/compiler/gcc.rb', line 64 def libraries @options[:libraries] end |
#object ⇒ Object
93 94 95 96 |
# File 'lib/take/compiler/gcc.rb', line 93 def object stop_after :link self end |
#optimize_mode=(mode) ⇒ Object
53 54 55 56 57 58 |
# File 'lib/take/compiler/gcc.rb', line 53 def optimize_mode=(mode) mode = :default unless mode @options[:optimize] = DEBUG_OPTIONS.fetch(mode) do DEBUG_OPTIONS.fetch(:default) end end |
#output=(file) ⇒ Object
37 38 39 |
# File 'lib/take/compiler/gcc.rb', line 37 def output=(file) @options[:output] = file end |
#run ⇒ Object
98 99 100 |
# File 'lib/take/compiler/gcc.rb', line 98 def run end |
#standard=(standard) ⇒ Object
45 46 47 48 49 50 51 |
# File 'lib/take/compiler/gcc.rb', line 45 def standard=(standard) if standard @options[:std] = standard else @options.delete(:std) end end |
#stop_after(stage = nil) ⇒ Object
80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/take/compiler/gcc.rb', line 80 def stop_after(stage = nil) case stage when :link @options[:stop] = "c" when :assemble @options[:stop] = "S" when :preprocess @options[:stop] = "E" else @options.delete(:stop) end end |
#warnings ⇒ Object
76 77 78 |
# File 'lib/take/compiler/gcc.rb', line 76 def warnings @options[:warnings] end |