Class: MilkTea::VendoredCLibrary::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/milk_tea/bindings/vendored_c_library.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, source_root:, include_roots: [], cc_env_var: nil) ⇒ Base

Returns a new instance of Base.



15
16
17
18
19
20
# File 'lib/milk_tea/bindings/vendored_c_library.rb', line 15

def initialize(name:, source_root:, include_roots: [], cc_env_var: nil)
  @name = name.to_s
  @source_root = Pathname.new(File.expand_path(source_root.to_s))
  @include_roots = include_roots.map { |path| Pathname.new(File.expand_path(path.to_s)) }.freeze
  @cc_env_var = cc_env_var
end

Instance Attribute Details

#include_rootsObject (readonly)

Returns the value of attribute include_roots.



13
14
15
# File 'lib/milk_tea/bindings/vendored_c_library.rb', line 13

def include_roots
  @include_roots
end

#nameObject (readonly)

Returns the value of attribute name.



13
14
15
# File 'lib/milk_tea/bindings/vendored_c_library.rb', line 13

def name
  @name
end

#source_rootObject (readonly)

Returns the value of attribute source_root.



13
14
15
# File 'lib/milk_tea/bindings/vendored_c_library.rb', line 13

def source_root
  @source_root
end

Instance Method Details

#build_flags(platform: nil) ⇒ Object



26
27
28
# File 'lib/milk_tea/bindings/vendored_c_library.rb', line 26

def build_flags(platform: nil)
  include_flags
end

#include_flagsObject



22
23
24
# File 'lib/milk_tea/bindings/vendored_c_library.rb', line 22

def include_flags
  include_roots.map { |path| "-I#{path}" }
end

Raises:

  • (NotImplementedError)


34
35
36
# File 'lib/milk_tea/bindings/vendored_c_library.rb', line 34

def link_flags(platform: nil)
  raise NotImplementedError, "#{self.class} must implement #link_flags"
end

#prepare!(env: ENV, cc: ENV.fetch("CC", "cc"), platform: nil) ⇒ Object

Raises:

  • (NotImplementedError)


30
31
32
# File 'lib/milk_tea/bindings/vendored_c_library.rb', line 30

def prepare!(env: ENV, cc: ENV.fetch("CC", "cc"), platform: nil)
  raise NotImplementedError, "#{self.class} must implement #prepare!"
end