Sha256: 891df86f48585ad982433c26b4b28a763f58cf94cb57b475b38dffd6d9b4f3a3

Contents?: true

Size: 869 Bytes

Versions: 2

Compression:

Stored size: 869 Bytes

Contents

# dependencies
require "ffi"

# stdlib
require "tmpdir"

# modules
require_relative "ngt/utils"
require_relative "ngt/index"
require_relative "ngt/optimizer"
require_relative "ngt/version"

module Ngt
  class Error < StandardError; end

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

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ngt-0.5.0 lib/ngt.rb
ngt-0.4.2 lib/ngt.rb