python3Packages.piqp: init at 0.4.2 (#333273)
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
{
|
||||
lib,
|
||||
stdenv,
|
||||
fetchFromGitHub,
|
||||
cmake,
|
||||
static ? stdenv.hostPlatform.isStatic,
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "cpu_features";
|
||||
version = "0.9.0";
|
||||
|
||||
outputs = [
|
||||
"out"
|
||||
"dev"
|
||||
];
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "google";
|
||||
repo = "cpu_features";
|
||||
rev = "v${version}";
|
||||
hash = "sha256-uXN5crzgobNGlLpbpuOxR+9QVtZKrWhxC/UjQEakJwk=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ cmake ];
|
||||
|
||||
cmakeFlags = [ "-DBUILD_SHARED_LIBS=${if static then "OFF" else "ON"}" ];
|
||||
|
||||
meta = with lib; {
|
||||
description = "A cross platform C99 library to get cpu features at runtime";
|
||||
homepage = "https://github.com/google/cpu_features";
|
||||
license = licenses.asl20;
|
||||
platforms = platforms.all;
|
||||
maintainers = with maintainers; [ renesat ];
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
{
|
||||
lib,
|
||||
fetchFromGitHub,
|
||||
buildPythonPackage,
|
||||
pytestCheckHook,
|
||||
stdenv,
|
||||
pythonOlder,
|
||||
setuptools,
|
||||
cmake,
|
||||
ninja,
|
||||
wheel,
|
||||
matio,
|
||||
eigen,
|
||||
gtest,
|
||||
cpu_features,
|
||||
pybind11,
|
||||
python,
|
||||
numpy,
|
||||
scipy,
|
||||
}:
|
||||
buildPythonPackage rec {
|
||||
pname = "piqp";
|
||||
version = "0.4.2";
|
||||
pyproject = true;
|
||||
|
||||
disabled = pythonOlder "3.7";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "PREDICT-EPFL";
|
||||
repo = "piqp";
|
||||
rev = "refs/tags/v${version}";
|
||||
hash = "sha256-/lADjg4NyDdV9yeYBW2gbPydY8TfV247B/dI/ViRVlI=";
|
||||
};
|
||||
|
||||
postPatch =
|
||||
let
|
||||
# E.g. 3.11.2 -> "311"
|
||||
pythonVersionMajorMinor =
|
||||
with lib.versions;
|
||||
"${major python.pythonVersion}${minor python.pythonVersion}";
|
||||
|
||||
# E.g. "linux-aarch64"
|
||||
platform = with stdenv.hostPlatform.parsed; "${kernel.name}-${cpu.name}";
|
||||
in
|
||||
''
|
||||
build="build/temp.${platform}-cpython-${pythonVersionMajorMinor}/${pname}.${pname}"
|
||||
mkdir -p $build/_deps
|
||||
ln -s ${cpu_features.src} $build/_deps/cpu_features-src
|
||||
'';
|
||||
|
||||
patches = [ ./use-nix-packages.patch ];
|
||||
|
||||
build-system = [
|
||||
setuptools
|
||||
cmake
|
||||
ninja
|
||||
wheel
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
matio
|
||||
eigen
|
||||
gtest
|
||||
pybind11
|
||||
];
|
||||
|
||||
dontUseCmakeConfigure = true;
|
||||
|
||||
pythonImportsCheck = [ "piqp" ];
|
||||
|
||||
nativeCheckInputs = [
|
||||
pytestCheckHook
|
||||
numpy
|
||||
scipy
|
||||
];
|
||||
|
||||
meta = with lib; {
|
||||
description = "A Proximal Interior Point Quadratic Programming solver";
|
||||
homepage = "https://github.com/PREDICT-EPFL/piqp";
|
||||
license = licenses.bsd2;
|
||||
maintainers = with maintainers; [ renesat ];
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index ea1da5e..0a6f096 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -100,7 +100,7 @@ if (BUILD_PYTHON_INTERFACE OR BUILD_MATLAB_INTERFACE)
|
||||
include(FetchContent)
|
||||
FetchContent_Declare(
|
||||
cpu_features
|
||||
- URL https://github.com/google/cpu_features/archive/refs/tags/v0.9.0.zip
|
||||
+ DOWNLOAD_COMMAND true
|
||||
)
|
||||
set(BUILD_SHARED_LIBS_COPY ${BUILD_SHARED_LIBS})
|
||||
set(BUILD_SHARED_LIBS OFF)
|
||||
diff --git a/interfaces/c/tests/CMakeLists.txt b/interfaces/c/tests/CMakeLists.txt
|
||||
index 010f038..c8f9ec4 100644
|
||||
--- a/interfaces/c/tests/CMakeLists.txt
|
||||
+++ b/interfaces/c/tests/CMakeLists.txt
|
||||
@@ -13,18 +13,8 @@ if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0")
|
||||
endif()
|
||||
|
||||
# Google Test
|
||||
-include(FetchContent)
|
||||
-FetchContent_Declare(
|
||||
- googletest
|
||||
- URL https://github.com/google/googletest/archive/86add13493e5c881d7e4ba77fb91c1f57752b3a4.zip
|
||||
-)
|
||||
-# For Windows: Prevent overriding the parent project's compiler/linker settings
|
||||
-set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
|
||||
-FetchContent_GetProperties(googletest)
|
||||
-if(NOT googletest_POPULATED)
|
||||
- FetchContent_Populate(googletest)
|
||||
- add_subdirectory(${googletest_SOURCE_DIR} ${googletest_BINARY_DIR} EXCLUDE_FROM_ALL)
|
||||
-endif()
|
||||
+# Use find_package to use the gtest package provided by Nix
|
||||
+find_package(GTest REQUIRED)
|
||||
|
||||
enable_testing()
|
||||
|
||||
diff --git a/interfaces/python/CMakeLists.txt b/interfaces/python/CMakeLists.txt
|
||||
index f7415dc..885aeff 100644
|
||||
--- a/interfaces/python/CMakeLists.txt
|
||||
+++ b/interfaces/python/CMakeLists.txt
|
||||
@@ -14,19 +14,7 @@ if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0")
|
||||
endif()
|
||||
|
||||
# Find pybind11
|
||||
-include(FetchContent)
|
||||
-FetchContent_Declare(
|
||||
- pybind11
|
||||
- URL https://github.com/pybind/pybind11/archive/refs/tags/v2.12.0.zip
|
||||
-)
|
||||
-FetchContent_MakeAvailable(pybind11)
|
||||
-
|
||||
-# detect arm64 cross compilation on macOS
|
||||
-if(DEFINED ENV{_PYTHON_HOST_PLATFORM})
|
||||
- if($ENV{_PYTHON_HOST_PLATFORM} MATCHES "arm64")
|
||||
- set(CMAKE_SYSTEM_PROCESSOR "arm64")
|
||||
- endif()
|
||||
-endif()
|
||||
+find_package(pybind11 REQUIRED)
|
||||
|
||||
# add instruction set detection on x86/amd64
|
||||
pybind11_add_module(instruction_set src/instruction_set.cpp)
|
||||
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
|
||||
index d11bd37..2275a62 100644
|
||||
--- a/tests/CMakeLists.txt
|
||||
+++ b/tests/CMakeLists.txt
|
||||
@@ -14,18 +14,8 @@ if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0")
|
||||
endif()
|
||||
|
||||
# Google Test
|
||||
-include(FetchContent)
|
||||
-FetchContent_Declare(
|
||||
- googletest
|
||||
- URL https://github.com/google/googletest/archive/86add13493e5c881d7e4ba77fb91c1f57752b3a4.zip
|
||||
-)
|
||||
-# For Windows: Prevent overriding the parent project's compiler/linker settings
|
||||
-set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
|
||||
-FetchContent_GetProperties(googletest)
|
||||
-if(NOT googletest_POPULATED)
|
||||
- FetchContent_Populate(googletest)
|
||||
- add_subdirectory(${googletest_SOURCE_DIR} ${googletest_BINARY_DIR} EXCLUDE_FROM_ALL)
|
||||
-endif()
|
||||
+# Use find_package to use the gtest package provided by Nix
|
||||
+find_package(GTest REQUIRED)
|
||||
|
||||
enable_testing()
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
quadprog,
|
||||
scs,
|
||||
highspy,
|
||||
piqp,
|
||||
}:
|
||||
buildPythonPackage rec {
|
||||
pname = "qpsolvers";
|
||||
@@ -49,7 +50,7 @@ buildPythonPackage rec {
|
||||
highs = [ highspy ];
|
||||
# mosek = [ cvxopt mosek ];
|
||||
osqp = [ osqp ];
|
||||
# piqp = [ piqp ];
|
||||
piqp = [ piqp ];
|
||||
# proxqp = [ proxsuite ];
|
||||
# qpalm = [ qpalm ];
|
||||
quadprog = [ quadprog ];
|
||||
@@ -60,9 +61,10 @@ buildPythonPackage rec {
|
||||
clarabel
|
||||
cvxopt
|
||||
daqp
|
||||
osqp # piqp proxqp qpalm
|
||||
ecos
|
||||
highs
|
||||
osqp
|
||||
piqp # proxqp qpalm
|
||||
quadprog
|
||||
scs
|
||||
];
|
||||
|
||||
@@ -10149,6 +10149,8 @@ self: super: with self; {
|
||||
|
||||
pipetools = callPackage ../development/python-modules/pipetools { };
|
||||
|
||||
piqp = callPackage ../development/python-modules/piqp { };
|
||||
|
||||
pg8000 = callPackage ../development/python-modules/pg8000 { };
|
||||
|
||||
pgcli = callPackage ../development/python-modules/pgcli { };
|
||||
|
||||
Reference in New Issue
Block a user