2021-09-18 10:52:07 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, cmake }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2021-09-18 10:52:07 +00:00
|
|
|
version = "0.9.9.8";
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "glm";
|
|
|
|
|
2021-09-18 10:52:07 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "g-truc";
|
|
|
|
repo = pname;
|
|
|
|
rev = version;
|
|
|
|
sha256 = "sha256-F//+3L5Ozrw6s7t4LrcUmO7sN30ZSESdrPAYX57zgr8=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-09-18 10:52:07 +00:00
|
|
|
outputs = [ "out" "doc" ];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
nativeBuildInputs = [ cmake ];
|
|
|
|
|
2021-09-18 10:52:07 +00:00
|
|
|
cmakeFlags = [
|
|
|
|
"-DBUILD_SHARED_LIBS=OFF"
|
|
|
|
"-DBUILD_STATIC_LIBS=OFF"
|
|
|
|
"-DGLM_TEST_ENABLE=${if doCheck then "ON" else "OFF"}"
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-09-18 10:52:07 +00:00
|
|
|
doCheck = true;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-09-18 10:52:07 +00:00
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-09-18 10:52:07 +00:00
|
|
|
# Install header-only library
|
|
|
|
mkdir -p $out/include
|
|
|
|
cp -rv ../glm $out/include
|
|
|
|
rm $out/include/glm/CMakeLists.txt
|
|
|
|
rm $out/include/glm/detail/*.cpp
|
|
|
|
|
|
|
|
# Install CMake files
|
|
|
|
mkdir -p $out/lib
|
|
|
|
cp -rv ../cmake $out/lib
|
|
|
|
substituteInPlace $out/lib/cmake/glm/glmConfig.cmake \
|
|
|
|
--replace 'GLM_INCLUDE_DIRS ''${_IMPORT_PREFIX}' "GLM_INCLUDE_DIRS $out/include"
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-09-18 10:52:07 +00:00
|
|
|
# Install pkg-config file
|
|
|
|
mkdir -p $out/lib/pkgconfig
|
|
|
|
substituteAll ${./glm.pc.in} $out/lib/pkgconfig/glm.pc
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-09-18 10:52:07 +00:00
|
|
|
# Install docs
|
2020-04-24 23:36:52 +00:00
|
|
|
mkdir -p $doc/share/doc/glm
|
2021-09-18 10:52:07 +00:00
|
|
|
cp -rv ../doc/api $doc/share/doc/glm/html
|
|
|
|
cp -v ../doc/manual.pdf $doc/share/doc/glm
|
|
|
|
|
|
|
|
runHook postInstall
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "OpenGL Mathematics library for C++";
|
|
|
|
longDescription = ''
|
|
|
|
OpenGL Mathematics (GLM) is a header only C++ mathematics library for
|
|
|
|
graphics software based on the OpenGL Shading Language (GLSL)
|
|
|
|
specification and released under the MIT license.
|
|
|
|
'';
|
2021-09-18 10:52:07 +00:00
|
|
|
homepage = "https://github.com/g-truc/glm";
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.mit;
|
|
|
|
platforms = platforms.unix;
|
2021-09-18 10:52:07 +00:00
|
|
|
maintainers = with maintainers; [ smancill ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|