Class: Daedalus::LibraryGroup
- Inherits:
-
Object
- Object
- Daedalus::LibraryGroup
- Defined in:
- lib/daedalus.rb
Overview
The purpose of a LibraryGroup is to combine multiple static and shared libraries into a unit. Static libraries are used to statically link a program, while shared libraries may be dynamically loaded by that program or another program.
NOTE: The current protocol for getting a list of static libraries is the #objects method. This should be changed when reworking Daedalus.
Instance Attribute Summary collapse
-
#cflags ⇒ Object
Returns the value of attribute cflags.
-
#ldflags ⇒ Object
Returns the value of attribute ldflags.
Instance Method Summary collapse
- #clean ⇒ Object
- #consider(compiler, tasks) ⇒ Object
- #depends_on(file, command) ⇒ Object
-
#initialize(base, compiler) {|_self| ... } ⇒ LibraryGroup
constructor
A new instance of LibraryGroup.
- #libraries ⇒ Object
-
#objects ⇒ Object
TODO: Fix this protocol.
-
#path ⇒ Object
TODO: change the way files are sorted.
- #shared_library(path, &block) ⇒ Object
- #static_library(path, &block) ⇒ Object
Constructor Details
#initialize(base, compiler) {|_self| ... } ⇒ LibraryGroup
Returns a new instance of LibraryGroup.
670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 |
# File 'lib/daedalus.rb', line 670 def initialize(base, compiler) @base = base @static_libraries = [] @shared_libraries = [] @compiler = Compiler.new(compiler.cc, compiler.cxx, compiler.ldshared, compiler.ldsharedxx, compiler.log, nil) yield self compiler.add_library self @compiler.cflags.concat cflags if cflags @compiler.ldflags.concat ldflags if ldflags end |
Instance Attribute Details
#cflags ⇒ Object
Returns the value of attribute cflags.
668 669 670 |
# File 'lib/daedalus.rb', line 668 def cflags @cflags end |
#ldflags ⇒ Object
Returns the value of attribute ldflags.
668 669 670 |
# File 'lib/daedalus.rb', line 668 def ldflags @ldflags end |
Instance Method Details
#clean ⇒ Object
724 725 726 |
# File 'lib/daedalus.rb', line 724 def clean libraries.each { |l| l.clean } end |
#consider(compiler, tasks) ⇒ Object
717 718 719 720 721 722 |
# File 'lib/daedalus.rb', line 717 def consider(compiler, tasks) # TODO: Note we are using @compiler, not compiler. There should not be a # global compiler. There should be a global configuration object that is # specialized by specific libraries as needed. libraries.each { |l| l.consider @compiler, tasks } end |
#depends_on(file, command) ⇒ Object
688 689 690 691 692 693 |
# File 'lib/daedalus.rb', line 688 def depends_on(file, command) # TODO: HACK, the agony, this should be implicit unless File.exist? File.join(@base, file) raise "library group #{@base} depends on #{file}, please run #{command}" end end |
#libraries ⇒ Object
713 714 715 |
# File 'lib/daedalus.rb', line 713 def libraries @static_libraries + @shared_libraries end |
#objects ⇒ Object
TODO: Fix this protocol
709 710 711 |
# File 'lib/daedalus.rb', line 709 def objects @static_libraries.map { |l| l.path } end |
#path ⇒ Object
TODO: change the way files are sorted
696 697 698 |
# File 'lib/daedalus.rb', line 696 def path @base end |
#shared_library(path, &block) ⇒ Object
704 705 706 |
# File 'lib/daedalus.rb', line 704 def shared_library(path, &block) @shared_libraries << SharedLibrary.new(path, @base, @compiler, &block) end |
#static_library(path, &block) ⇒ Object
700 701 702 |
# File 'lib/daedalus.rb', line 700 def static_library(path, &block) @static_libraries << StaticLibrary.new(path, @base, @compiler, &block) end |