forked from NixOS/nixpkgs
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
87 additions
and
0 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
pkgs/development/libraries/science/math/osqp/0001-Link-mkl-and-openmp-dependencies.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
From aa856edff31126d16e32f820b3652f6fecdfb4c6 Mon Sep 17 00:00:00 2001 | ||
From: Benjamin Hipple <bhipple@protonmail.com> | ||
Date: Sat, 22 Sep 2018 13:10:20 -0400 | ||
Subject: [PATCH] Link mkl and openmp dependencies | ||
|
||
--- | ||
CMakeLists.txt | 10 ++++++++++ | ||
1 file changed, 10 insertions(+) | ||
|
||
diff --git a/CMakeLists.txt b/CMakeLists.txt | ||
index 991d75e..41e89c5 100644 | ||
--- a/CMakeLists.txt | ||
+++ b/CMakeLists.txt | ||
@@ -308,6 +308,12 @@ target_include_directories(osqpstatic | ||
PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>" | ||
"$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/${CMAKE_INSTALL_INCLUDEDIR}/osqp>") | ||
|
||
+if (ENABLE_MKL_PARDISO) | ||
+ find_library(mkl_rt REQUIRED) | ||
+ find_library(omp REQUIRED) | ||
+ target_link_libraries(osqpstatic mkl_rt omp) | ||
+endif() | ||
+ | ||
# Install Static Library | ||
# ---------------------------------------------- | ||
|
||
@@ -339,6 +345,10 @@ if (NOT PYTHON AND NOT MATLAB AND NOT R_LANG) | ||
# NB: Add all the linear system solvers here | ||
add_library (osqp SHARED ${osqp_src} ${osqp_headers} ${linsys_solvers}) | ||
|
||
+ if (ENABLE_MKL_PARDISO) | ||
+ target_link_libraries(osqp mkl_rt omp) | ||
+ endif() | ||
+ | ||
# Include directories for linear system solvers | ||
target_include_directories(osqp PRIVATE ${linsys_solvers_includes}) | ||
|
||
-- | ||
2.12.2 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
{ stdenv, fetchFromGitHub, cmake, python, numpy, scipy | ||
, mkl # TODO: Make this parameterizable and null by default | ||
}: | ||
|
||
stdenv.mkDerivation rec { | ||
name = "osqp-${version}"; | ||
version = "0.4.0"; | ||
|
||
src = fetchFromGitHub { | ||
owner = "oxfordcontrol"; | ||
repo = "osqp"; | ||
rev = "v${version}"; | ||
sha256 = "0jm8ic55knm68rhy68gkpv73bqd91schkzc7g9cghxgdp651x12f"; | ||
fetchSubmodules = true; | ||
}; | ||
|
||
# Actually link mkl, instead of relying on devs to set LD_LIBRARY_PATH manually | ||
patches = [ | ||
./0001-Link-mkl-and-openmp-dependencies.patch | ||
]; | ||
|
||
buildInputs = [ cmake python numpy scipy mkl ]; | ||
|
||
# MKL Pardiso requires the proprietary Intel MKL libraries | ||
cmakeFlags = [ | ||
"-DUNITTESTS=ON" | ||
"-DENABLE_MKL_PARDISO=ON" | ||
]; | ||
|
||
doCheck = true; | ||
checkPhase = '' | ||
./out/osqp_demo | ||
./out/osqp_tester | ||
''; | ||
|
||
meta = with stdenv.lib; { | ||
description = "Operator Splitting Quadratic Program Solver"; | ||
homepage = https://osqp.org; | ||
license = licenses.asl20; | ||
platforms = platforms.all; | ||
maintainers = [ maintainers.bhipple ]; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters