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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/cpp_build +1 -2
  3. data/lib/cpp_build.rb +17 -4
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5ff31ae4c4641b55b95cc4923afcd21f88b8f544
4
- data.tar.gz: 33b88eb60fcbbd5ca3e97e40dfe0cc1c65b99cb1
3
+ metadata.gz: 7f37d40dc8ff2b28b0768e41f1d6425bdf68d675
4
+ data.tar.gz: a528510c60a7652b2aaf46abd5db802346614f46
5
5
  SHA512:
6
- metadata.gz: d5cbbcd64cb16636183c6cb0c64fbd301ae723b4f9132536db4a531a66fc48d2234194ce6052f3ae5f79457232d40d33929bc27338439b459ac68018ad5960c0
7
- data.tar.gz: b3f70d46492a5dfb5b190217ae1b69039e4557168012532d6041b57250e8093c86f169e33d4433238431ca5e1ff1b0de3e937be2e1fff9a3cd63f992df286242
6
+ metadata.gz: bcc09cbbe6cf7cc86c6b481c1642c3be4b71ac6fccaf6945ec896ccef38e183a60cb5084ae0d89b6aeac3cd14e70c3568bee0510acda1c45572c3ad8c1daaaa6
7
+ data.tar.gz: b19d0434733f73db05720955d3b999f5b6a0d262cbe08fc7cc3efc1af3851b1924a7d296f775ab4a8c6196116fee2ae9c8d467e508d659794124e54b08493148
data/bin/cpp_build CHANGED
@@ -1,5 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require 'cpp_build'
4
- $LOAD_PATH << Dir.pwd
5
- load "buildfile"
4
+ load Dir.pwd + "/buildfile"
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cpp_build
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Phil CK