Fix macOS installation: Add LLVM,brew check & logging in setup.py

This commit is contained in:
BVishal-Geek
2025-02-28 20:05:43 -05:00
parent 85dc9bfd19
commit 4e605d2d46

View File

@@ -82,22 +82,31 @@ logging.basicConfig(level=logging.INFO, format="%(levelname)s: %(message)s")
# Check if running on macOS (Darwin)
if platform.system() == "Darwin":
logging.info("Detected macOS. Checking if LLVM and OpenMP are installed...")
logging.info("Detected macOS. Checking if Homebrew, LLVM, and OpenMP are installed...")
# Check if LLVM is installed
llvm_check = subprocess.run(["brew", "--prefix", "llvm"], capture_output=True, text=True)
if llvm_check.returncode != 0:
logging.warning("LLVM is not installed. This may cause installation issues.")
logging.warning(" To install, run: brew install llvm libomp")
logging.warning(" Then, restart the installation process.")
# Check if Homebrew is installed
brew_check = subprocess.run(["which", "brew"], capture_output=True, text=True)
if brew_check.returncode != 0:
logging.warning("Homebrew is not installed. You may need to manually install dependencies.")
logging.warning(" Install Homebrew: https://brew.sh/")
logging.warning(" Then, run: brew install llvm libomp")
logging.info("Proceeding without setting the compiler.")
else:
# Set compiler dynamically if LLVM is installed
llvm_path = subprocess.getoutput("brew --prefix llvm")
os.environ["CC"] = f"{llvm_path}/bin/clang"
os.environ["CXX"] = f"{llvm_path}/bin/clang++"
logging.info(f"Using compiler: {os.environ['CC']}")
# Check if LLVM is installed
llvm_check = subprocess.run(["brew", "--prefix", "llvm"], capture_output=True, text=True)
if llvm_check.returncode != 0:
logging.warning("LLVM is not installed. This may cause installation issues.")
logging.warning(" To install, run: brew install llvm libomp")
logging.warning(" Then, restart the installation process.")
logging.info("Proceeding without setting the compiler.")
else:
# Set compiler dynamically if LLVM is installed
llvm_path = subprocess.getoutput("brew --prefix llvm")
os.environ["CC"] = f"{llvm_path}/bin/clang"
os.environ["CXX"] = f"{llvm_path}/bin/clang++"
logging.info(f"Using compiler: {os.environ['CC']}")
setup(
# Metadata