Class: RakeOE::Config
- Inherits:
-
Object
- Object
- RakeOE::Config
- Defined in:
- lib/rakeoe/config.rb
Overview
Project wide configurations RakeOE::init() takes a RakeOE::Config object. Therefore this class should be used from inside the project Rakefile to change project wide settings before calling RakeOE::init().
Instance Attribute Summary collapse
-
#directories ⇒ Object
Returns the value of attribute directories.
-
#generate_bin ⇒ Object
Returns the value of attribute generate_bin.
-
#generate_hex ⇒ Object
Returns the value of attribute generate_hex.
-
#generate_map ⇒ Object
Returns the value of attribute generate_map.
-
#language_std_c ⇒ Object
Returns the value of attribute language_std_c.
-
#language_std_cpp ⇒ Object
Returns the value of attribute language_std_cpp.
-
#optimization_dbg ⇒ Object
Returns the value of attribute optimization_dbg.
-
#optimization_release ⇒ Object
Returns the value of attribute optimization_release.
-
#platform ⇒ Object
Returns the value of attribute platform.
-
#release ⇒ Object
Returns the value of attribute release.
-
#stripped ⇒ Object
Returns the value of attribute stripped.
-
#suffixes ⇒ Object
Returns the value of attribute suffixes.
-
#sw_version ⇒ Object
Returns the value of attribute sw_version.
-
#test_fw ⇒ Object
Returns the value of attribute test_fw.
Instance Method Summary collapse
-
#checks_pass? ⇒ bool
Checks configuration, e.g.
-
#dump ⇒ Object
Dumps configuration to stdout.
-
#initialize ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/rakeoe/config.rb', line 14 def initialize # Common file suffixes used for C/C++/Assembler files inside the project. # This is a hash object with the following key => value mappings (examples): # { # :as_sources => %w[.s], Assembler source # :c_sources => %w[.c], C source # :c_headers => %w[.h], C headers # :cplus_sources => %w[.cpp .cc], C++ sources # :cplus_headers => %w[.h .hpp], C++ headers # :moc_header => '.h', Qt MOC file header # :moc_source => '.cpp' Qt MOC file source # } @suffixes=RakeOE::Default.suffixes # Directories used for the project # This is a hash object with the following key => value mappings (examples): # { # :apps => %w[src/app], Application top level directories # :libs => %w[src/lib1 src/lib2], Library top level directories # :build => 'build' Build top level directory # } @directories=RakeOE::Default.dirs # Platform configuration used for the project # This is the absolute path to the platform definition file # # This parameter can be overridden via environment variable TOOLCHAIN_ENV @platform = ENV['TOOLCHAIN_ENV'].nil? ? '' : ENV['TOOLCHAIN_ENV'] # Release mode used for the project # It can take the values "dbg" or "release" and influences the build behaviour. # When "dbg", optimization definitions set via @optimization_dbg are used. # When "release", optimization definitions set via @optimization_release are used. # CFLAGS/CXXFLAGS will contain the symbol -DRELEASE # # This parameter can be overridden via environment variable RELEASE. If the latter # is defined, this configuration variable has the value "release" @release = ENV['RELEASE'].nil? ? RakeOE::Default.release : 'release' # Test framework used for linking test case binaries # This takes the name of the test framework that has to be integrated into the project # library path. # RakeOE does not require a specific test framework, but CppUTest and CUnit are proposals # that have been tested to work fine. @test_fw=RakeOE::Default.test_fw # Optimization levels used for compiling binaries (e.g. -O0, -O1, -O2, -O3, -Og). # Depending on the release mode, either @optimization_dbg or @optimization_release # is used @optimization_dbg=RakeOE::Default.optimization_dbg @optimization_release=RakeOE::Default.optimization_release # Language standard (e.g. -std=gnu99, -std=c++03, -std=c99, etc. ) @language_std_c=RakeOE::Default.lang_std_c @language_std_cpp=RakeOE::Default.lang_std_cpp # Software version string # # This parameter can be overridden via environment variable SW_VERSION_ENV. @sw_version = ENV['SW_VERSION_ENV'].nil? ? "#{RakeOE::Default.sw_version}-#{@release}" : ENV['SW_VERSION_ENV'] # Stripped flag @stripped = RakeOE::Default.stripped # Hex file flag. Generates a binary.hex file for each app binary if flag is set @generate_hex = RakeOE::Default.generate_hex # Bin file flag. Generates a binary.bin file for each app binary if flag is set @generate_bin = RakeOE::Default.generate_bin # Map file flag. Generates a map file file for each app/lib/solib binary if flag is set @generate_map = RakeOE::Default.generate_map # Project settings as specified in prj.rake file @prj_settings = RakeOE::Default.prj_settings end |
Instance Attribute Details
#directories ⇒ Object
Returns the value of attribute directories.
11 12 13 |
# File 'lib/rakeoe/config.rb', line 11 def directories @directories end |
#generate_bin ⇒ Object
Returns the value of attribute generate_bin.
11 12 13 |
# File 'lib/rakeoe/config.rb', line 11 def generate_bin @generate_bin end |
#generate_hex ⇒ Object
Returns the value of attribute generate_hex.
11 12 13 |
# File 'lib/rakeoe/config.rb', line 11 def generate_hex @generate_hex end |
#generate_map ⇒ Object
Returns the value of attribute generate_map.
11 12 13 |
# File 'lib/rakeoe/config.rb', line 11 def generate_map @generate_map end |
#language_std_c ⇒ Object
Returns the value of attribute language_std_c.
11 12 13 |
# File 'lib/rakeoe/config.rb', line 11 def language_std_c @language_std_c end |
#language_std_cpp ⇒ Object
Returns the value of attribute language_std_cpp.
11 12 13 |
# File 'lib/rakeoe/config.rb', line 11 def language_std_cpp @language_std_cpp end |
#optimization_dbg ⇒ Object
Returns the value of attribute optimization_dbg.
11 12 13 |
# File 'lib/rakeoe/config.rb', line 11 def optimization_dbg @optimization_dbg end |
#optimization_release ⇒ Object
Returns the value of attribute optimization_release.
11 12 13 |
# File 'lib/rakeoe/config.rb', line 11 def optimization_release @optimization_release end |
#platform ⇒ Object
Returns the value of attribute platform.
11 12 13 |
# File 'lib/rakeoe/config.rb', line 11 def platform @platform end |
#release ⇒ Object
Returns the value of attribute release.
11 12 13 |
# File 'lib/rakeoe/config.rb', line 11 def release @release end |
#stripped ⇒ Object
Returns the value of attribute stripped.
11 12 13 |
# File 'lib/rakeoe/config.rb', line 11 def stripped @stripped end |
#suffixes ⇒ Object
Returns the value of attribute suffixes.
11 12 13 |
# File 'lib/rakeoe/config.rb', line 11 def suffixes @suffixes end |
#sw_version ⇒ Object
Returns the value of attribute sw_version.
11 12 13 |
# File 'lib/rakeoe/config.rb', line 11 def sw_version @sw_version end |
#test_fw ⇒ Object
Returns the value of attribute test_fw.
11 12 13 |
# File 'lib/rakeoe/config.rb', line 11 def test_fw @test_fw end |
Instance Method Details
#checks_pass? ⇒ bool
Checks configuration, e.g. if given files do exist or if vital configuration settings are missing
97 98 99 100 101 102 103 104 105 |
# File 'lib/rakeoe/config.rb', line 97 def checks_pass? rv = true unless File.exist?(@platform) puts "No platform or invalid platform configuration given: (#{@platform}) !" puts "Use either property 'platform' via RakeOE::Config object in the Rakefile or environment variable TOOLCHAIN_ENV" rv = false end rv end |
#dump ⇒ Object
Dumps configuration to stdout
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/rakeoe/config.rb', line 109 def dump puts '******************' puts '* RakeOE::Config *' puts '******************' puts "Directories : #{@directories}" puts "Suffixes : #{@suffixes}" puts "Platform : #{@platform}" puts "Release mode : #{@release}" puts "Test framework : #{@test_fw}" puts "Optimization dbg : #{@optimization_dbg}" puts "Optimization release : #{@optimization_release}" puts "Language Standard for C : #{@language_std_c}" puts "Language Standard for C++ : #{@language_std_cpp}" puts "Software version string : #{@sw_version}" puts "Generate bin file : #{@generate_bin}" puts "Generate hex file : #{@generate_hex}" puts "Generate map file : #{@generate_map}" puts "Strip objects : #{@stripped}" end |