Sha256: cd8e4ea8e1ba10b548e729ea0ddf7b18fc2a3b65b071b8ff9a32d792a69fd03c

Contents?: true

Size: 1.4 KB

Versions: 3

Compression:

Stored size: 1.4 KB

Contents

require 'mkmf'
require 'numo/narray'
require 'erb'

ldirs = [
 dir_config("mkl")[1],
 dir_config("openblas")[1],
 dir_config("atlas")[1],
 dir_config("blas")[1],
 dir_config("lapack")[1],
]
bked = with_config("backend")

FileUtils.mkdir_p "lib"
open("lib/site_conf.rb","w"){|f| f.write "
module Numo
  module Linalg
    BACKEND = #{bked.inspect}
    MKL_LIBPATH = #{ldirs[0].inspect}
    OPENBLAS_LIBPATH = #{ldirs[1].inspect}
    ATLAS_LIBPATH = #{ldirs[2].inspect}
    BLAS_LIBPATH = #{ldirs[3].inspect}
    LAPACK_LIBPATH = #{ldirs[4].inspect}
  end
end"}

$LOAD_PATH.each do |x|
  if File.exist? File.join(x,'numo/numo/narray.h')
    $INCFLAGS = "-I#{x}/numo " + $INCFLAGS
    break
  end
end

srcs = %w(
blas
blas_s
blas_d
blas_c
blas_z
)
$objs = srcs.collect{|i| i+".o"}

if !have_header('numo/narray.h')
  puts "
  Header numo/narray.h was not found. Give pathname as follows:
  % ruby extconf.rb --with-narray-include=narray_h_dir"
  exit(1)
end

if have_header("dlfcn.h")
  exit(1) unless have_library("dl")
  exit(1) unless have_func("dlopen")
elsif have_header("windows.h")
  exit(1) unless have_func("LoadLibrary")
end

dep_path = File.join(__dir__, "depend")
File.open(dep_path, "w") do |dep|
  dep_erb_path = File.join(__dir__, "depend.erb")
  File.open(dep_erb_path, "r") do |dep_erb|
    erb = ERB.new(dep_erb.read)
    erb.filename = dep_erb_path
    dep.print(erb.result)
  end
end

create_makefile('numo/linalg/blas')

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
numo-linalg-0.1.1 ext/numo/linalg/blas/extconf.rb
numo-linalg-0.1.0 ext/numo/linalg/blas/extconf.rb
numo-linalg-0.0.1 ext/numo/linalg/blas/extconf.rb