init commit

This commit is contained in:
cantyonion committed 2026-11-24 12:43:25 +08:00
commit 1497f114e6
47 files changed
+8358

No files matched your search

+23
View File
@@ -0,0 +1,23 @@
# Keep the pinned upstream revision reproducible while carrying targeted fixes.
# Never reset/checkout the submodule: refuse conflicting local edits instead.
find_package(Git REQUIRED)
set(_botcraft "${CMAKE_CURRENT_SOURCE_DIR}/3rd/Botcraft")
foreach(_patch_name Botcraft-inventory-sync.patch Botcraft-item-frame-spawn.patch)
set(_patch "${CMAKE_CURRENT_SOURCE_DIR}/patches/${_patch_name}")
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${_patch}")
execute_process(COMMAND "${GIT_EXECUTABLE}" apply --reverse --check "${_patch}"
WORKING_DIRECTORY "${_botcraft}" RESULT_VARIABLE _already_applied OUTPUT_QUIET ERROR_QUIET)
if(NOT _already_applied EQUAL 0)
execute_process(COMMAND "${GIT_EXECUTABLE}" apply --check "${_patch}"
WORKING_DIRECTORY "${_botcraft}" RESULT_VARIABLE _can_apply OUTPUT_QUIET ERROR_VARIABLE _error)
if(NOT _can_apply EQUAL 0)
message(FATAL_ERROR "Botcraft patch ${_patch_name} conflicts with the checkout; preserve local changes and inspect it manually.\n${_error}")
endif()
execute_process(COMMAND "${GIT_EXECUTABLE}" apply "${_patch}"
WORKING_DIRECTORY "${_botcraft}" RESULT_VARIABLE _applied ERROR_VARIABLE _error)
if(NOT _applied EQUAL 0)
message(FATAL_ERROR "Could not apply Botcraft patch ${_patch_name}: ${_error}")
endif()
message(STATUS "Applied Botcraft patch ${_patch_name}")
endif()
endforeach()