Class: NxBuild::Target::Cpp
Instance Attribute Summary collapse
-
#sources ⇒ Object
readonly
Returns the value of attribute sources.
Attributes inherited from Base
Instance Method Summary collapse
- #filter(files) ⇒ Object
-
#initialize ⇒ Cpp
constructor
A new instance of Cpp.
- #source(path) ⇒ Object
Constructor Details
#initialize ⇒ Cpp
Returns a new instance of Cpp.
8 9 10 |
# File 'lib/nxbuild/target/cpp.rb', line 8 def initialize @sources = [] end |
Instance Attribute Details
#sources ⇒ Object (readonly)
Returns the value of attribute sources.
6 7 8 |
# File 'lib/nxbuild/target/cpp.rb', line 6 def sources @sources end |
Instance Method Details
#filter(files) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/nxbuild/target/cpp.rb', line 17 def filter(files) filters = ['Mac', 'Windows'] if OS.windows? filters.delete('Windows') end filters.each do |filter| new_files = [] files.each_with_index do |file, i| s = file.split('/') new_files << file unless s.any? {|seg| seg == filter} end files = new_files end files end |
#source(path) ⇒ Object
12 13 14 15 |
# File 'lib/nxbuild/target/cpp.rb', line 12 def source(path) files = Dir[path + '/**/*.c'] + Dir[path + '/**/*.cpp'] + Dir[path + '/**/*.m'] + Dir[path + '/**/*.mm'] @sources += filter(files) end |