Sha256: 58447f77222c4e36be2b22f5d8bbf0027e3a8ad210c3b5a94ad198ed39b766ef

Contents?: true

Size: 736 Bytes

Versions: 2

Compression:

Stored size: 736 Bytes

Contents

# dependencies
require "ffi"

# modules
require "libmf/matrix"
require "libmf/model"
require "libmf/version"

module Libmf
  class Error < StandardError; end

  class << self
    attr_accessor :ffi_lib
  end
  lib_name =
    if Gem.win_platform?
      "mf.dll"
    elsif RbConfig::CONFIG["host_os"] =~ /darwin/i
      if RbConfig::CONFIG["host_cpu"] =~ /arm|aarch64/i
        "libmf.arm64.dylib"
      else
        "libmf.dylib"
      end
    else
      if RbConfig::CONFIG["host_cpu"] =~ /arm|aarch64/i
        "libmf.arm64.so"
      else
        "libmf.so"
      end
    end
  vendor_lib = File.expand_path("../vendor/#{lib_name}", __dir__)
  self.ffi_lib = [vendor_lib]

  # friendlier error message
  autoload :FFI, "libmf/ffi"
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
libmf-0.3.0 lib/libmf.rb
libmf-0.2.6 lib/libmf.rb