Sha256: 51c6f7d80f5ece94f71ac3df1553a70dee26e7f8d4c8044aea3f98ac40c0e22d

Contents?: true

Size: 677 Bytes

Versions: 1

Compression:

Stored size: 677 Bytes

Contents

# stdlib
require "fiddle/import"

# modules
require "osqp/solver"
require "osqp/version"

module OSQP
  class Error < StandardError; end

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

  # friendlier error message
  autoload :FFI, "osqp/ffi"

  def self.lib_version
    FFI.osqp_version.to_s
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
osqp-0.1.3 lib/osqp.rb