Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,4 @@
[submodule "backends/native/third-party/llama.cpp"]
path = backends/native/third-party/llama.cpp
url = https://github.com/ggml-org/llama.cpp.git
shallow = true
14 changes: 12 additions & 2 deletions install_executorch.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import glob
import logging
import os
import platform
import shutil
import subprocess
import sys
Expand Down Expand Up @@ -96,9 +97,12 @@ def clean():
"cpuinfo": "CMakeLists.txt",
"eigen": "CMakeLists.txt",
"flatbuffers": "CMakeLists.txt",
"flatcc": "CMakeLists.txt",
"FP16": "CMakeLists.txt",
"FXdiv": "CMakeLists.txt",
"gflags": "CMakeLists.txt",
"json": "CMakeLists.txt",
"pocketfft": "pocketfft_hdronly.h", # Header-only, no CMakeLists.txt.
"prelude": "BUCK",
"pthreadpool": "CMakeLists.txt",
"pybind11": "CMakeLists.txt",
Expand All @@ -118,12 +122,17 @@ def get_required_submodule_paths():
with open(gitmodules_path, "r") as file:
lines = file.readlines()

required_submodules = dict(REQUIRED_SUBMODULES)
# tools/cmake/preset/pybind.cmake enables MLX by default on Apple Silicon.
if sys.platform == "darwin" and platform.machine() == "arm64":
required_submodules["mlx"] = "CMakeLists.txt"

# Extract paths of required submodules
required_paths = {}
for line in lines:
if line.strip().startswith("path ="):
path = line.split("=")[1].strip()
for submodule, file_name in REQUIRED_SUBMODULES.items():
for submodule, file_name in required_submodules.items():
if submodule in path:
required_paths[path] = file_name
return required_paths
Expand All @@ -145,7 +154,8 @@ def check_folder(folder: str, file: str) -> bool:
try:
subprocess.check_call(["git", "submodule", "sync", "--recursive"])
subprocess.check_call(
["git", "submodule", "update", "--init", "--recursive"]
["git", "submodule", "update", "--init", "--recursive", "--"]
+ list(missing_submodules)
)
except subprocess.CalledProcessError as e:
logger.error(f"Error updating submodules: {e}")
Expand Down
Loading