Find all C++ source files in the project.
()
| 73 | |
| 74 | def find_cpp_files() -> List[Path]: |
| 75 | """Find all C++ source files in the project.""" |
| 76 | project_dir = Path(__file__).parent.parent |
| 77 | extensions = {".cc", ".cpp", ".cxx"} |
| 78 | exclude_dirs = {"build", "vcpkg_installed", ".cache", ".git", "third_party"} |
| 79 | |
| 80 | files = [] |
| 81 | for ext in extensions: |
| 82 | for file in project_dir.rglob(f"*{ext}"): |
| 83 | # Skip files in excluded directories |
| 84 | # Only directory components are checked for the "build-" prefix so |
| 85 | # source files like "build-info.cpp" are not skipped. |
| 86 | if any(part in exclude_dirs for part in file.parts) or any( |
| 87 | part.startswith("build-") for part in file.parts[:-1]): |
| 88 | continue |
| 89 | files.append(file) |
| 90 | |
| 91 | return sorted(files) |
| 92 |