Find all C++ source and header files in the project.
()
| 25 | |
| 26 | |
| 27 | def find_cpp_files() -> List[Path]: |
| 28 | """Find all C++ source and header files in the project.""" |
| 29 | project_dir = Path(__file__).parent.parent |
| 30 | extensions = {".h", ".hpp", ".cc", ".cpp", ".cxx"} |
| 31 | exclude_dirs = {"build", "vcpkg_installed", ".cache", ".git", "third_party"} |
| 32 | |
| 33 | files = [] |
| 34 | for ext in extensions: |
| 35 | for file in project_dir.rglob(f"*{ext}"): |
| 36 | # Skip files in excluded directories |
| 37 | # Only directory components are checked for the "build-" prefix so |
| 38 | # source files like "build-info.cpp" are not skipped. |
| 39 | if any(part in exclude_dirs for part in file.parts) or any( |
| 40 | part.startswith("build-") for part in file.parts[:-1]): |
| 41 | continue |
| 42 | files.append(file) |
| 43 | |
| 44 | return sorted(files) |