diff options
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/bullet')
3 files changed, 144 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/libraries/bullet/default.nix b/nixpkgs/pkgs/development/libraries/bullet/default.nix new file mode 100644 index 000000000000..5203e941b3d0 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/bullet/default.nix @@ -0,0 +1,64 @@ +{ lib +, stdenv +, fetchFromGitHub +, cmake +, libGLU +, libGL +, freeglut +, Cocoa +, OpenGL +}: + +stdenv.mkDerivation rec { + pname = "bullet"; + version = "3.24"; + + src = fetchFromGitHub { + owner = "bulletphysics"; + repo = "bullet3"; + rev = version; + sha256 = "sha256-1zQZI1MdW0Ipg5XJeiFZQi/6cI0t6Ckralc5DE3auow="; + }; + + nativeBuildInputs = [ cmake ]; + buildInputs = lib.optionals stdenv.isLinux [ libGLU libGL freeglut ] + ++ lib.optionals stdenv.isDarwin [ Cocoa OpenGL ]; + + postPatch = '' + substituteInPlace examples/ThirdPartyLibs/Gwen/CMakeLists.txt \ + --replace "-DGLEW_STATIC" "-DGLEW_STATIC -Wno-narrowing" + '' + lib.optionalString stdenv.isDarwin '' + sed -i 's/FIND_PACKAGE(OpenGL)//' CMakeLists.txt + sed -i 's/FIND_LIBRARY(COCOA_LIBRARY Cocoa)//' CMakeLists.txt + ''; + + cmakeFlags = [ + "-DBUILD_SHARED_LIBS=ON" + "-DBUILD_CPU_DEMOS=OFF" + "-DINSTALL_EXTRA_LIBS=ON" + ] ++ lib.optionals stdenv.isDarwin [ + "-DOPENGL_FOUND=true" + "-DOPENGL_LIBRARIES=${OpenGL}/Library/Frameworks/OpenGL.framework" + "-DOPENGL_INCLUDE_DIR=${OpenGL}/Library/Frameworks/OpenGL.framework" + "-DOPENGL_gl_LIBRARY=${OpenGL}/Library/Frameworks/OpenGL.framework" + "-DCOCOA_LIBRARY=${Cocoa}/Library/Frameworks/Cocoa.framework" + "-DBUILD_BULLET2_DEMOS=OFF" + "-DBUILD_UNIT_TESTS=OFF" + "-DBUILD_BULLET_ROBOTICS_GUI_EXTRA=OFF" + ]; + + NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isClang + "-Wno-error=argument-outside-range -Wno-error=c++11-narrowing"; + + meta = with lib; { + description = "A professional free 3D Game Multiphysics Library"; + longDescription = '' + Bullet 3D Game Multiphysics Library provides state of the art collision + detection, soft body and rigid body dynamics. + ''; + homepage = "http://bulletphysics.org"; + license = licenses.zlib; + maintainers = with maintainers; [ aforemny ]; + platforms = platforms.unix; + }; +} diff --git a/nixpkgs/pkgs/development/libraries/bullet/gwen-narrowing.patch b/nixpkgs/pkgs/development/libraries/bullet/gwen-narrowing.patch new file mode 100644 index 000000000000..c6c06325dae0 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/bullet/gwen-narrowing.patch @@ -0,0 +1,22 @@ +commit a5d3497577c78b03c05c69d17df972fa9fb54f53 +Author: Linus Heckemann <git@sphalerite.org> +Date: Fri Jan 5 23:57:09 2018 +0100 + + Add -Wno-narrowing to GWEN's CMakeLists + + This avoids the compilation issue that occurs on aarch64 with gcc6. + (nixpkgs-specific patch) + +diff --git a/examples/ThirdPartyLibs/Gwen/CMakeLists.txt b/examples/ThirdPartyLibs/Gwen/CMakeLists.txt +index 82fa0ffba..26c4bbd37 100644 +--- a/examples/ThirdPartyLibs/Gwen/CMakeLists.txt ++++ b/examples/ThirdPartyLibs/Gwen/CMakeLists.txt +@@ -15,7 +15,7 @@ IF(NOT WIN32 AND NOT APPLE) + ADD_DEFINITIONS("-DDYNAMIC_LOAD_X11_FUNCTIONS=1") + ENDIF() + +-ADD_DEFINITIONS( -DGLEW_STATIC -DGWEN_COMPILE_STATIC -D_HAS_EXCEPTIONS=0 -D_STATIC_CPPLIB ) ++ADD_DEFINITIONS( -DGLEW_STATIC -DGWEN_COMPILE_STATIC -D_HAS_EXCEPTIONS=0 -D_STATIC_CPPLIB -Wno-narrowing ) + + FILE(GLOB gwen_SRCS "*.cpp" "Controls/*.cpp" "Controls/Dialog/*.cpp" "Controls/Dialogs/*.cpp" "Controls/Layout/*.cpp" "Controls/Property/*.cpp" "Input/*.cpp" "Platforms/*.cpp" "Renderers/*.cpp" "Skins/*.cpp") + FILE(GLOB gwen_HDRS "*.h" "Controls/*.h" "Controls/Dialog/*.h" "Controls/Dialogs/*.h" "Controls/Layout/*.h" "Controls/Property/*.h" "Input/*.h" "Platforms/*.h" "Renderers/*.h" "Skins/*.h") diff --git a/nixpkgs/pkgs/development/libraries/bullet/roboschool-fork.nix b/nixpkgs/pkgs/development/libraries/bullet/roboschool-fork.nix new file mode 100644 index 000000000000..ac8433fc77ac --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/bullet/roboschool-fork.nix @@ -0,0 +1,58 @@ +{ lib, stdenv, fetchFromGitHub, cmake, libGLU, libGL, freeglut +, Cocoa, OpenGL +}: + +stdenv.mkDerivation { + pname = "bullet"; + version = "2019-03-27"; + + src = fetchFromGitHub { + owner = "olegklimov"; + repo = "bullet3"; + # 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 = "3687507ddc04a15de2c5db1e349ada3f2b34b3d6"; + sha256 = "1wd7vj9136dl7lfb8ll0rc2fdl723y3ls9ipp7657yfl2xrqhvkb"; + }; + + nativeBuildInputs = [ cmake ]; + buildInputs = lib.optionals stdenv.isLinux [ libGLU libGL freeglut ] + ++ lib.optionals stdenv.isDarwin [ Cocoa OpenGL ]; + + patches = [ ./gwen-narrowing.patch ]; + + postPatch = lib.optionalString stdenv.isDarwin '' + sed -i 's/FIND_PACKAGE(OpenGL)//' CMakeLists.txt + sed -i 's/FIND_LIBRARY(COCOA_LIBRARY Cocoa)//' CMakeLists.txt + ''; + + cmakeFlags = [ + "-DBUILD_SHARED_LIBS=ON" + "-DBUILD_CPU_DEMOS=OFF" + "-DINSTALL_EXTRA_LIBS=ON" + ] ++ lib.optionals stdenv.isDarwin [ + "-DOPENGL_FOUND=true" + "-DOPENGL_LIBRARIES=${OpenGL}/Library/Frameworks/OpenGL.framework" + "-DOPENGL_INCLUDE_DIR=${OpenGL}/Library/Frameworks/OpenGL.framework" + "-DOPENGL_gl_LIBRARY=${OpenGL}/Library/Frameworks/OpenGL.framework" + "-DCOCOA_LIBRARY=${Cocoa}/Library/Frameworks/Cocoa.framework" + "-DBUILD_BULLET2_DEMOS=OFF" + "-DBUILD_UNIT_TESTS=OFF" + ]; + + meta = with lib; { + description = "A professional free 3D Game Multiphysics Library"; + longDescription = '' + Bullet 3D Game Multiphysics Library provides state of the art collision + detection, soft body and rigid body dynamics. + ''; + homepage = "http://bulletphysics.org"; + license = licenses.zlib; + platforms = platforms.unix; + # /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); + }; +} |