cpp_build 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/cpp_build +1 -2
- data/lib/cpp_build.rb +17 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7f37d40dc8ff2b28b0768e41f1d6425bdf68d675
|
4
|
+
data.tar.gz: a528510c60a7652b2aaf46abd5db802346614f46
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bcc09cbbe6cf7cc86c6b481c1642c3be4b71ac6fccaf6945ec896ccef38e183a60cb5084ae0d89b6aeac3cd14e70c3568bee0510acda1c45572c3ad8c1daaaa6
|
7
|
+
data.tar.gz: b19d0434733f73db05720955d3b999f5b6a0d262cbe08fc7cc3efc1af3851b1924a7d296f775ab4a8c6196116fee2ae9c8d467e508d659794124e54b08493148
|
data/bin/cpp_build
CHANGED
data/lib/cpp_build.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
|
2
2
|
# Builds a command line string for clang++
|
3
|
-
def clang_compiler_build_str(out_name, files, inc_dirs, config)
|
3
|
+
def clang_compiler_build_str(out_name, files, inc_dirs, lib_dirs, libs, config)
|
4
4
|
|
5
5
|
# Compiler
|
6
6
|
cc = "clang++"
|
@@ -24,6 +24,19 @@ def clang_compiler_build_str(out_name, files, inc_dirs, config)
|
|
24
24
|
if inc_dirs.class == String then inc_dirs = "-I" + inc_dirs end
|
25
25
|
if inc_dirs == :not_set then inc_dirs = "" end
|
26
26
|
|
27
|
+
# Lib Dirs
|
28
|
+
if lib_dirs.class == Array then lib_dirs = lib_dirs.join(" -L") end
|
29
|
+
if lib_dirs.class == String then lib_dirs = "-L" + lib_dirs end
|
30
|
+
if lib_dirs == :not_set then lib_dirs = "" end
|
31
|
+
|
32
|
+
# Libs
|
33
|
+
if(lib_dirs != :not_set)
|
34
|
+
if libs.class == Array then libs = libs.join(" -l") end
|
35
|
+
if libs.class == String then libs = "-l" + libs end
|
36
|
+
else
|
37
|
+
libs = ""
|
38
|
+
end
|
39
|
+
|
27
40
|
# Output
|
28
41
|
build = "-o #{out_name}"
|
29
42
|
|
@@ -31,7 +44,7 @@ def clang_compiler_build_str(out_name, files, inc_dirs, config)
|
|
31
44
|
cpp_standard = "-std=c++11"
|
32
45
|
|
33
46
|
# Build cmd string
|
34
|
-
cmd_string = "#{cc} #{files} #{inc_dirs} #{config} #{cpp_standard} #{build}"
|
47
|
+
cmd_string = "#{cc} #{files} #{inc_dirs} #{lib_dirs} #{libs} #{config} #{cpp_standard} #{build}"
|
35
48
|
|
36
49
|
return cmd_string
|
37
50
|
end
|
@@ -40,7 +53,7 @@ $build_list = []
|
|
40
53
|
|
41
54
|
class CppBuild
|
42
55
|
|
43
|
-
attr_accessor :name, :compiler, :files, :config, :inc_dirs, :arch, :defines, :out_dir
|
56
|
+
attr_accessor :name, :compiler, :files, :config, :inc_dirs, :lib_dirs, :libs, :arch, :defines, :out_dir
|
44
57
|
|
45
58
|
def initialize()
|
46
59
|
@name = "cpp_build"
|
@@ -74,7 +87,7 @@ class CppBuild
|
|
74
87
|
end
|
75
88
|
|
76
89
|
if build.compiler == :clang
|
77
|
-
compiler_cmd = clang_compiler_build_str(build.out_dir + build.name, build.files, build.inc_dirs, build.config)
|
90
|
+
compiler_cmd = clang_compiler_build_str(build.out_dir + build.name, build.files, build.inc_dirs, build.lib_dirs, build.libs, build.config)
|
78
91
|
else
|
79
92
|
compiler_cmd = "echo \"Compiler not supported.\""
|
80
93
|
end
|