local.pkgs.matplotplusplus: enable opengl

This commit is contained in:
陈浩南 2023-10-07 22:11:22 +08:00
parent f6a5022aca
commit 22ef0c27f5
2 changed files with 32 additions and 7 deletions

View File

@ -0,0 +1,13 @@
diff --git a/source/matplot/CMakeLists.txt b/source/matplot/CMakeLists.txt
index fe9ad53..4007fae 100644
--- a/source/matplot/CMakeLists.txt
+++ b/source/matplot/CMakeLists.txt
@@ -221,7 +221,7 @@ if (MATPLOTPP_BUILD_EXPERIMENTAL_OPENGL_BACKEND)
if (NOT GLAD_FOUND AND NOT TARGET glad)
# Use CPM only if not found, to avoid ODR violations
# find_package(GLAD REQUIRE) would suffice if it worked well
- FetchContent_Declare(glad GIT_REPOSITORY https://github.com/Dav1dde/glad.git GIT_TAG v0.1.36)
+ FetchContent_Declare(glad SOURCE_DIR @glad@)
FetchContent_MakeAvailable(glad)
else ()
# FindGLAD does not usually create a target, so we create an interface target

View File

@ -1,7 +1,17 @@
{ {
stdenv, fetchFromGitHub, cmake, pkg-config, stdenv, fetchFromGitHub, cmake, pkg-config, substituteAll,
gnuplot, libjpeg, libtiff, zlib, libpng, lapack, blas, fftw, opencv, nodesoup, cimg gnuplot, libjpeg, libtiff, zlib, libpng, lapack, blas, fftw, opencv, nodesoup, cimg, glfw, libGL, python3
}: stdenv.mkDerivation rec }:
let
glad = fetchFromGitHub
{
owner = "Dav1dde";
repo = "glad";
rev = "v0.1.36";
sha256 = "FtkPz0xchwmqE+QgS+nSJVYaAfJSTUmZsObV/IPypVQ=";
};
python = python3.withPackages (pythonPackages: with pythonPackages; [ glad ]);
in stdenv.mkDerivation rec
{ {
pname = "matplotplusplus"; pname = "matplotplusplus";
version = "1.2.0"; version = "1.2.0";
@ -9,14 +19,16 @@
{ {
owner = "alandefreitas"; owner = "alandefreitas";
repo = "matplotplusplus"; repo = "matplotplusplus";
rev = "v${version}"; rev = "a40344efa9dc5ea0c312e6e9ef4eb7238d98dc12";
sha256 = "mYXAB1AbCtcd2rEuluJN6hDKE9+AowodjJt2pdyntes="; sha256 = "6/dH/Rl2aAb8b+Ji5LwzkC+GWPOCBnYCrjy0qk8u/+I=";
}; };
cmakeFlags = cmakeFlags =
[ [
"-DBUILD_SHARED_LIBS=ON" "-DMATPLOTPP_BUILD_SHARED_LIBS=ON" "-DMATPLOTPP_BUILD_EXAMPLES=OFF" "-DBUILD_SHARED_LIBS=ON" "-DMATPLOTPP_BUILD_SHARED_LIBS=ON" "-DMATPLOTPP_BUILD_EXAMPLES=OFF"
"-DMATPLOTPP_WITH_SYSTEM_NODESOUP=ON" "-DMATPLOTPP_WITH_SYSTEM_CIMG=ON" "-DMATPLOTPP_WITH_SYSTEM_NODESOUP=ON" "-DMATPLOTPP_WITH_SYSTEM_CIMG=ON"
"-DMATPLOTPP_BUILD_EXPERIMENTAL_OPENGL_BACKEND=ON" "-DGLAD_REPRODUCIBLE=ON"
]; ];
buildInputs = [ gnuplot libjpeg libtiff zlib libpng lapack blas fftw opencv nodesoup cimg ]; patches = [(substituteAll { src = ./add-glad.patch; inherit glad; })];
nativeBuildInputs = [ cmake pkg-config ]; buildInputs = [ gnuplot libjpeg libtiff zlib libpng lapack blas fftw opencv nodesoup cimg glfw libGL python ];
nativeBuildInputs = [ cmake pkg-config python ];
} }