Get system include paths for macOS.
()
| 46 | |
| 47 | |
| 48 | def get_system_include_args() -> List[str]: |
| 49 | """Get system include paths for macOS.""" |
| 50 | if sys.platform != "darwin": |
| 51 | return [] |
| 52 | |
| 53 | try: |
| 54 | # Get Xcode path |
| 55 | result = subprocess.run(["xcode-select", "-p"], capture_output=True, text=True) |
| 56 | if result.returncode != 0: |
| 57 | xcode_path = "/Applications/Xcode.app/Contents/Developer" |
| 58 | else: |
| 59 | xcode_path = result.stdout.strip() |
| 60 | |
| 61 | sdk_path = Path(xcode_path) / "Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk" |
| 62 | |
| 63 | if sdk_path.exists(): |
| 64 | return [ |
| 65 | f"--extra-arg=-isystem{sdk_path}/usr/include/c++/v1", |
| 66 | f"--extra-arg=-isystem{sdk_path}/usr/include", |
| 67 | f"--extra-arg=-isystem{xcode_path}/Toolchains/XcodeDefault.xctoolchain/usr/include" |
| 68 | ] |
| 69 | except Exception: |
| 70 | pass |
| 71 | |
| 72 | return [] |
| 73 | |
| 74 | |
| 75 | def find_cpp_files() -> List[Path]: |