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.



993
994
995
996
# File 'lib/daedalus.rb', line 993

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

Instance Method Details

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



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

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



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

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



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

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)


998
999
1000
1001
1002
# File 'lib/daedalus.rb', line 998

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

#file_info(files) ⇒ Object



1082
1083
1084
1085
1086
# File 'lib/daedalus.rb', line 1082

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

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



1008
1009
1010
1011
1012
1013
1014
# File 'lib/daedalus.rb', line 1008

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

#library_group(path, &block) ⇒ Object



1004
1005
1006
# File 'lib/daedalus.rb', line 1004

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

#program(name, *files) ⇒ Object



1034
1035
1036
# File 'lib/daedalus.rb', line 1034

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

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

Yields:

  • (sf)


1028
1029
1030
1031
1032
# File 'lib/daedalus.rb', line 1028

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

#source_files(*patterns) ⇒ Object



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

def source_files(*patterns)
  files = []

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

  files
end