Skip to content

Commit

Permalink
Add libosqp
Browse files Browse the repository at this point in the history
  • Loading branch information
traversaro committed Jan 5, 2021
1 parent 92386ba commit b2bbe53
Show file tree
Hide file tree
Showing 3 changed files with 98 additions and 0 deletions.
24 changes: 24 additions & 0 deletions recipes/libosqp/bld.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
:: Copy qdldl files to the submodule directory
xcopy /E qdldl osqp\lin_sys\direct\qdldl\qdldl_sources\

cd osqp
mkdir build
cd build

cmake ^
-G "NMake Makefiles" ^
-DCMAKE_INSTALL_PREFIX=%LIBRARY_PREFIX% ^
-DCMAKE_PREFIX_PATH=%LIBRARY_PREFIX% ^
-DCMAKE_BUILD_TYPE=Release ^
-DCMAKE_INSTALL_LIBDIR=lib ^
-DBUILD_SHARED_LIBS=ON ^
..
if errorlevel 1 exit 1

:: Build.
cmake --build . --config Release
if errorlevel 1 exit 1

:: Install.
cmake --build . --config Release --target install
if errorlevel 1 exit 1
18 changes: 18 additions & 0 deletions recipes/libosqp/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/sh

# Copy qdldl files to the submodule directory
cp qdldl/. osqp/lin_sys/direct/qdldl/qdldl_sources

cd osqp

mkdir build && cd build

cmake -DCMAKE_INSTALL_PREFIX=$PREFIX \
-DCMAKE_PREFIX_PATH=$PREFIX \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_LIBDIR=lib \
-DBUILD_SHARED_LIBS=ON \
..

make -j${CPU_COUNT}
make install
56 changes: 56 additions & 0 deletions recipes/libosqp/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{% set name = "libosqp" %}
{% set version = "0.6.0" %}

package:
name: {{ name }}
version: {{ version }}

source:
- folder: osqp
url: https://github.com/oxfordcontrol/osqp/archive/v{{ version }}.tar.gz
sha256: 6e00d11d1f88c1e32a4419324b7539b89e8f9cbb1c50afe69f375347c989ba2b

# Manually download repos that are used via git submodules
# Note: make sure that the version used here is compatible with the one used in osqp
- folder: qdldl
url: https://github.com/oxfordcontrol/qdldl/archive/70596afefe1c8a58ddd491ff9b55d976c296a64b.zip
sha256: f48129c5c2f0879866bff8b82f6c0dd35d7c256ef86887905ebc337798a6aabf

build:
number: 0
run_exports:
# No ABI policy is documented, let's be conservative
- {{ pin_subpackage(name, max_pin='x.x.x') }}

requirements:
build:
- {{ compiler('c') }}
- {{ compiler('cxx') }}
- make # [not win]
- cmake


test:
commands:
- test -f ${PREFIX}/include/osqp/osqp.h # [not win]
- test -f ${PREFIX}/lib/libosqp.so # [linux]
- test -f ${PREFIX}/lib/libosqp.dylib # [osx]
- test -f ${PREFIX}/lib/cmake/osqp/osqp-config.cmake # [not win]
- if exist %PREFIX%\\Library\\include\\osqp\\osqp.h (exit 0) else (exit 1) # [win]
- if exist $PREFIX$\\Library\\lib\\osqp.lib (exit 0) else (exit 1) # [win]
- if exist $PREFIX$\\Library\\bin\\osqp.dll (exit 0) else (exit 1) # [win]
- if exist %PREFIX%\\Library\\lib\\cmake\\osqp\\osqp-config.cmake (exit 0) else (exit 1) # [win]

about:
home: https://github.com/oxfordcontrol/osqp
license: Apache-2.0
summary: The Operator Splitting QP Solver.
license_file:
- osqp/LICENSE
- qdldl/LICENSE
- osqp/lin_sys/direct/qdldl/amd/LICENSE

extra:
recipe-maintainers:
- traversaro
- h-vetinari

0 comments on commit b2bbe53

Please sign in to comment.