@@ -206,6 +206,11 @@ ExternalProject_Add(
206206 # MLX's own install() does not emit libmlx.a where we consume it or the
207207 # metallib at all, so skip the install step and read both from the build tree.
208208 INSTALL_COMMAND ""
209+ # ExternalProject stamps its build, so a bare MLX submodule bump (git
210+ # submodule update) would not invalidate the stamp and we'd link a stale
211+ # libmlx.a with no signal. BUILD_ALWAYS reruns the build step every configure;
212+ # it is a fast no-op under Ninja when nothing changed.
213+ BUILD_ALWAYS ON
209214 # Required so Ninja knows these are produced by the external build.
210215 BUILD_BYPRODUCTS ${_mlx_static_lib} ${_mlx_metallib}
211216)
@@ -217,7 +222,9 @@ ExternalProject_Add(
217222add_library (mlx STATIC IMPORTED GLOBAL )
218223set_target_properties (mlx PROPERTIES IMPORTED_LOCATION ${_mlx_static_lib} )
219224# Headers come from the submodule source tree (always present), not the build
220- # dir, so mlxdelegate compilation cannot race the external build.
225+ # dir, so mlxdelegate compilation cannot race the external build. Verified: MLX
226+ # emits no public headers into the build tree (version.h is checked in; the
227+ # version string is a compile-def on version.cpp), so the source dir suffices.
221228target_include_directories (mlx INTERFACE ${MLX_SOURCE_DIR } )
222229find_library (METAL_FRAMEWORK Metal )
223230find_library (FOUNDATION_FRAMEWORK Foundation )
@@ -227,7 +234,6 @@ set_target_properties(
227234 PROPERTIES INTERFACE_LINK_LIBRARIES
228235 "${METAL_FRAMEWORK} ;${FOUNDATION_FRAMEWORK} ;${QUARTZ_FRAMEWORK} "
229236)
230- add_dependencies (mlx mlx_external )
231237
232238# -----------------------------------------------------------------------------
233239# MLX Backend library
@@ -255,9 +261,8 @@ add_library(mlxdelegate ${_mlx_backend__srcs})
255261# Ensure schema is generated before compiling
256262add_dependencies (mlxdelegate mlx_schema )
257263
258- # mlx is an imported target, so add_dependencies(mlx mlx_external) above does
259- # not order the build. Depend on mlx_external directly so libmlx.a exists before
260- # mlxdelegate links.
264+ # mlx is an imported target, so a dependency on it would not order the build.
265+ # Depend on mlx_external directly so libmlx.a exists before mlxdelegate links.
261266add_dependencies (mlxdelegate mlx_external )
262267
263268# Add logging flag if enabled
0 commit comments