pipewire/spa/tests/gen-cpp-test.py
Peter Hutterer db989d851d spa: auto-generate the cpp compilation test
Replace the manually maintained header list with a Python script that finds
all header files and includes them in order. This adds another 25 or so
previously headers to the C++ compilation tests.
2021-06-07 07:20:21 +00:00

24 lines
478 B
Python
Executable file

#!/usr/bin/env python3
#
# Generates a simple .cpp file including all of the SPA headers.
#
# Usage: gen-cpp-test.py path/to/pipewire.git/spa/include/spa
template = """
@@INCLUDES@@
int main(int argc, char *argv[])
{
return 0;
}
"""
import sys
from pathlib import Path
basedir = Path(sys.argv[1])
includes = [
"#include <{}>".format(f.relative_to(basedir.parent)) for f in sorted(basedir.rglob("*.h"))
]
print(template.replace("@@INCLUDES@@", "\n".join(includes)))