![]() |
TinySpline
0.6.0
Spline Library for a Multitude of Programming Languages
|
TinySpline uses the CMake build system to compile and package its interfaces. The following compiler suites are tested: GCC, Clang, and MSVC. In order to create the bindings, Swig (3.0.1 or later) must be available. Each binding may have additional dependencies that are necessary to compile the native library of the target language. The following table gives an overview:
Language | Dependencies to Generate Source | (Relative) Output Directory |
---|---|---|
C# | csharp | |
D | - | dlang |
Golang | - | go |
Java | Java Development Kit | java/org/tinyspline |
Lua | Lua headers | lua |
Octave | Octave headers | octave |
PHP | PHP (Zend) headers * | php |
Python | Python headers | python |
R | R headers and RCPP | r |
Ruby | Ruby headers | ruby |
In addition, the following tools are required to compile the generated interface files (.java files etc.) and create the binary package of the target language using CMake:
Language | Required Tool(s) | Output File |
---|---|---|
C# | Any of: csc, mcs, dmcs, gmcs | TinySpline.dll |
Java | javac and jar (available in JDK) | tinyspline.jar |
Checkout the repository and cd into it:
Create a build directory and cd into it:
Run CMake and build the project:
To build a specific interface, use -DTINYSPLINE_ENABLE_<LANGUAGE>
when setting up CMake (<LANGUAGE>
is interface you want to build). For example:
Note that the C interface is always enabled and cannot be disabled. By default, the C++ interface is enabled but can be disabled by setting the corresponding CMake option to False
, Off
etc.
To enable all interfaces at once, use -DTINYSPLINE_ENABLE_ALL_INTERFACES
:
You will find the libraries and packages in tinyspline/build/lib
.
While generating the Python binding, Swig needs to distinguish between Python 2 and Python 3. That is, Swig uses the command line parameter -py
to generate Python 2 compatible code and -py3
to generate Python 3 compatible code. Accordingly, Swig is configured depending on the Python version found by CMake during initialization. On systems with multiple versions of Python installed, CMake usually chooses the more recent one. If you want to use a specific version of Python instead, set the CMake option TINYSPLINE_PYTHON_VERSION
to 2
or 3
.
The following example shows how to force CMake to use Python 2 rather than Python 3:
The following command installs the C and C++ (if enabled) interface to your system:
This command also installs a set of CMake config scripts and pkg-config files (for the C and C++ interface respectively). The CMake config script of the C interface exports the following variables:
add_definitions
.The CMake config script of the C++ interface exports the same variables except that they have prefix TINYSPLINECXX
, e.g., TINYSPLINECXX_INCLUDE_DIRS
.
Use the CMake commands find_package(tinyspline)
(C) and find_package(tinysplinecxx)
(C++) to include TinySpline into your project.
Depending on your build configuration, binding-related distribution files are generated within the root of your build directory. For example, the file setup.py
is generated if Python is enabled. Currently, the following build tools are supported: NuGet (C#), Dub (D), Maven (Java), and Luarocks (Lua), Setuptools (Python), RubyGems (Ruby).