Module: ExtconfHelper

Defined in:
ext/alt_printf/extconf_helper.rb

Constant Summary collapse

BASE_DIR =
File.join(__dir__, '../../../')

Class Method Summary collapse

Class Method Details

.dev_headerObject



8
9
10
# File 'ext/alt_printf/extconf_helper.rb', line 8

def dev_header
  find_header('altprintf.h', File.join(BASE_DIR, 'src'))
end

.dev_objs(folder = 'release') ⇒ Object



12
13
14
# File 'ext/alt_printf/extconf_helper.rb', line 12

def dev_objs(folder = 'release')
  $objs = Dir[File.join(BASE_DIR, "target/#{folder}/*.o")] + ['alt_printf.o']
end

.setup(mode = 'release') ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'ext/alt_printf/extconf_helper.rb', line 16

def setup(mode = 'release')
  puts "extconf setting up #{mode}"
  case mode
  when 'release'
    # do nothing
  when 'dev'
    dev_header
    dev_objs('release')
  when 'debug'
    dev_header
    $defs.push("-DDEBUG")
    dev_objs('debug')
  else
    raise(ArgumentError, "invalid mode #{mode}")
  end

  create_header
  create_makefile('alt_printf')
end