Class: Gaudi::Configuration::PlatformConfiguration

Inherits:
Hash
  • Object
show all
Defined in:
lib/gaudi/helpers/configuration.rb

Overview

PlatformConfiguration encapsulates the platform specific part of Gaudi's configuration

For more details check github.com/damphyr/gaudi/blob/master/doc/CONFIGURATION.md

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, platform_data) ⇒ PlatformConfiguration

Returns a new instance of PlatformConfiguration


618
619
620
621
622
623
# File 'lib/gaudi/helpers/configuration.rb', line 618

def initialize name,platform_data
  super(platform_data)
  @name=name
  __getobj__.merge!(platform_data)
  validate
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name


616
617
618
# File 'lib/gaudi/helpers/configuration.rb', line 616

def name
  @name
end

Class Method Details

.extend(component, system_config) ⇒ Object

PlatformCofiguration.extend extends the platform configuration compiler_options, assembler_options, library_options and linker_options parameters with the values given in the component configuration for the code given in the block

PlatformConfiguration.extend(component,system_config) do

perform build actions with extended platform options

end


595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
# File 'lib/gaudi/helpers/configuration.rb', line 595

def self.extend(component, system_config)
  if block_given?
    begin
      current_config=system_config.platform_config(component.platform)
      #extend the platform configuration with the component configuration settings
      new_cfg=current_config.dup
      system_config.source_extensions(component.platform).split(",").map{|ext| "compiler_options_#{ext.strip}"}+['compiler_options','assembler_options','library_options','linker_options'].each do |key|
        new_cfg[key]="#{current_config[key]} #{component.configuration.option(key)}"
      end
      system_config.set_platform_config(new_cfg,component.platform)
      yield
    rescue
      raise
    ensure
      system_config.set_platform_config(current_config,component.platform)
    end
  else
    raise GaudiError,"PlatformConfiguration.extend requires a block"
  end
end

Instance Method Details

#extensionsObject


625
626
627
# File 'lib/gaudi/helpers/configuration.rb', line 625

def extensions 
  [__getobj__['object_extension'],__getobj__['library_extension'],__getobj__['executable_extension']]
end