Top Level Namespace
Defined Under Namespace
Classes: NMatrix
Instance Method Summary collapse
-
#create_conf_h(file) ⇒ Object
Function derived from NArray’s extconf.rb.
-
#find_newer_gplusplus ⇒ Object
:nodoc:.
- #gplusplus_version ⇒ Object
Instance Method Details
#create_conf_h(file) ⇒ Object
Function derived from NArray’s extconf.rb.
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'ext/nmatrix_fftw/extconf.rb', line 30 def create_conf_h(file) #:nodoc: print "creating #{file}\n" File.open(file, 'w') do |hfile| header_guard = file.upcase.sub(/\s|\./, '_') hfile.puts "#ifndef #{header_guard}" hfile.puts "#define #{header_guard}" hfile.puts # FIXME: Find a better way to do this: hfile.puts "#define RUBY_2 1" if RUBY_VERSION >= '2.0' for line in $defs line =~ /^-D(.*)/ hfile.printf "#define %s 1\n", $1 end hfile.puts hfile.puts "#endif" end end |
#find_newer_gplusplus ⇒ Object
:nodoc:
52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'ext/nmatrix_fftw/extconf.rb', line 52 def find_newer_gplusplus #:nodoc: print "checking for apparent GNU g++ binary with C++0x/C++11 support... " [9,8,7,6,5,4,3].each do |minor| ver = "4.#{minor}" gpp = "g++-#{ver}" result = `which #{gpp}` next if result.empty? CONFIG['CXX'] = gpp puts ver return CONFIG['CXX'] end false end |
#gplusplus_version ⇒ Object
66 67 68 69 70 71 72 73 74 75 |
# File 'ext/nmatrix_fftw/extconf.rb', line 66 def gplusplus_version cxxvar = proc { |n| `#{CONFIG['CXX']} -E -dM - </dev/null | grep #{n}`.chomp.split(' ')[2] } major = cxxvar.call('__GNUC__') minor = cxxvar.call('__GNUC_MINOR__') patch = cxxvar.call('__GNUC_PATCHLEVEL__') raise("unable to determine g++ version (match to get version was nil)") if major.nil? || minor.nil? || patch.nil? "#{major}.#{minor}.#{patch}" end |