Skip to content

Commit

Permalink
Update mujoco and blender in Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
HoangGiang93 committed Aug 19, 2024
1 parent 95eab65 commit 8fa0348
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 22 deletions.
60 changes: 42 additions & 18 deletions build_third_parties.bat
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,30 @@ set "INCLUDE_DIR=%MULTIVERSE_DIR%\include"

set "BLENDER_BUILD_DIR=%BUILD_DIR%\blender"
set "BLENDER_EXT_DIR=%EXT_DIR%\blender-git"
set "BLENDER_FILE_NAME=blender-4.2.0-windows-x64"
set "BLENDER_ZIP_FILE=%BLENDER_FILE_NAME%.zip"

set "FROM_SRC=0"
if not exist "%BLENDER_BUILD_DIR%" (
git submodule update --init "%BLENDER_EXT_DIR%/blender"

@REM Create the folder if it doesn't exist
mkdir "%BLENDER_BUILD_DIR%"
echo "Folder created: %BLENDER_BUILD_DIR%"

powershell -Command "[Environment]::SetEnvironmentVariable('Path', [Environment]::GetEnvironmentVariable('Path', 'User') + ';%BLENDER_BUILD_DIR%\bin\Release', [EnvironmentVariableTarget]::User)"
powershell -NoProfile -Command "cd '%BLENDER_EXT_DIR%\blender'; .\make update"
powershell -NoProfile -Command "cd '%BLENDER_EXT_DIR%\blender'; cmake -S . -B '..\..\..\build\blender'; cmake --build '..\..\..\build\blender' --target INSTALL --config Release"
powershell -NoProfile -Command "cd '%BLENDER_EXT_DIR%\blender\lib\windows_x64\python\311\bin'; .\python.exe -m pip install --upgrade pip build --no-warn-script-location; .\python.exe -m pip install bpy --no-warn-script-location"
@REM Check if FROM_SRC is set to 1
if "%FROM_SRC%"=="1" (
git submodule update --init "%BLENDER_EXT_DIR%/blender"

@REM Create the folder if it doesn't exist
mkdir "%BLENDER_BUILD_DIR%"
echo "Folder created: %BLENDER_BUILD_DIR%"

powershell -Command "[Environment]::SetEnvironmentVariable('Path', [Environment]::GetEnvironmentVariable('Path', 'User') + ';%BLENDER_BUILD_DIR%\bin\Release', [EnvironmentVariableTarget]::User)"
powershell -NoProfile -Command "cd '%BLENDER_EXT_DIR%\blender'; .\make update"
powershell -NoProfile -Command "cd '%BLENDER_EXT_DIR%\blender'; cmake -S . -B '..\..\..\build\blender'; cmake --build '..\..\..\build\blender' --target INSTALL --config Release"
powershell -NoProfile -Command "cd '%BLENDER_EXT_DIR%\blender\lib\windows_x64\python\311\bin'; .\python.exe -m pip install --upgrade pip build --no-warn-script-location; .\python.exe -m pip install bpy --no-warn-script-location"
) else (
powershell -Command "[Environment]::SetEnvironmentVariable('Path', [Environment]::GetEnvironmentVariable('Path', 'User') + ';%BLENDER_BUILD_DIR%', [EnvironmentVariableTarget]::User)"
powershell -NoProfile -Command "curl -o '%EXT_DIR%\%BLENDER_ZIP_FILE%' 'https://download.blender.org/release/Blender4.2/%BLENDER_ZIP_FILE%'"
powershell -NoProfile -Command "7z x '%EXT_DIR%\%BLENDER_ZIP_FILE%' -o'%BUILD_DIR%'"
powershell -NoProfile -Command "move '%BUILD_DIR%\%BLENDER_FILE_NAME%' '%BLENDER_BUILD_DIR%'"
powershell -NoProfile -Command "cd '%BLENDER_BUILD_DIR%\4.2\python\bin'; .\python.exe -m pip install --upgrade pip build --no-warn-script-location; .\python.exe -m pip install bpy --no-warn-script-location"
)
) else (
echo "Folder already exists: %BLENDER_BUILD_DIR%"
)
Expand All @@ -52,15 +64,27 @@ pause

set "MUJOCO_BUILD_DIR=%BUILD_DIR%\mujoco"
set "MUJOCO_EXT_DIR=%EXT_DIR%\mujoco"
if not exist "%MUJOCO_BUILD_DIR%" (
git submodule update --init "%MUJOCO_EXT_DIR%"
set "MUJOCO_FILE_NAME=mujoco-3.2.2-windows-x86_64"
set "MUJOCO_ZIP_FILE=%MUJOCO_FILE_NAME%.zip"

@REM Create the folder if it doesn't exist
mkdir "%MUJOCO_BUILD_DIR%"
echo "Folder created: %MUJOCO_BUILD_DIR%"

powershell -Command "[Environment]::SetEnvironmentVariable('Path', [Environment]::GetEnvironmentVariable('Path', 'User') + ';%MUJOCO_BUILD_DIR%\bin', [EnvironmentVariableTarget]::User)"
powershell -NoProfile -Command "cd %MUJOCO_BUILD_DIR%; cmake %MUJOCO_EXT_DIR% -DCMAKE_INSTALL_PREFIX=%MUJOCO_BUILD_DIR% -Wno-deprecated -Wno-dev; cmake --build . --config Release; cmake --install ."
set "FROM_SRC=0"
if not exist "%MUJOCO_BUILD_DIR%" (
@REM Check if FROM_SRC is set to 1
if "%FROM_SRC%"=="1" (

git submodule update --init "%MUJOCO_EXT_DIR%"

@REM Create the folder if it doesn't exist
mkdir "%MUJOCO_BUILD_DIR%"
echo "Folder created: %MUJOCO_BUILD_DIR%"

powershell -Command "[Environment]::SetEnvironmentVariable('Path', [Environment]::GetEnvironmentVariable('Path', 'User') + ';%MUJOCO_BUILD_DIR%\bin', [EnvironmentVariableTarget]::User)"
powershell -NoProfile -Command "cd %MUJOCO_BUILD_DIR%; cmake %MUJOCO_EXT_DIR% -DCMAKE_INSTALL_PREFIX=%MUJOCO_BUILD_DIR% -Wno-deprecated -Wno-dev; cmake --build . --config Release; cmake --install ."
) else (
powershell -Command "[Environment]::SetEnvironmentVariable('Path', [Environment]::GetEnvironmentVariable('Path', 'User') + ';%MUJOCO_BUILD_DIR%\bin', [EnvironmentVariableTarget]::User)"
powershell -NoProfile -Command "curl -o '%EXT_DIR%\%MUJOCO_ZIP_FILE%' 'https://github.com/google-deepmind/mujoco/releases/download/3.2.2/%MUJOCO_ZIP_FILE%'"
powershell -NoProfile -Command "7z x '%EXT_DIR%\%MUJOCO_ZIP_FILE%' -o'%MUJOCO_BUILD_DIR%'"
)
) else (
echo "Folder already exists: %MUJOCO_BUILD_DIR%"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ elseif(WIN32)
multiverse_client_json
Threads::Threads
jsoncpp
tinyxml2
boost_filesystem-mt
mujoco::mujoco
${MUJOCO_SOURCE_DIR}/lib/mujoco.lib
tinyxml2
)
endif()

Expand Down Expand Up @@ -80,9 +80,9 @@ elseif(WIN32)
opengl32
Threads::Threads
jsoncpp
tinyxml2
boost_filesystem-mt
mujoco::mujoco
${MUJOCO_SOURCE_DIR}/lib/mujoco.lib
tinyxml2
)
endif()

Expand Down

0 comments on commit 8fa0348

Please sign in to comment.