Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / development / libraries / bullet / default.nix
blob2dc3266291d3673f285069458c5f9a4d6bb10684
1 { lib
2 , stdenv
3 , fetchFromGitHub
4 , cmake
5 , libGLU
6 , libGL
7 , freeglut
8 , Cocoa
9 , OpenGL
12 stdenv.mkDerivation rec {
13   pname = "bullet";
14   version = "3.25";
16   src = fetchFromGitHub {
17     owner = "bulletphysics";
18     repo = "bullet3";
19     rev = version;
20     sha256 = "sha256-AGP05GoxLjHqlnW63/KkZe+TjO3IKcgBi+Qb/osQuCM=";
21   };
23   nativeBuildInputs = [ cmake ];
24   buildInputs = lib.optionals stdenv.isLinux [ libGLU libGL freeglut ]
25     ++ lib.optionals stdenv.isDarwin [ Cocoa OpenGL ];
27   postPatch = ''
28     substituteInPlace examples/ThirdPartyLibs/Gwen/CMakeLists.txt \
29       --replace "-DGLEW_STATIC" "-DGLEW_STATIC -Wno-narrowing"
30   '' + lib.optionalString stdenv.isDarwin ''
31     sed -i 's/FIND_PACKAGE(OpenGL)//' CMakeLists.txt
32     sed -i 's/FIND_LIBRARY(COCOA_LIBRARY Cocoa)//' CMakeLists.txt
33   '';
35   cmakeFlags = [
36     "-DBUILD_SHARED_LIBS=ON"
37     "-DBUILD_CPU_DEMOS=OFF"
38     "-DINSTALL_EXTRA_LIBS=ON"
39   ] ++ lib.optionals stdenv.isDarwin [
40     "-DOPENGL_FOUND=true"
41     "-DOPENGL_LIBRARIES=${OpenGL}/Library/Frameworks/OpenGL.framework"
42     "-DOPENGL_INCLUDE_DIR=${OpenGL}/Library/Frameworks/OpenGL.framework"
43     "-DOPENGL_gl_LIBRARY=${OpenGL}/Library/Frameworks/OpenGL.framework"
44     "-DCOCOA_LIBRARY=${Cocoa}/Library/Frameworks/Cocoa.framework"
45     "-DBUILD_BULLET2_DEMOS=OFF"
46     "-DBUILD_UNIT_TESTS=OFF"
47     "-DBUILD_BULLET_ROBOTICS_GUI_EXTRA=OFF"
48   ];
50   env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isClang
51     "-Wno-error=argument-outside-range -Wno-error=c++11-narrowing";
53   meta = with lib; {
54     description = "A professional free 3D Game Multiphysics Library";
55     longDescription = ''
56       Bullet 3D Game Multiphysics Library provides state of the art collision
57       detection, soft body and rigid body dynamics.
58     '';
59     homepage = "http://bulletphysics.org";
60     license = licenses.zlib;
61     maintainers = with maintainers; [ aforemny ];
62     platforms = platforms.unix;
63   };