-
-
Notifications
You must be signed in to change notification settings - Fork 14.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #266099 from tmplt/feat/mujoco-3.0.0
mujoco: 2.3.7 -> 3.0.1, add Python bindings
- Loading branch information
Showing
8 changed files
with
957 additions
and
218 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,122 +1,184 @@ | ||
{ cmake | ||
{ cereal_1_3_2 | ||
, cmake | ||
, fetchFromGitHub | ||
, fetchFromGitLab | ||
, git | ||
, glfw | ||
, glm | ||
, lib | ||
, libGL | ||
, spdlog | ||
, stdenv | ||
, xorg | ||
}: | ||
|
||
let | ||
# See https://github.com/deepmind/mujoco/blob/c9246e1f5006379d599e0bcddf159a8616d31441/cmake/MujocoDependencies.cmake#L17-L55 | ||
abseil-cpp = fetchFromGitHub { | ||
owner = "abseil"; | ||
repo = "abseil-cpp"; | ||
rev = "c2435f8342c2d0ed8101cb43adfd605fdc52dca2"; | ||
hash = "sha256-PLoI7ix+reUqkZ947kWzls8lujYqWXk9A9a55UcfahI="; | ||
}; | ||
benchmark = fetchFromGitHub { | ||
owner = "google"; | ||
repo = "benchmark"; | ||
rev = "2dd015dfef425c866d9a43f2c67d8b52d709acb6"; | ||
hash = "sha256-pUW9YVaujs/y00/SiPqDgK4wvVsaM7QUp/65k0t7Yr0="; | ||
}; | ||
ccd = fetchFromGitHub { | ||
owner = "danfis"; | ||
repo = "libccd"; | ||
rev = "7931e764a19ef6b21b443376c699bbc9c6d4fba8"; | ||
hash = "sha256-TIZkmqQXa0+bSWpqffIgaBela0/INNsX9LPM026x1Wk="; | ||
}; | ||
eigen3 = fetchFromGitLab { | ||
owner = "libeigen"; | ||
repo = "eigen"; | ||
rev = "211c5dfc6741a5570ad007983c113ef4d144f9f3"; | ||
hash = "sha256-oT/h8QkL0vwaflh46Zsnu9Db1b65AP6p//nAga8M5jI="; | ||
}; | ||
googletest = fetchFromGitHub { | ||
owner = "google"; | ||
repo = "googletest"; | ||
rev = "b796f7d44681514f58a683a3a71ff17c94edb0c1"; | ||
hash = "sha256-LVLEn+e7c8013pwiLzJiiIObyrlbBHYaioO/SWbItPQ="; | ||
}; | ||
lodepng = fetchFromGitHub { | ||
owner = "lvandeve"; | ||
repo = "lodepng"; | ||
rev = "b4ed2cd7ecf61d29076169b49199371456d4f90b"; | ||
hash = "sha256-5cCkdj/izP4e99BKfs/Mnwu9aatYXjlyxzzYiMD/y1M="; | ||
}; | ||
qhull = fetchFromGitHub { | ||
owner = "qhull"; | ||
repo = "qhull"; | ||
rev = "0c8fc90d2037588024d9964515c1e684f6007ecc"; | ||
hash = "sha256-Ptzxad3ewmKJbbcmrBT+os4b4SR976zlCG9F0nq0x94="; | ||
}; | ||
tinyobjloader = fetchFromGitHub { | ||
owner = "tinyobjloader"; | ||
repo = "tinyobjloader"; | ||
rev = "1421a10d6ed9742f5b2c1766d22faa6cfbc56248"; | ||
hash = "sha256-9z2Ne/WPCiXkQpT8Cun/pSGUwgClYH+kQ6Dx1JvW6w0="; | ||
}; | ||
tinyxml2 = fetchFromGitHub { | ||
owner = "leethomason"; | ||
repo = "tinyxml2"; | ||
rev = "9a89766acc42ddfa9e7133c7d81a5bda108a0ade"; | ||
hash = "sha256-YGAe4+Ttv/xeou+9FoJjmQCKgzupTYdDhd+gzvtz/88="; | ||
}; | ||
pin = { | ||
|
||
# See https://github.com/google-deepmind/mujoco/blob/3.0.0/cmake/MujocoDependencies.cmake#L17-L64 | ||
abseil-cpp = fetchFromGitHub { | ||
owner = "abseil"; | ||
repo = "abseil-cpp"; | ||
rev = "fb3621f4f897824c0dbe0615fa94543df6192f30"; | ||
hash = "sha256-uNGrTNg5G5xFGtc+BSWE389x0tQ/KxJQLHfebNWas/k="; | ||
}; | ||
benchmark = fetchFromGitHub { | ||
owner = "google"; | ||
repo = "benchmark"; | ||
rev = "344117638c8ff7e239044fd0fa7085839fc03021"; | ||
hash = "sha256-gztnxui9Fe/FTieMjdvfJjWHjkImtlsHn6fM1FruyME="; | ||
}; | ||
ccd = fetchFromGitHub { | ||
owner = "danfis"; | ||
repo = "libccd"; | ||
rev = "7931e764a19ef6b21b443376c699bbc9c6d4fba8"; | ||
hash = "sha256-TIZkmqQXa0+bSWpqffIgaBela0/INNsX9LPM026x1Wk="; | ||
}; | ||
eigen3 = fetchFromGitLab { | ||
owner = "libeigen"; | ||
repo = "eigen"; | ||
rev = "e8515f78ac098329ab9f8cab21c87caede090a3f"; | ||
hash = "sha256-HXKtFJsKGpug+wNPjYynTuyaG0igo3oG4rFQktveh1g="; | ||
}; | ||
googletest = fetchFromGitHub { | ||
owner = "google"; | ||
repo = "googletest"; | ||
rev = "f8d7d77c06936315286eb55f8de22cd23c188571"; | ||
hash = "sha256-t0RchAHTJbuI5YW4uyBPykTvcjy90JW9AOPNjIhwh6U="; | ||
}; | ||
lodepng = fetchFromGitHub { | ||
owner = "lvandeve"; | ||
repo = "lodepng"; | ||
rev = "b4ed2cd7ecf61d29076169b49199371456d4f90b"; | ||
hash = "sha256-5cCkdj/izP4e99BKfs/Mnwu9aatYXjlyxzzYiMD/y1M="; | ||
}; | ||
qhull = fetchFromGitHub { | ||
owner = "qhull"; | ||
repo = "qhull"; | ||
rev = "0c8fc90d2037588024d9964515c1e684f6007ecc"; | ||
hash = "sha256-Ptzxad3ewmKJbbcmrBT+os4b4SR976zlCG9F0nq0x94="; | ||
}; | ||
tinyobjloader = fetchFromGitHub { | ||
owner = "tinyobjloader"; | ||
repo = "tinyobjloader"; | ||
rev = "1421a10d6ed9742f5b2c1766d22faa6cfbc56248"; | ||
hash = "sha256-9z2Ne/WPCiXkQpT8Cun/pSGUwgClYH+kQ6Dx1JvW6w0="; | ||
}; | ||
tinyxml2 = fetchFromGitHub { | ||
owner = "leethomason"; | ||
repo = "tinyxml2"; | ||
rev = "9a89766acc42ddfa9e7133c7d81a5bda108a0ade"; | ||
hash = "sha256-YGAe4+Ttv/xeou+9FoJjmQCKgzupTYdDhd+gzvtz/88="; | ||
}; | ||
marchingcubecpp = fetchFromGitHub { | ||
owner = "aparis69"; | ||
repo = "MarchingCubeCpp"; | ||
rev = "5b79e5d6bded086a0abe276a4b5a69fc17ae9bf1"; | ||
hash = "sha256-L0DH1GJZ/3vatQAU/KZj/2xTKE6Fwcw9eQYzLdqX2N4="; | ||
}; | ||
|
||
tmd = stdenv.mkDerivation rec { | ||
name = "TriangleMeshDistance"; | ||
|
||
src = fetchFromGitHub { | ||
owner = "InteractiveComputerGraphics"; | ||
repo = name; | ||
rev = "e55a15c20551f36242fd6368df099a99de71d43a"; | ||
hash = "sha256-vj6TMMT8mp7ciLa5nzVAhMWPcAHXq+ZwHlWsRA3uCmg="; | ||
}; | ||
|
||
installPhase = '' | ||
mkdir -p $out/include/tmd | ||
cp ${name}/include/tmd/${name}.h $out/include/tmd/ | ||
''; | ||
}; | ||
|
||
sdflib = stdenv.mkDerivation rec { | ||
name = "SdfLib"; | ||
|
||
src = fetchFromGitHub { | ||
owner = "UPC-ViRVIG"; | ||
repo = name; | ||
rev = "7c49cfba9bbec763b5d0f7b90b26555f3dde8088"; | ||
hash = "sha256-5bnQ3rHH9Pw1jRVpZpamFnhIJHWnGm6krgZgIBqNtVg="; | ||
}; | ||
|
||
patches = [ ./sdflib-system-deps.patch ]; | ||
|
||
cmakeFlags = [ | ||
"-DSDFLIB_USE_ASSIMP=OFF" | ||
"-DSDFLIB_USE_OPENMP=OFF" | ||
"-DSDFLIB_USE_ENOKI=OFF" | ||
"-DSDFLIB_USE_SYSTEM_GLM=ON" | ||
"-DSDFLIB_USE_SYSTEM_SPDLOG=ON" | ||
"-DSDFLIB_USE_SYSTEM_CEREAL=ON" | ||
"-DSDFLIB_USE_SYSTEM_TRIANGLEMESHDISTANCE=ON" | ||
]; | ||
|
||
nativeBuildInputs = [ cmake ]; | ||
buildInputs = [ | ||
pin.tmd | ||
|
||
# Mainline. The otherwise pinned glm realease from 2018 does | ||
# not build due to test failures and missing files. | ||
glm | ||
|
||
spdlog | ||
cereal_1_3_2 | ||
]; | ||
}; | ||
|
||
# See https://github.com/deepmind/mujoco/blob/c9246e1f5006379d599e0bcddf159a8616d31441/simulate/cmake/SimulateDependencies.cmake#L32-L35 | ||
glfw3 = fetchFromGitHub { | ||
owner = "glfw"; | ||
repo = "glfw"; | ||
rev = "7482de6071d21db77a7236155da44c172a7f6c9e"; | ||
hash = "sha256-4+H0IXjAwbL5mAWfsIVhW0BSJhcWjkQx4j2TrzZ3aIo="; | ||
}; | ||
in | ||
stdenv.mkDerivation rec { | ||
|
||
in stdenv.mkDerivation rec { | ||
pname = "mujoco"; | ||
version = "2.3.7"; | ||
version = "3.0.1"; | ||
|
||
src = fetchFromGitHub { | ||
owner = "deepmind"; | ||
owner = "google-deepmind"; | ||
repo = pname; | ||
rev = version; | ||
hash = "sha256-LgpA+iPGqciHuWBSD6/7yvZ7p+vo48ZYKjjrDZSnAwE="; | ||
hash = "sha256-UXE+7KDti8RarpoJoo9Ei3TgW/Qdnj3ASRo8uTWhGrU="; | ||
}; | ||
|
||
patches = [ ./dependencies.patch ]; | ||
patches = [ ./mujoco-system-deps-dont-fetch.patch ]; | ||
|
||
nativeBuildInputs = [ cmake git ]; | ||
nativeBuildInputs = [ cmake ]; | ||
|
||
buildInputs = [ | ||
libGL | ||
xorg.libX11 | ||
xorg.libXcursor | ||
xorg.libXext | ||
xorg.libXi | ||
xorg.libXinerama | ||
xorg.libXrandr | ||
pin.sdflib | ||
glm | ||
|
||
# non-numerical | ||
spdlog | ||
cereal_1_3_2 | ||
glfw | ||
]; | ||
|
||
cmakeFlags = [ | ||
"-DMUJOCO_USE_SYSTEM_sdflib=ON" | ||
"-DMUJOCO_SIMULATE_USE_SYSTEM_GLFW=ON" | ||
"-DMUJOCO_SAMPLES_USE_SYSTEM_GLFW=ON" | ||
]; | ||
|
||
# Move things into place so that cmake doesn't try downloading dependencies. | ||
preConfigure = '' | ||
mkdir -p build/_deps | ||
ln -s ${abseil-cpp} build/_deps/abseil-cpp-src | ||
ln -s ${benchmark} build/_deps/benchmark-src | ||
ln -s ${ccd} build/_deps/ccd-src | ||
ln -s ${eigen3} build/_deps/eigen3-src | ||
ln -s ${glfw3} build/_deps/glfw3-src | ||
ln -s ${googletest} build/_deps/googletest-src | ||
ln -s ${lodepng} build/_deps/lodepng-src | ||
ln -s ${qhull} build/_deps/qhull-src | ||
ln -s ${tinyobjloader} build/_deps/tinyobjloader-src | ||
ln -s ${tinyxml2} build/_deps/tinyxml2-src | ||
ln -s ${pin.abseil-cpp} build/_deps/abseil-cpp-src | ||
ln -s ${pin.benchmark} build/_deps/benchmark-src | ||
ln -s ${pin.ccd} build/_deps/ccd-src | ||
ln -s ${pin.eigen3} build/_deps/eigen3-src | ||
ln -s ${pin.googletest} build/_deps/googletest-src | ||
ln -s ${pin.lodepng} build/_deps/lodepng-src | ||
ln -s ${pin.qhull} build/_deps/qhull-src | ||
ln -s ${pin.tinyobjloader} build/_deps/tinyobjloader-src | ||
ln -s ${pin.tinyxml2} build/_deps/tinyxml2-src | ||
ln -s ${pin.marchingcubecpp} build/_deps/marchingcubecpp-src | ||
''; | ||
|
||
passthru.pin = { inherit (pin) lodepng eigen3 abseil-cpp; }; | ||
|
||
meta = with lib; { | ||
description = "Multi-Joint dynamics with Contact. A general purpose physics simulator."; | ||
homepage = "https://mujoco.org/"; | ||
license = licenses.asl20; | ||
maintainers = with maintainers; [ samuela ]; | ||
maintainers = with maintainers; [ samuela tmplt ]; | ||
}; | ||
} |
114 changes: 0 additions & 114 deletions
114
pkgs/applications/science/robotics/mujoco/dependencies.patch
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.