summaryrefslogtreecommitdiffstats
path: root/meta-selftest/recipes-test/cpp/files/cpp-example-lib.hpp
diff options
context:
space:
mode:
authorAdrian Freihofer <adrian.freihofer@gmail.com>2023-12-07 21:52:49 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-12-13 11:58:12 +0000
commit4904e772470b0d6e5d98ef0344b3f2bf54214661 (patch)
tree15b02a98940c0da57ca37eadea100677f2c84cac /meta-selftest/recipes-test/cpp/files/cpp-example-lib.hpp
parent5cb05ca6542aa6239e0371dd9df4705b168d245e (diff)
downloadopenembedded-core-4904e772470b0d6e5d98ef0344b3f2bf54214661.tar.gz
oe-selftest: add a cpp-example recipe
This simple C++ project supports compilation with CMake and Meson. (Autotool support could be added later on.) It's supposed to be used with oe-selftest. An artificial project has several advantages over compiling a normal CMake or Meson based project for testing purposes: - It is much faster because it can be kept minimalistic - It can cover multiple odd corner cases - No one will change it in an unpredictable way - It can support multiple build tools with only one C++ codebase Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta-selftest/recipes-test/cpp/files/cpp-example-lib.hpp')
-rw-r--r--meta-selftest/recipes-test/cpp/files/cpp-example-lib.hpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/meta-selftest/recipes-test/cpp/files/cpp-example-lib.hpp b/meta-selftest/recipes-test/cpp/files/cpp-example-lib.hpp
new file mode 100644
index 0000000000..0ad9e7b7b2
--- /dev/null
+++ b/meta-selftest/recipes-test/cpp/files/cpp-example-lib.hpp
@@ -0,0 +1,21 @@
+/*
+ * Copyright OpenEmbedded Contributors
+ *
+ * SPDX-License-Identifier: MIT
+ */
+
+#pragma once
+
+#include <string>
+
+struct CppExample
+{
+ inline static const std::string test_string = "cpp-example-lib Magic: 123456789";
+
+ /* Retrieve a constant string */
+ const std::string &get_string();
+ /* Retrieve a constant string from a library */
+ const char *get_json_c_version();
+ /* Call a more advanced function from a library */
+ void print_json();
+};