Sha256: d5f0b62ce3a111570ba4af4d1549b356973029bef0092cc6713112c8a9c5377e

Contents?: true

Size: 669 Bytes

Versions: 1

Compression:

Stored size: 669 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/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.2 lib/osqp.rb