File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -7,8 +7,22 @@ if (NOT MuJoCo_FOUND)
77 return ()
88 endif ()
99
10- # Check if the include directory exists
11- cmake_path (APPEND Python3_SITELIB mujoco include OUTPUT_VARIABLE MuJoCo_INCLUDE_DIRS )
10+ # Get MuJoCo path from python
11+ execute_process (
12+ COMMAND ${Python3_EXECUTABLE} -c "import mujoco; print(mujoco.__path__[0])"
13+ OUTPUT_VARIABLE MUJOCO_PATH
14+ OUTPUT_STRIP_TRAILING_WHITESPACE
15+ )
16+
17+ if (NOT MUJOCO_PATH)
18+ set (MuJoCo_FOUND FALSE )
19+ if (MuJoCo_FIND_REQUIRED)
20+ message (FATAL_ERROR "Could not find MuJoCo. Please install MuJoCo using pip." )
21+ endif ()
22+ return ()
23+ endif ()
24+
25+ set (MuJoCo_INCLUDE_DIRS "${MUJOCO_PATH} /include" )
1226 if (NOT EXISTS ${MuJoCo_INCLUDE_DIRS} )
1327 set (MuJoCo_FOUND FALSE )
1428 if (MuJoCo_FIND_REQUIRED)
@@ -17,9 +31,7 @@ if (NOT MuJoCo_FOUND)
1731 return ()
1832 endif ()
1933
20- # Check if the library file exists
21- cmake_path (APPEND Python3_SITELIB mujoco OUTPUT_VARIABLE mujoco_library_path )
22- file (GLOB mujoco_library_path "${mujoco_library_path} /libmujoco.so.*" )
34+ file (GLOB mujoco_library_path "${MUJOCO_PATH} /libmujoco.so.*" )
2335 if (NOT mujoco_library_path)
2436 set (MuJoCo_FOUND FALSE )
2537 if (MuJoCo_FIND_REQUIRED)
You can’t perform that action at this time.
0 commit comments