2021-12-06 16:07:01 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, cmake
|
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2024-07-27 06:49:29 +00:00
|
|
|
version = "1.0.1";
|
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;
|
2024-07-27 06:49:29 +00:00
|
|
|
sha256 = "sha256-GnGyzNRpzuguc3yYbEFtYLvG+KiCtRAktiN+NvbOICE=";
|
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 ];
|
|
|
|
|
2024-07-27 06:49:29 +00:00
|
|
|
env.NIX_CFLAGS_COMPILE =
|
|
|
|
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102823
|
|
|
|
if (stdenv.cc.isGNU && lib.versionAtLeast stdenv.cc.version "11") then "-fno-ipa-modref"
|
|
|
|
# Fix compilation errors on darwin
|
|
|
|
else if (stdenv.cc.isClang) then "-Wno-error"
|
|
|
|
else "";
|
2022-04-27 09:35:20 +00:00
|
|
|
|
2021-09-18 10:52:07 +00:00
|
|
|
cmakeFlags = [
|
2024-07-27 06:49:29 +00:00
|
|
|
(lib.cmakeBool "BUILD_SHARED_LIBS" false)
|
|
|
|
(lib.cmakeBool "BUILD_STATIC_LIBS" false)
|
|
|
|
(lib.cmakeBool "GLM_TEST_ENABLE" doCheck)
|
2021-09-18 10:52:07 +00:00
|
|
|
];
|
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
|
|
|
|
2024-07-27 06:49:29 +00:00
|
|
|
postInstall = ''
|
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
|
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
|
|
|
};
|
|
|
|
}
|
|
|
|
|