Sha256: 944de6595363a2577a83ddebdf37efd8d0158008385f743207ae93140fc5335d

Contents?: true

Size: 833 Bytes

Versions: 2

Compression:

Stored size: 833 Bytes

Contents

# dependencies
require "ffi"

# stdlib
require "tmpdir"

# modules
require "ngt/utils"
require "ngt/index"
require "ngt/optimizer"
require "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.4.1 lib/ngt.rb
ngt-0.4.0 lib/ngt.rb