Top Level Namespace

Defined Under Namespace

Classes: CppBuild

Instance Method Summary collapse

Instance Method Details

#clang_compiler_build_str(out_name, files, inc_dirs, config) ⇒ Object

Builds a command line string for clang++



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/cpp_build.rb', line 3

def clang_compiler_build_str(out_name, files, inc_dirs, config)

	# Compiler
	cc = "clang++"

	# Config
	if config == :debug
		config = "-g -O0"
	elsif config == :release
		config = "-O2"
	end

	# Files
	if files.class == Array then files = files.join(" ") end

	if files == :not_set
		return "echo \"No Files Given\""
	end

	# Inc Dirs
	if inc_dirs.class == Array then inc_dirs = inc_dirs.join(" -I") end
	if inc_dirs.class == String then inc_dirs = "-I" + inc_dirs end
	if inc_dirs == :not_set then inc_dirs = "" end

	# Output
	build = "-o #{out_name}"

	# Other Stuff
	cpp_standard = "-std=c++11"

	# Build cmd string
	cmd_string = "#{cc} #{files} #{inc_dirs} #{config} #{cpp_standard} #{build}"

	return cmd_string
end