summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/mujoco/package.py
blob: 26ed5d4ae57d3ba442333c2455ede454580a5e23 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)

import platform

from spack.package import *


class Mujoco(Package):
    """MuJoCo is a physics engine that aims to facilitate research and
    development in robotics, biomechanics, graphics and animation, and
    other areas where fast and accurate simulation is needed."""

    homepage = "https://mujoco.org/"

    mujoco_releases = {
        "2.1.0": {
            "Linux-x86_64": "a436ca2f4144c38b837205635bbd60ffe1162d5b44c87df22232795978d7d012",
            "Darwin-x86_64": "50226f859d9d3742fa57e1a0a92d656197ec5786f75bfa50ae00eb80fae25e90",
        }
    }

    for ver, packages in mujoco_releases.items():
        key = "{0}-{1}".format(platform.system(), platform.machine())
        pkg_sha256 = packages.get(key)
        if pkg_sha256:
            version(ver, sha256=pkg_sha256)

    def url_for_version(self, version):
        url = "https://mujoco.org/download/mujoco{0}-{1}-x86_64.tar.gz"

        system_map = {"Linux": "linux", "Darwin": "macos"}

        return url.format(version.joined, system_map[platform.system()])

    def install(self, spec, prefix):
        copy_tree(".", prefix)

    def setup_run_environment(self, env):
        env.prepend_path("CPATH", prefix.include)
        env.prepend_path("LD_LIBRARY_PATH", prefix.bin)
        if platform.system() == "Darwin":
            env.prepend_path("DYLD_LIBRARY_PATH", prefix.bin)