diff --git a/spa/tests/gen-cpp-test.py b/spa/tests/gen-cpp-test.py new file mode 100755 index 000000000..a02c1a1d1 --- /dev/null +++ b/spa/tests/gen-cpp-test.py @@ -0,0 +1,24 @@ +#!/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))) diff --git a/spa/tests/meson.build b/spa/tests/meson.build index d59ad11fc..47771a760 100644 --- a/spa/tests/meson.build +++ b/spa/tests/meson.build @@ -31,8 +31,13 @@ foreach a : test_apps endforeach if have_cpp + gen_cpp_test = find_program('gen-cpp-test.py') + src_test_cpp = custom_target('gen-cpp-test', + command: [gen_cpp_test, meson.source_root() / 'spa' / 'include' / 'spa'], + output: 'test-cpp.cpp', + capture: true) # compilation test only - executable('spa-test-cpp', 'test-cpp.cpp', + executable('spa-test-cpp', src_test_cpp, include_directories : [spa_inc ], dependencies : [], install : false) diff --git a/spa/tests/test-cpp.cpp b/spa/tests/test-cpp.cpp deleted file mode 100644 index 6e9c17778..000000000 --- a/spa/tests/test-cpp.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* Simple Plugin API - * Copyright © 2018 Collabora Ltd. - * @author George Kiagiadakis - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -int main(int argc, char *argv[]) -{ - return 0; -}