Class: Rbind::GeneratorC::CMakeListsHelper

Inherits:
HelperBase
  • Object
show all
Defined in:
lib/rbind/generator_c.rb

Instance Attribute Summary

Attributes inherited from HelperBase

#extern_types, #includes, #name

Instance Method Summary collapse

Methods inherited from HelperBase

#binding, #wrap_includes

Constructor Details

#initialize(name, lib_name, pkg_config = Array.new, libs = Array.new, ruby_path) ⇒ CMakeListsHelper

Returns a new instance of CMakeListsHelper.



296
297
298
299
300
301
302
# File 'lib/rbind/generator_c.rb', line 296

def initialize(name,lib_name,pkg_config=Array.new,libs=Array.new,ruby_path)
    super(name,pkg_config)
    @libs = libs
    @library_name = lib_name
    @find_package = ERB.new(File.open(File.join(File.dirname(__FILE__),"templates","c","find_package.txt")).read)
    @ruby_path = ruby_path
end

Instance Method Details

#find_packagesObject



308
309
310
311
312
# File 'lib/rbind/generator_c.rb', line 308

def find_packages
    @root.map do |pkg|
         @find_package.result(pkg.instance_eval("binding"))
    end.join("")
end

#library_nameObject



321
322
323
# File 'lib/rbind/generator_c.rb', line 321

def library_name
    @library_name
end

#libsObject



314
315
316
317
318
319
# File 'lib/rbind/generator_c.rb', line 314

def libs
    str = @root.map do |pkg|
        "${#{pkg.upcase}_LIBS} ${#{pkg.upcase}_LDFLAGS_OTHER}"
    end.join(" ")
    str += " " + @libs.join(" ")
end

#ruby_pathObject



304
305
306
# File 'lib/rbind/generator_c.rb', line 304

def ruby_path
    @ruby_path
end