Build from sources¶
Install GCC and CMake¶
The main compilation directives are specified using
cmake commands are already installed by default.
Install Xcode and command line tools¶
Install the latest release of Xcode.
Install the command line tools by executing from the terminal
Build the binaries¶
Run the following commands from the terminal
Clone the repository, create
builddirectory and change directory
On Linux and Mac OS run
git clone https://github.com/oxfordcontrol/osqp cd osqp mkdir build cd build
On Windows run
git clone -c core.symlinks=true https://github.com/oxfordcontrol/osqp cd osqp mkdir build cd build
In Linux and Mac OS run
cmake -G "Unix Makefiles" ..
In Windows run
cmake -G "MinGW Makefiles" ..
cmake --build .
Thanks to CMake, it is possible to create projects for a wide variety of IDEs; see here for more details. For example, to create a project for Visual Studio 14 2015, it is just necessary to run
cmake -G "Visual Studio 14 2015" ..
The compilation will generate the demo
osqp_demo and the unittests
osqp_tester executables. In the case of
Makefiles option they are located in the
build/out/ directory. Run them to check that the compilation was correct.
Once the sources are built, the generated static
build/out/libosqpstatic.a and shared
build/out/libosqp.ext libraries can be used to interface any C/C++ software to OSQP (see CC++ installation).
Install the binaries¶
To install the generated libraries and headers to a system-wide location compatible with GNU standards it is just necessary to run
cmake --build . --target install
This code installs the libraries in
libdir and the headers into
includedir/osqp. For mode details see the defaults folders on the GNU standards website.
To change the installation prefix, in the “Create Makefiles” step above, you need to specify the destination folder as
cmake -DCMAKE_INSTALL_PREFIX:PATH=myfolder ...
We provided also an uninstall routine to remove the copied files by running
cmake --build . --target uninstall
Note that this corresponds to running
make install and
make uninstall on unix machines.