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.
649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 |
# File 'lib/daedalus.rb', line 649 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.
647 648 649 |
# File 'lib/daedalus.rb', line 647 def cflags @cflags end |
#ldflags ⇒ Object
Returns the value of attribute ldflags.
647 648 649 |
# File 'lib/daedalus.rb', line 647 def ldflags @ldflags end |
Instance Method Details
#clean ⇒ Object
703 704 705 |
# File 'lib/daedalus.rb', line 703 def clean libraries.each { |l| l.clean } end |
#consider(compiler, tasks) ⇒ Object
696 697 698 699 700 701 |
# File 'lib/daedalus.rb', line 696 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
667 668 669 670 671 672 |
# File 'lib/daedalus.rb', line 667 def depends_on(file, command) # TODO: HACK, the agony, this should be implicit unless File.exists? File.join(@base, file) raise "library group #{@base} depends on #{file}, please run #{command}" end end |
#libraries ⇒ Object
692 693 694 |
# File 'lib/daedalus.rb', line 692 def libraries @static_libraries + @shared_libraries end |
#objects ⇒ Object
TODO: Fix this protocol
688 689 690 |
# File 'lib/daedalus.rb', line 688 def objects @static_libraries.map { |l| l.path } end |
#path ⇒ Object
TODO: change the way files are sorted
675 676 677 |
# File 'lib/daedalus.rb', line 675 def path @base end |
#shared_library(path, &block) ⇒ Object
683 684 685 |
# File 'lib/daedalus.rb', line 683 def shared_library(path, &block) @shared_libraries << SharedLibrary.new(path, @base, @compiler, &block) end |
#static_library(path, &block) ⇒ Object
679 680 681 |
# File 'lib/daedalus.rb', line 679 def static_library(path, &block) @static_libraries << StaticLibrary.new(path, @base, @compiler, &block) end |