Class: UnionLibrary

Inherits:
Library show all
Defined in:
lib/makeconf/library.rb

Overview

UnionLibrary - combine multiple static libraries into a single library.

The :sources for this library should be an array of Library objects

Instance Attribute Summary

Attributes inherited from Library

#buildable

Attributes inherited from Buildable

#buildable, #cflags, #distributable, #enable, #id, #installable, #ldadd, #localdep, #output, #output_type, #project, #rpath, #sources, #sysdep, #topdir

Instance Method Summary collapse

Methods inherited from Buildable

#binary?, #build, #expand_sources, #finalize, #library?, #library_type, #makedepends, #objects

Constructor Details

#initialize(options) ⇒ UnionLibrary

Returns a new instance of UnionLibrary.

Raises:

  • (ArgumentError)


52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/makeconf/library.rb', line 52

def initialize(options)
  raise ArgumentError unless options.kind_of?(Hash)
  @buildable = []
  options[:sources].each do |x|
    x.buildable.each do |y|
      @buildable.push y if y.kind_of?(StaticLibrary)
    end
  end
  @buildable.flatten!

  # Build a list of all source files within each component library
  sources = []
  @buildable.each { |x| sources.push x.sources }
  sources.flatten!

  @buildable.push StaticLibrary.new(
          :id => options[:id],
          :sources => sources
          )
end