class MxxRu::BinaryTarget

Public Class Methods

check_libraries_types( prj_alias, libs ) click to toggle source

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.

# 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
new( a_prj_alias ) click to toggle source
Calls superclass method MxxRu::AbstractTarget::new
# 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

Public Instance Methods

lib( a_library, a_path = nil ) click to toggle source

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.

# 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_path( a_path )
lib_shared( a_library, a_path = nil ) click to toggle source

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.

# 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 ) click to toggle source

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.

# 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 ) click to toggle source

Add library to list of requirements.

# 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 ) click to toggle source

Add folder to search folders list.

# 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
Also aliased as: lib_path
mxx_required_lib_paths() click to toggle source

Get list of all paths to libraries, which should be used to search libraries, returned by mxx_required_libs method. Returns array of strings.

# 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() click to toggle source

Get all libraries list, which are required to be linked to for correct usage of given target. Returns array of strings.

# 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