Class: Daedalus::Blueprint

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

Instance Method Summary collapse

Constructor Details

#initializeBlueprint



933
934
935
936
# File 'lib/daedalus.rb', line 933

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

Instance Method Details

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



978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
# File 'lib/daedalus.rb', line 978

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



998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
# File 'lib/daedalus.rb', line 998

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



1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
# File 'lib/daedalus.rb', line 1010

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)


938
939
940
941
942
# File 'lib/daedalus.rb', line 938

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

#file_info(files) ⇒ Object



1022
1023
1024
1025
1026
# File 'lib/daedalus.rb', line 1022

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

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



948
949
950
951
952
953
954
# File 'lib/daedalus.rb', line 948

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

#library_group(path, &block) ⇒ Object



944
945
946
# File 'lib/daedalus.rb', line 944

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

#program(name, *files) ⇒ Object



974
975
976
# File 'lib/daedalus.rb', line 974

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

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

Yields:

  • (sf)


968
969
970
971
972
# File 'lib/daedalus.rb', line 968

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

#source_files(*patterns) ⇒ Object



956
957
958
959
960
961
962
963
964
965
966
# File 'lib/daedalus.rb', line 956

def source_files(*patterns)
  files = []

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

  files
end