From 28bea62d785d1351061220d08a665a81449d24f8 Mon Sep 17 00:00:00 2001 From: Michael Moss Date: Fri, 24 Jul 2026 08:20:54 -0700 Subject: [PATCH] Fix `git apply` and re-enable cmake cache on Windows. This forces git to treat the current directory as the git checkout to apply the patch to, which avoids issues where a non-git checkout (e.g. from an unpacked cached tarball) can cause git to find a higher-level git checkout and try to apply the patches there, which then fails when the files to patch aren't found. PiperOrigin-RevId: 953377327 Change-Id: I86f51d4e2823b64c825070139479089c7f30e53e --- cmake/MujocoDependencies.cmake | 6 +++--- cmake/third_party_deps/filament.cmake | 2 +- cmake/third_party_deps/libwebp.cmake | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cmake/MujocoDependencies.cmake b/cmake/MujocoDependencies.cmake index 3dda8823..c3cdebe6 100644 --- a/cmake/MujocoDependencies.cmake +++ b/cmake/MujocoDependencies.cmake @@ -129,7 +129,7 @@ endif() set(QHULL_ENABLE_TESTING OFF) # Patch changes in https://github.com/qhull/qhull/pull/173.patch set(QHULL_PATCH_COMMAND - git -c core.autocrlf=false -c core.whitespace=cr-at-eol apply --verbose --whitespace=fix --ignore-space-change ${mujoco_SOURCE_DIR}/cmake/qhull-support-emscripten.patch + git --git-dir=. -c core.autocrlf=false -c core.whitespace=cr-at-eol apply --verbose --whitespace=fix --ignore-space-change ${mujoco_SOURCE_DIR}/cmake/qhull-support-emscripten.patch ) findorfetch( @@ -210,7 +210,7 @@ set(CCD_HIDE_ALL_SYMBOLS ON) # Patch changes in https://github.com/danfis/libccd/pull/83.patch set(CCD_PATCH_COMMAND - git -c core.autocrlf=false -c core.whitespace=cr-at-eol apply --verbose --whitespace=fix --ignore-space-change ${mujoco_SOURCE_DIR}/cmake/ccd-support-emscripten.patch + git --git-dir=. -c core.autocrlf=false -c core.whitespace=cr-at-eol apply --verbose --whitespace=fix --ignore-space-change ${mujoco_SOURCE_DIR}/cmake/ccd-support-emscripten.patch ) # update cmake_minimum_required version for compatibility with newer version of cmake @@ -284,7 +284,7 @@ if(MUJOCO_BUILD_TESTS OR MUJOCO_BUILD_STUDIO OR MUJOCO_USE_FILAMENT) ) set(ABSL_PATCH_COMMAND - git -c core.autocrlf=false -c core.whitespace=cr-at-eol apply --verbose --whitespace=fix --ignore-space-change ${mujoco_SOURCE_DIR}/cmake/abseil-cpp-source_location.patch + git --git-dir=. -c core.autocrlf=false -c core.whitespace=cr-at-eol apply --verbose --whitespace=fix --ignore-space-change ${mujoco_SOURCE_DIR}/cmake/abseil-cpp-source_location.patch ) set(ABSL_BUILD_TESTING OFF) findorfetch( diff --git a/cmake/third_party_deps/filament.cmake b/cmake/third_party_deps/filament.cmake index 97cbc07a..de0576a9 100644 --- a/cmake/third_party_deps/filament.cmake +++ b/cmake/third_party_deps/filament.cmake @@ -48,7 +48,7 @@ if(WIN32) endif() set(FILAMENT_PATCH_COMMAND - git -c core.autocrlf=false -c core.whitespace=cr-at-eol apply --verbose --whitespace=fix --ignore-space-change ${mujoco_SOURCE_DIR}/cmake/filament-allow-clang-windows.patch + git --git-dir=. -c core.autocrlf=false -c core.whitespace=cr-at-eol apply --verbose --whitespace=fix --ignore-space-change ${mujoco_SOURCE_DIR}/cmake/filament-allow-clang-windows.patch ) fetchpackage( diff --git a/cmake/third_party_deps/libwebp.cmake b/cmake/third_party_deps/libwebp.cmake index 1a59a409..2fa28f0b 100644 --- a/cmake/third_party_deps/libwebp.cmake +++ b/cmake/third_party_deps/libwebp.cmake @@ -21,7 +21,7 @@ mark_as_advanced(MUJOCO_DEP_VERSION_libwebp) include(FindOrFetch) set(LIBWEBP_PATCH_COMMAND - git -c core.autocrlf=false -c core.whitespace=cr-at-eol apply --verbose --whitespace=fix --ignore-space-change ${mujoco_SOURCE_DIR}/cmake/libwebp-apple-float16.patch + git --git-dir=. -c core.autocrlf=false -c core.whitespace=cr-at-eol apply --verbose --whitespace=fix --ignore-space-change ${mujoco_SOURCE_DIR}/cmake/libwebp-apple-float16.patch ) set(BUILD_SHARED_LIBS_OLD ${BUILD_SHARED_LIBS})