|
| 1 | +{ |
| 2 | + cmake, |
| 3 | + crocoddyl, |
| 4 | + fetchFromGitHub, |
| 5 | + lib, |
| 6 | + llvmPackages, |
| 7 | + pkg-config, |
| 8 | + proxsuite, |
| 9 | + python3Packages, |
| 10 | + pythonSupport ? false, |
| 11 | + stdenv, |
| 12 | +}: |
| 13 | + |
| 14 | +stdenv.mkDerivation (finalAttrs: { |
| 15 | + pname = "mim-solvers"; |
| 16 | + version = "0.0.5"; |
| 17 | + |
| 18 | + src = fetchFromGitHub { |
| 19 | + owner = "machines-in-motion"; |
| 20 | + repo = "mim_solvers"; |
| 21 | + rev = "v${finalAttrs.version}"; |
| 22 | + hash = "sha256-XV8EJqCOTYqljZe2PQvnhIaPUOJ+bBjRIoshdeqZycA="; |
| 23 | + }; |
| 24 | + |
| 25 | + # eigenpy is not used without python support |
| 26 | + postPatch = lib.optionalString (!pythonSupport) '' |
| 27 | + substituteInPlace CMakeLists.txt --replace-fail \ |
| 28 | + "add_project_dependency(eigenpy 2.7.10 REQUIRED)" \ |
| 29 | + "" |
| 30 | + ''; |
| 31 | + |
| 32 | + nativeBuildInputs = [ |
| 33 | + cmake |
| 34 | + pkg-config |
| 35 | + ] ++ lib.optional pythonSupport python3Packages.pythonImportsCheckHook; |
| 36 | + buildInputs = lib.optional stdenv.hostPlatform.isDarwin llvmPackages.openmp; |
| 37 | + propagatedBuildInputs = |
| 38 | + lib.optionals pythonSupport [ |
| 39 | + python3Packages.crocoddyl |
| 40 | + python3Packages.osqp |
| 41 | + python3Packages.proxsuite |
| 42 | + python3Packages.scipy |
| 43 | + ] |
| 44 | + ++ lib.optionals (!pythonSupport) [ |
| 45 | + crocoddyl |
| 46 | + proxsuite |
| 47 | + ]; |
| 48 | + |
| 49 | + cmakeFlags = |
| 50 | + [ |
| 51 | + (lib.cmakeBool "BUILD_PYTHON_INTERFACE" pythonSupport) |
| 52 | + (lib.cmakeBool "BUILD_WITH_PROXSUITE" true) |
| 53 | + ] |
| 54 | + ++ lib.optional (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64) ( |
| 55 | + lib.cmakeFeature "CMAKE_CTEST_ARGUMENTS" "--exclude-regex;'test_solvers'" |
| 56 | + ); |
| 57 | + |
| 58 | + doCheck = true; |
| 59 | + pythonImportsCheck = [ "mim_solvers" ]; |
| 60 | + |
| 61 | + meta = { |
| 62 | + description = "Numerical solvers used in the Machines in Motion Laboratory"; |
| 63 | + homepage = "https://github.com/machines-in-motion/mim_solvers"; |
| 64 | + license = lib.licenses.bsd3; |
| 65 | + maintainers = with lib.maintainers; [ nim65s ]; |
| 66 | + platforms = lib.platforms.all; |
| 67 | + }; |
| 68 | +}) |
0 commit comments