Skip to content

2.Installation

Abhishek Pandala edited this page Oct 31, 2021 · 5 revisions

Download

qpSWIFT can be downloaded from the following [link] as

git clone https://github.com/qpSWIFT/qpSWIFT

Installation

C/C++

(Prerequisites: cmake, c/c++ compiler)

Linux

To build the qpSWIFT library from the source on your system, download the qpSWIFT repository and type the following commands from the qpSWIFT project source directory

cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build --config Release

To install the libraries, type

sudo cmake --build build --target install

or

cd build
sudo make install

You can now add qpSWIFT to your project. Instructions for this can be found in adding qpSWIFT to cmake. Take a look at the demo files in c/c++ interface.

macOS

To build the qpSWIFT library from the source on your system, download the qpSWIFT repository and type the following commands from the qpSWIFT project source directory

cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build --config Release

To install the libraries, type

sudo cmake --build build --target install

or

cd build
sudo make install

You can now add qpSWIFT to your project. Instructions for this can be found in adding qpSWIFT to cmake. Take a look at the demo files in c/c++ interface.

Windows

On Windows machine, download the qpSWIFT repository and type the following commands from the qpSWIFT project source directory in the command prompt or windows powershell

cmake -S . -B build

To generate build files for a specific MSVC version (e.g., Visual Studio 15 compiler), use

cmake -S . -B build -G "Visual Studio 15 2017"

This creates the necessary build files to generate qpSWIFT libraries. Alternatively, you can use the cmake-gui to generate build files. To compile the libraries, type

cmake --build build -j8 --config Release

Please ensure that you have permission to install libraries on your system. The install folder can be set via CMAKE_INSTALL_PREFIX. To install the libraries,

cmake --build build --target install

You can now add qpSWIFT to your project. Instructions for this can be found in adding qpSWIFT to cmake. Take a look at the demo files in Section - \ref{cintrfc}

Adding qpSWIFT to your project

To incorporate qpSWIFT into your project, add the following lines into your cmake file

find_package(qpSWIFT)
// To incorporate static library
target_link_libraries(<target_name> PRIVATE qpSWIFT::qpSWIFT-static)
// To incorporate shared library
target_link_libraries(<target_name> PRIVATE qpSWIFT::qpSWIFT-shared)

Matlab

(Prerequisites: Matlab compatible c compiler)

To build the qpSWIFT matlab interface from the source on your system, download the qpSWIFT repository and change the matlab working directory to qpSWIFT/matlab. Type the following command in the command window from the qpSWIFT matlab directory

Swift_make('qpSWIFT_mex.c')

This creates a mex file depending on the configuration of the system. To use qpSWIFT in your projects, copy this mex file into project working directory or add this folder to the matlab search path. You can run the demoqp.m file to check if the installation was successful. Instructions on using the qpSWIFT matlab interface can be found at \ref{matintrfc}

Python

(Prerequisites: c compiler, numpy, distutils)

To build the qpSWIFT python interface from the source on your system, type the following command from the qpSWIFT python directory in the system command line.

sudo python3 setup.py install

Depending on the system, you may require administrator privileges. This builds and installs qpSWIFT module in your system. You can run the demoqp.py file to check if the installation is successful. Instructions on using the qpSWIFT python interface can be found at

Simulink

In Progress ...

Clone this wiki locally