Opal Kelly Ruby Gem
This gem provides access to FrontPanel API from Ruby. In order to use this
extension, you must have Opal Kelly FrontPanel SDK installed.
Installation
Ensure that FrontPanel SDK is installed and okFP_SDK
environment variable is
defined to point to the location of API
subdirectory of the SDK installation.
You also need to have a working C++ compiler in order to build the native
extension which is part of this gem. Under Microsoft Windows systems, you need
to install RubyInstaller to compile
Ruby extensions, unless you already have it. Note that when selecting the file
to download, you should choose a version with development kit (i.e. with
Ruby+DevKit
in its name) unless, again, you already have a functioning MSYS2
installation.
If the requirements are satisfied, a simple
> gem install OpalKelly
should build the extension and install the gem. If you get any errors about
missing headers or libraries, please check that okFP_SDK
is defined
correctly. If you have the okFrontPanel.h
header or the library in some
non-default location, you may also set okFP_SDK_INCLUDE
and okFP_SDK_LIBS
environment variables to point to them directly. Finally, you can also specify
their locations on gem install
command line after --
, e.g.:
> gem install OpalKelly -- --with-frontpanel-include=c:/fp/inc --with-frontpanel-lib=c:/fp/lib
Use
Gem API parallels FrontPanel C++ API, please see the documentation for
more information.
Here is a very simple example which can be used to check that the gem is
installed correctly:
require 'OpalKelly' puts "Using OpalKelly SDK #{OpalKelly::GetAPIVersionString()}"
Please notice that Ruby programs using this gem must be able to load FrontPanel
SDK shared library during run-time and this may require separate set up:
Under Microsoft Windows systems, you need to set the special RUBY_DLL_PATH
environment variable to the directory containing okFrontPanel.dll
to allow
recent Ruby version find this DLL. Please note that having this DLL in one of
the directories included in the usual PATH
variable is not sufficient.
Under Unix-like systems, you can simply copy the shared libokFrontPanel.so
library to one of the directories searched by default (e.g. /usr/local/lib
)
or add $okFP_SDK
to the standard environment variable containing the list of
directories to search, i.e. DYLD_LIBRARY_PATH
under macOS or
LD_LIBRARY_PATH
elsewhere.
License
The gem is available as open source under the terms of the
MIT License.