2021-02-05 17:12:51 +00:00
{ lib , stdenv , fetchFromGitHub , cmake , libGLU , libGL , freeglut
2020-04-24 23:36:52 +00:00
, Cocoa , OpenGL
} :
stdenv . mkDerivation {
pname = " b u l l e t " ;
version = " 2 0 1 9 - 0 3 - 2 7 " ;
src = fetchFromGitHub {
owner = " o l e g k l i m o v " ;
repo = " b u l l e t 3 " ;
# roboschool needs the HEAD of a specific branch of this fork, see
# https://github.com/openai/roboschool/issues/126#issuecomment-421643980
# https://github.com/openai/roboschool/pull/62
# https://github.com/openai/roboschool/issues/124
rev = " 3 6 8 7 5 0 7 d d c 0 4 a 1 5 d e 2 c 5 d b 1 e 3 4 9 a d a 3 f 2 b 3 4 b 3 d 6 " ;
sha256 = " 1 w d 7 v j 9 1 3 6 d l 7 l f b 8 l l 0 r c 2 f d l 7 2 3 y 3 l s 9 i p p 7 6 5 7 y f l 2 x r q h v k b " ;
} ;
nativeBuildInputs = [ cmake ] ;
2021-02-05 17:12:51 +00:00
buildInputs = lib . optionals stdenv . isLinux [ libGLU libGL freeglut ]
++ lib . optionals stdenv . isDarwin [ Cocoa OpenGL ] ;
2020-04-24 23:36:52 +00:00
patches = [ ./gwen-narrowing.patch ] ;
2021-02-05 17:12:51 +00:00
postPatch = lib . optionalString stdenv . isDarwin ''
2020-04-24 23:36:52 +00:00
sed - i ' s/FIND_PACKAGE ( OpenGL ) // ' CMakeLists . txt
sed - i ' s/FIND_LIBRARY ( COCOA_LIBRARY Cocoa ) // ' CMakeLists . txt
'' ;
cmakeFlags = [
" - D B U I L D _ S H A R E D _ L I B S = O N "
" - D B U I L D _ C P U _ D E M O S = O F F "
" - D I N S T A L L _ E X T R A _ L I B S = O N "
2021-02-05 17:12:51 +00:00
] ++ lib . optionals stdenv . isDarwin [
2020-04-24 23:36:52 +00:00
" - D O P E N G L _ F O U N D = t r u e "
" - D O P E N G L _ L I B R A R I E S = ${ OpenGL } / L i b r a r y / F r a m e w o r k s / O p e n G L . f r a m e w o r k "
" - D O P E N G L _ I N C L U D E _ D I R = ${ OpenGL } / L i b r a r y / F r a m e w o r k s / O p e n G L . f r a m e w o r k "
" - D O P E N G L _ g l _ L I B R A R Y = ${ OpenGL } / L i b r a r y / F r a m e w o r k s / O p e n G L . f r a m e w o r k "
" - D C O C O A _ L I B R A R Y = ${ Cocoa } / L i b r a r y / F r a m e w o r k s / C o c o a . f r a m e w o r k "
" - D B U I L D _ B U L L E T 2 _ D E M O S = O F F "
" - D B U I L D _ U N I T _ T E S T S = O F F "
] ;
2021-02-05 17:12:51 +00:00
meta = with lib ; {
2024-06-20 14:57:18 +00:00
description = " P r o f e s s i o n a l f r e e 3 D G a m e M u l t i p h y s i c s L i b r a r y " ;
2020-04-24 23:36:52 +00:00
longDescription = ''
Bullet 3 D Game Multiphysics Library provides state of the art collision
detection , soft body and rigid body dynamics .
'' ;
homepage = " h t t p : / / b u l l e t p h y s i c s . o r g " ;
license = licenses . zlib ;
platforms = platforms . unix ;
2022-06-16 17:23:12 +00:00
# /tmp/nix-build-bullet-2019-03-27.drv-0/source/src/Bullet3Common/b3Vector3.h:297:7: error: argument value 10880 is outside the valid range [0, 255] [-Wargument-outside-range]
# y = b3_splat_ps(y, 0x80);
broken = ( stdenv . isDarwin && stdenv . isx86_64 ) ;
2020-04-24 23:36:52 +00:00
} ;
}