Skip to content

Commit 4d73f05

Browse files
committed
[Build] Add homebrew as library search location
So that one can build TorchVision on MacOS by installing jpeg/webp dependencies as `brew install jpeg-turbo webp`
1 parent f799a53 commit 4d73f05

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

setup.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,14 @@ def find_library(header):
271271
return True, None, None
272272
print(f"{searching_for}. Didn't find in {prefix}")
273273

274+
if sys.platform == "darwin":
275+
HOMEBREW_PATH = Path("/opt/homebrew")
276+
include_dir = HOMEBREW_PATH / "include"
277+
library_dir = HOMEBREW_PATH / "lib"
278+
if (include_dir / header).exists():
279+
print(f"{searching_for}. Found in {include_dir}.")
280+
return True, str(include_dir), str(library_dir)
281+
274282
return False, None, None
275283

276284

0 commit comments

Comments
 (0)