Class: CppBuild

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCppBuild

Returns a new instance of CppBuild.



45
46
47
48
49
50
51
52
53
# File 'lib/cpp_build.rb', line 45

def initialize()
	@name = "cpp_build"
	@compiler = :clang
	@files = :not_set
	@config = :not_set
	@arch = :not_set
	@defines = :not_set
	@out_dir = "./"
end

Instance Attribute Details

#archObject

Returns the value of attribute arch.



43
44
45
# File 'lib/cpp_build.rb', line 43

def arch
  @arch
end

#compilerObject

Returns the value of attribute compiler.



43
44
45
# File 'lib/cpp_build.rb', line 43

def compiler
  @compiler
end

#configObject

Returns the value of attribute config.



43
44
45
# File 'lib/cpp_build.rb', line 43

def config
  @config
end

#definesObject

Returns the value of attribute defines.



43
44
45
# File 'lib/cpp_build.rb', line 43

def defines
  @defines
end

#filesObject

Returns the value of attribute files.



43
44
45
# File 'lib/cpp_build.rb', line 43

def files
  @files
end

#inc_dirsObject

Returns the value of attribute inc_dirs.



43
44
45
# File 'lib/cpp_build.rb', line 43

def inc_dirs
  @inc_dirs
end

#nameObject

Returns the value of attribute name.



43
44
45
# File 'lib/cpp_build.rb', line 43

def name
  @name
end

#out_dirObject

Returns the value of attribute out_dir.



43
44
45
# File 'lib/cpp_build.rb', line 43

def out_dir
  @out_dir
end

Class Method Details

.build(build_name, &block) ⇒ Object



61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/cpp_build.rb', line 61

def self.build(build_name, &block)

	build = CppBuild.new
	build.name = build_name.to_s
    build.instance_eval(&block)


	if ARGV[0]
		unless ARGV[0] == build_name.to_s then return end
	else
		puts "#{build.name} - #{build.compiler.to_s}, #{build.config.to_s}, #{build.files.length.to_s} files"

		return
	end

    if build.compiler == :clang
    	compiler_cmd = clang_compiler_build_str(build.out_dir + build.name, build.files, build.inc_dirs, build.config)
    else
    	compiler_cmd = "echo \"Compiler not supported.\""
    end

    puts "#{compiler_cmd}"

    `#{compiler_cmd}`

    # Hiding output
    # if ARGV[1] == "-r"
    # 	`./#{build.name}`
    # end
end

.listObject



93
94
95
# File 'lib/cpp_build.rb', line 93

def self.list()

end

.settings(&block) ⇒ Object



56
57
58
# File 'lib/cpp_build.rb', line 56

def self.settings(&block)
	# Override the defaults.
end