Class: Cxxproject::Toolchain::Provider
- Inherits:
-
Object
- Object
- Cxxproject::Toolchain::Provider
- Defined in:
- lib/cxxproject/toolchain/provider.rb
Constant Summary collapse
- @@settings =
{}
- @@default =
{ :TARGET_OS => Utils::OS.os(), :COMPILER => { :CPP => { :COMMAND => "", :DEFINE_FLAG => "", :OBJECT_FILE_FLAG => "", :INCLUDE_PATH_FLAG => "", :COMPILE_FLAGS => "", :DEFINES => [], :FLAGS => [], :SOURCE_FILE_ENDINGS => [".cxx", ".cpp", ".c++", ".cc", ".C"], :DEP_FLAGS => "", :DEP_FLAGS_SPACE => false, :ERROR_PARSER => nil, :PREPRO_FLAGS => "" }, :C => { :COMMAND => "", :DEFINE_FLAG => "", :OBJECT_FILE_FLAG => "", :INCLUDE_PATH_FLAG => "", :COMPILE_FLAGS => "", :DEFINES => [], :FLAGS => [], :SOURCE_FILE_ENDINGS => [".c"], :DEP_FLAGS => "", :DEP_FLAGS_SPACE => false, :ERROR_PARSER => nil, :PREPRO_FLAGS => "" }, :ASM => { :COMMAND => "", :DEFINE_FLAG => "", :OBJECT_FILE_FLAG => "", :INCLUDE_PATH_FLAG => "", :COMPILE_FLAGS => "", :DEFINES => [], :FLAGS => [], :SOURCE_FILE_ENDINGS => [".asm", ".s", ".S"], :DEP_FLAGS => "", :ERROR_PARSER => nil, :PREPRO_FLAGS => "" } }, :ARCHIVER => { :COMMAND => "", :ARCHIVE_FLAGS => "", :FLAGS => [], :ERROR_PARSER => nil }, :LINKER => { :COMMAND => "", :MUST_FLAGS => "", :SCRIPT => "", :USER_LIB_FLAG => "", :OUTPUT_FLAG => 'output_flag_default', :SHARED_FLAG => 'shared_flag_default', :SONAME_FLAG => 'soname_flag_default', :LIB_FLAG => "", :LIB_PATH_FLAG => "", :LIB_PREFIX_FLAGS => "", # "-Wl,--whole-archive", :LIB_POSTFIX_FLAGS => "", # "-Wl,--no-whole-archive", :FLAGS => [], :MAP_FILE_FLAG => "", :OUTPUT_PREFIX => {:EXECUTABLE => '', :SHARED_LIBRARY => {:UNIX => 'lib', :OSX => 'lib'} }, :OUTPUT_SUFFIX => { :EXECUTABLE => { :UNIX => '.exe', :OSX => '.exe', :WINDOWS => '.exe' }, :SHARED_LIBRARY => { :UNIX => '.so', :OSX => '.dylib', :WINDOWS => '.dll' } }, :ERROR_PARSER => nil, :START_OF_WHOLE_ARCHIVE => {:UNIX => '', :OSX => '', :WINDOWS => ''}, :END_OF_WHOLE_ARCHIVE => {:UNIX => '', :OSX => '', :WINDOWS => ''}, :ADDITIONAL_COMMANDS => {:OSX => '', :UNIX => ''}, :ADDITIONAL_OBJECT_FILE_FLAGS => {:OSX => [], :UNIX => []} }, :MAKE => { :COMMAND => "make", :FLAGS => "-j", :FILE_FLAG => "-f", :DIR_FLAG => "-C", :CLEAN => "clean" }, :ENV => { :LIB_VAR=> {:UNIX => 'LD_LIBRARY_PATH', :OSX => 'DYLD_LIBRARY_PATH', :WINDOWS => 'PATH'}, }, :CONSOLE_HIGHLIGHTER => ColorizingFormatter.new }
Class Method Summary collapse
- .[](name) ⇒ Object
- .add(name, basedOn = nil) ⇒ Object
- .default ⇒ Object
- .list ⇒ Object
-
.merge(hashA, hashB, overwrite = true) ⇒ Object
merge hashB into hashA recurse on sub-hash-structures elements present in hashA only will be taken from hashA elements present in hashB only will be taken from hashB elements present in both will be taken from hashB.
- .modify_compiler(based_on, compiler_type, h) ⇒ Object
- .modify_cpp_compiler(based_on, h) ⇒ Object
- .modify_linker(based_on, h) ⇒ Object
Class Method Details
.[](name) ⇒ Object
164 165 166 167 |
# File 'lib/cxxproject/toolchain/provider.rb', line 164 def self.[](name) return @@settings[name] if @@settings.include? name nil end |
.add(name, basedOn = nil) ⇒ Object
115 116 117 118 119 |
# File 'lib/cxxproject/toolchain/provider.rb', line 115 def self.add(name, basedOn = nil) chain = Marshal.load(Marshal.dump(basedOn.nil? ? @@default : @@settings[basedOn])) @@settings[name] = chain chain end |
.default ⇒ Object
142 143 144 |
# File 'lib/cxxproject/toolchain/provider.rb', line 142 def self.default @@default end |
.list ⇒ Object
169 170 171 |
# File 'lib/cxxproject/toolchain/provider.rb', line 169 def self.list return @@settings end |
.merge(hashA, hashB, overwrite = true) ⇒ Object
merge hashB into hashA recurse on sub-hash-structures elements present in hashA only will be taken from hashA elements present in hashB only will be taken from hashB elements present in both will be taken from hashB
127 128 129 130 131 132 133 134 135 136 137 138 139 140 |
# File 'lib/cxxproject/toolchain/provider.rb', line 127 def self.merge(hashA,hashB,overwrite=true) missingKeys = hashB.keys - hashA.keys missingKeys.each do |k| hashA[k] = hashB[k] end hashA.each do |k,v| if v.is_a? Hash merge(v,hashB[k],overwrite) if hashB[k] else hashA[k] = hashB[k] if hashB[k] and overwrite end end hashA end |
.modify_compiler(based_on, compiler_type, h) ⇒ Object
153 154 155 156 157 158 |
# File 'lib/cxxproject/toolchain/provider.rb', line 153 def self.modify_compiler(based_on, compiler_type, h) chain = @@settings[based_on] raise "unknown toolchain: #{based_on}" unless chain chain[:COMPILER][compiler_type].update(h) chain end |
.modify_cpp_compiler(based_on, h) ⇒ Object
160 161 162 |
# File 'lib/cxxproject/toolchain/provider.rb', line 160 def self.modify_cpp_compiler(based_on, h) modify_compiler(based_on, :CPP, h) end |
.modify_linker(based_on, h) ⇒ Object
146 147 148 149 150 151 |
# File 'lib/cxxproject/toolchain/provider.rb', line 146 def self.modify_linker(based_on, h) chain = @@settings[based_on] raise "unknown toolchain: #{based_on}" unless chain chain[:LINKER].update(h) chain end |