Class: MxxRu::BinaryTarget
- Inherits:
-
AbstractTarget
- Object
- AbstractTarget
- MxxRu::BinaryTarget
- Defined in:
- lib/mxx_ru/binary_target.rb
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from AbstractTarget
#mxx_full_targets_names, #mxx_generators, #mxx_required_prjs
Class Method Summary collapse
-
.check_libraries_types(prj_alias, libs) ⇒ Object
Checks types of libraries.
Instance Method Summary collapse
-
#initialize(a_prj_alias) ⇒ BinaryTarget
constructor
A new instance of BinaryTarget.
-
#lib(a_library, a_path = nil) ⇒ Object
Add the library required.
-
#lib_shared(a_library, a_path = nil) ⇒ Object
Add shared library required.
-
#lib_static(a_library, a_path = nil) ⇒ Object
Add static library required.
-
#mxx_add_required_lib(a_lib) ⇒ Object
Add library to list of requirements.
-
#mxx_add_required_lib_path(a_path) ⇒ Object
(also: #lib_path)
Add folder to search folders list.
-
#mxx_required_lib_paths ⇒ Object
Get list of all paths to libraries, which should be used to search libraries, returned by mxx_required_libs method.
-
#mxx_required_libs ⇒ Object
Get all libraries list, which are required to be linked to for correct usage of given target.
Methods inherited from AbstractTarget
#build, #clean, define_plural_form_method, #generator, #mxx_add_full_target_name, #prj_alias, #required_prj, #reset, run
Constructor Details
#initialize(a_prj_alias) ⇒ BinaryTarget
Returns a new instance of BinaryTarget.
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/mxx_ru/binary_target.rb', line 41 def initialize( a_prj_alias ) super( a_prj_alias ) # Libraries list, which would be required to the user of current target. @mxx_required_libs = Array.new # Attribute showing that before return from mxx_required_libs # dublicates should be removed. @mxx_required_libs_changed = true # Folder list, where libraries, encountered in mxx_required_libs, # should be searched for. Also contain paths specified by # lib_path, lib_paths methods. @mxx_required_lib_paths = Array.new # Attribute showing that before return from mxx_required_lib_paths # dublicates should be removed. @mxx_required_lib_paths_changed = true end |
Class Method Details
.check_libraries_types(prj_alias, libs) ⇒ Object
Checks types of libraries. Should not exists two instance of same library with STATIC and SHARED types at one time.
Raises BinaryLibraryTypeConflictEx if conflict detected.
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 |
# File 'lib/mxx_ru/binary_target.rb', line 149 def BinaryTarget.check_libraries_types( prj_alias, libs ) if libs.size names_and_types = Hash.new( BinaryLibrary::ANY ) libs.each { |l| k = names_and_types[ l.name ] if BinaryLibrary::ANY != l.type if BinaryLibrary::ANY != k raise BinaryLibraryTypeConflictEx.new( prj_alias, l.name ) if k != l.type else names_and_types[ l.name ] = l.type end end } end end |
Instance Method Details
#lib(a_library, a_path = nil) ⇒ Object
Add the library required.
Type of library must be detect implicitly.
If a_path is other then nil, then it’s value is added to the list of a folders, the libraries should be searched in.
64 65 66 67 68 69 70 |
# File 'lib/mxx_ru/binary_target.rb', line 64 def lib( a_library, a_path = nil ) mxx_add_required_lib( BinaryLibrary.new( a_library, BinaryLibrary::ANY ) ) if a_path mxx_add_required_lib_path( a_path ) end end |
#lib_shared(a_library, a_path = nil) ⇒ Object
Add shared library required.
If a_path is other then nil, then it’s value is added to the list of a folders, the libraries should be searched in.
88 89 90 91 92 93 94 |
# File 'lib/mxx_ru/binary_target.rb', line 88 def lib_shared( a_library, a_path = nil ) mxx_add_required_lib( BinaryLibrary.new( a_library, BinaryLibrary::SHARED ) ) if a_path mxx_add_required_lib_path( a_path ) end end |
#lib_static(a_library, a_path = nil) ⇒ Object
Add static library required.
If a_path is other then nil, then it’s value is added to the list of a folders, the libraries should be searched in.
76 77 78 79 80 81 82 |
# File 'lib/mxx_ru/binary_target.rb', line 76 def lib_static( a_library, a_path = nil ) mxx_add_required_lib( BinaryLibrary.new( a_library, BinaryLibrary::STATIC ) ) if a_path mxx_add_required_lib_path( a_path ) end end |
#mxx_add_required_lib(a_lib) ⇒ Object
Add library to list of requirements.
109 110 111 112 113 114 115 |
# File 'lib/mxx_ru/binary_target.rb', line 109 def mxx_add_required_lib( a_lib ) a_lib = BinaryLibrary.new( a_lib, BinaryLibrary::ANY ) if a_lib.kind_of?( String ) @mxx_required_libs << a_lib @mxx_required_libs_changed = true end |
#mxx_add_required_lib_path(a_path) ⇒ Object Also known as: lib_path
Add folder to search folders list.
132 133 134 135 |
# File 'lib/mxx_ru/binary_target.rb', line 132 def mxx_add_required_lib_path( a_path ) @mxx_required_lib_paths << a_path @mxx_required_lib_paths_changed = true end |
#mxx_required_lib_paths ⇒ Object
Get list of all paths to libraries, which should be used to search libraries, returned by mxx_required_libs method. Returns array of strings.
123 124 125 126 127 128 129 |
# File 'lib/mxx_ru/binary_target.rb', line 123 def mxx_required_lib_paths if @mxx_required_lib_paths_changed @mxx_required_lib_paths.flatten! @mxx_required_lib_paths_changed = false end return @mxx_required_lib_paths end |
#mxx_required_libs ⇒ Object
Get all libraries list, which are required to be linked to for correct usage of given target. Returns array of strings.
99 100 101 102 103 104 105 106 |
# File 'lib/mxx_ru/binary_target.rb', line 99 def mxx_required_libs if @mxx_required_libs_changed @mxx_required_libs.flatten! BinaryTarget.check_libraries_types( prj_alias, @mxx_required_libs ) @mxx_required_libs_changed = false end return @mxx_required_libs end |