Class: Daedalus::Blueprint

Inherits:
Object
  • Object
show all
Defined in:
lib/daedalus.rb

Instance Method Summary collapse

Constructor Details

#initializeBlueprint

Returns a new instance of Blueprint.



991
992
993
994
# File 'lib/daedalus.rb', line 991

def initialize
  @programs = []
  @compiler = nil
end

Instance Method Details

#build(targets = [], jobs = nil) ⇒ Object



1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
# File 'lib/daedalus.rb', line 1036

def build(targets=[], jobs=nil)
  if !targets.empty?
    @programs.each do |x|
      if targets.include? x.path
        tasks = Tasks.new
        x.consider @compiler, tasks

        if tasks.empty?
          @compiler.log.info "Nothing to do for #{x.path}"
        else
          tr = TaskRunner.new @compiler, tasks, jobs
          tr.start
        end
      end
    end
  else
    @programs.each { |x| x.build @compiler }
  end
end

#clean(targets = []) ⇒ Object



1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
# File 'lib/daedalus.rb', line 1056

def clean(targets=[])
  if !targets.empty?
    @programs.each do |x|
      if targets.include? x.path
        x.clean
      end
    end
  else
    @programs.each { |x| x.clean }
  end
end

#describe(targets = []) ⇒ Object



1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
# File 'lib/daedalus.rb', line 1068

def describe(targets=[])
  if !targets.empty?
    @programs.each do |x|
      if targets.include? x.path
        x.describe @compiler
      end
    end
  else
    @programs.each { |x| x.describe @compiler }
  end
end

#external_lib(path) {|ex| ... } ⇒ Object

Yields:

  • (ex)


996
997
998
999
1000
# File 'lib/daedalus.rb', line 996

def external_lib(path)
  ex = ExternalLibrary.new(path)
  yield ex
  ex
end

#file_info(files) ⇒ Object



1080
1081
1082
1083
1084
# File 'lib/daedalus.rb', line 1080

def file_info(files)
  @programs.each do |x|
    x.file_info @compiler, files
  end
end

#gcc!(cc, cxx, ldshared, ldsharedxx) ⇒ Object



1006
1007
1008
1009
1010
1011
1012
# File 'lib/daedalus.rb', line 1006

def gcc!(cc, cxx, ldshared, ldsharedxx)
  @compiler = Compiler.new(cc,
                           cxx,
                           ldshared,
                           ldsharedxx,
                           Logger.new, self)
end

#library_group(path, &block) ⇒ Object



1002
1003
1004
# File 'lib/daedalus.rb', line 1002

def library_group(path, &block)
  LibraryGroup.new(path, @compiler, &block)
end

#program(name, *files) ⇒ Object



1032
1033
1034
# File 'lib/daedalus.rb', line 1032

def program(name, *files)
  @programs << Program.new(name, files)
end

#source_file(file) {|sf| ... } ⇒ Object

Yields:

  • (sf)


1026
1027
1028
1029
1030
# File 'lib/daedalus.rb', line 1026

def source_file(file)
  sf = SourceFile.new(file)
  yield sf if block_given?
  sf
end

#source_files(*patterns) ⇒ Object



1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
# File 'lib/daedalus.rb', line 1014

def source_files(*patterns)
  files = []

  patterns.each do |t|
    Dir[t].each do |f|
      files << SourceFile.new(f)
    end
  end

  files
end