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.



305
306
307
308
309
310
311
# File 'lib/rbind/generator_c.rb', line 305

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



317
318
319
320
321
# File 'lib/rbind/generator_c.rb', line 317

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

#library_nameObject



330
331
332
# File 'lib/rbind/generator_c.rb', line 330

def library_name
    @library_name
end

#libsObject



323
324
325
326
327
328
# File 'lib/rbind/generator_c.rb', line 323

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

#ruby_pathObject



313
314
315
# File 'lib/rbind/generator_c.rb', line 313

def ruby_path
    @ruby_path
end