From 88d0682a88f3f6e9f7baf4b5ac31178e9932b17d Mon Sep 17 00:00:00 2001 From: LeiWang1999 Date: Thu, 16 Oct 2025 20:09:38 +0800 Subject: [PATCH] submodule update --- CMakeLists.txt | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index eb1b4fc75..26da8cdb2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,6 +10,30 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake) +if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.gitmodules" AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git") + find_package(Git QUIET) + if(Git_FOUND) + execute_process( + COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + RESULT_VARIABLE TILELANG_GIT_SUBMODULE_RESULT + ) + if(NOT TILELANG_GIT_SUBMODULE_RESULT EQUAL 0) + message( + FATAL_ERROR + "Failed to initialize git submodules. Please run " + "`git submodule update --init --recursive` and re-run CMake." + ) + endif() + else() + message( + FATAL_ERROR + "Git is required to initialize TileLang submodules. " + "Please install git or fetch the submodules manually." + ) + endif() +endif() + find_program(CCACHE_PROGRAM ccache) if(CCACHE_PROGRAM) set(CMAKE_C_COMPILER_LAUNCHER "${CCACHE_PROGRAM}" CACHE STRING "C compiler launcher")