From 7dc21c53ec264231d88016ac4a76528b669e4313 Mon Sep 17 00:00:00 2001 From: Silvio Traversaro Date: Sun, 3 Jan 2021 00:36:16 +0100 Subject: [PATCH] Add libosqp --- recipes/libosqp/bld.bat | 24 +++++++++++++++++ recipes/libosqp/build.sh | 18 +++++++++++++ recipes/libosqp/meta.yaml | 56 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 98 insertions(+) create mode 100644 recipes/libosqp/bld.bat create mode 100644 recipes/libosqp/build.sh create mode 100644 recipes/libosqp/meta.yaml diff --git a/recipes/libosqp/bld.bat b/recipes/libosqp/bld.bat new file mode 100644 index 0000000000000..df6847b800905 --- /dev/null +++ b/recipes/libosqp/bld.bat @@ -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 \ No newline at end of file diff --git a/recipes/libosqp/build.sh b/recipes/libosqp/build.sh new file mode 100644 index 0000000000000..5a464b4c6b82b --- /dev/null +++ b/recipes/libosqp/build.sh @@ -0,0 +1,18 @@ +#!/bin/sh + +# Copy qdldl files to the submodule directory +cp -r 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 \ No newline at end of file diff --git a/recipes/libosqp/meta.yaml b/recipes/libosqp/meta.yaml new file mode 100644 index 0000000000000..52604ecd1777e --- /dev/null +++ b/recipes/libosqp/meta.yaml @@ -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