Class: Rbind::GeneratorC::CMakeListsHelper
- Inherits:
-
HelperBase
- Object
- HelperBase
- Rbind::GeneratorC::CMakeListsHelper
- Defined in:
- lib/rbind/generator_c.rb
Instance Attribute Summary
Attributes inherited from HelperBase
Instance Method Summary collapse
- #find_gems ⇒ Object
- #find_packages ⇒ Object
-
#initialize(name, pkg_config = Array.new, libs = Array.new, gems = Array.new) ⇒ CMakeListsHelper
constructor
A new instance of CMakeListsHelper.
- #library_name ⇒ Object
- #libs ⇒ Object
Methods inherited from HelperBase
Constructor Details
#initialize(name, pkg_config = Array.new, libs = Array.new, gems = Array.new) ⇒ CMakeListsHelper
Returns a new instance of CMakeListsHelper.
268 269 270 271 272 273 274 |
# File 'lib/rbind/generator_c.rb', line 268 def initialize(name,pkg_config=Array.new,libs=Array.new,gems=Array.new) super(name,pkg_config) @libs = libs @gems = gems @find_gem = ERB.new(File.open(File.join(File.dirname(__FILE__),"templates","c","find_gem.txt")).read) @find_package = ERB.new(File.open(File.join(File.dirname(__FILE__),"templates","c","find_package.txt")).read) end |
Instance Method Details
#find_gems ⇒ Object
282 283 284 |
# File 'lib/rbind/generator_c.rb', line 282 def find_gems @find_gem.result(@gems.instance_eval("binding")) unless @gems.empty? end |
#find_packages ⇒ Object
276 277 278 279 280 |
# File 'lib/rbind/generator_c.rb', line 276 def find_packages @root.map do |pkg| @find_package.result(pkg.instance_eval("binding")) end.join("") end |
#library_name ⇒ Object
293 294 295 |
# File 'lib/rbind/generator_c.rb', line 293 def library_name name end |
#libs ⇒ Object
286 287 288 289 290 291 |
# File 'lib/rbind/generator_c.rb', line 286 def libs str = @root.map do |pkg| "${#{pkg.upcase}_LIBS} ${#{pkg.upcase}_LDFLAGS_OTHER}" end.join(" ") str += " " + @libs.join(" ") end |