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.



911
912
913
914
# File 'lib/daedalus.rb', line 911

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

Instance Method Details

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



956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
# File 'lib/daedalus.rb', line 956

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



976
977
978
979
980
981
982
983
984
985
986
# File 'lib/daedalus.rb', line 976

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



988
989
990
991
992
993
994
995
996
997
998
# File 'lib/daedalus.rb', line 988

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)


916
917
918
919
920
# File 'lib/daedalus.rb', line 916

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

#file_info(files) ⇒ Object



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

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

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



926
927
928
929
930
931
932
# File 'lib/daedalus.rb', line 926

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

#library_group(path, &block) ⇒ Object



922
923
924
# File 'lib/daedalus.rb', line 922

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

#program(name, *files) ⇒ Object



952
953
954
# File 'lib/daedalus.rb', line 952

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

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

Yields:

  • (sf)


946
947
948
949
950
# File 'lib/daedalus.rb', line 946

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

#source_files(*patterns) ⇒ Object



934
935
936
937
938
939
940
941
942
943
944
# File 'lib/daedalus.rb', line 934

def source_files(*patterns)
  files = []

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

  files
end