[gnome-builder] meson-templates: add C++ CLI project
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] meson-templates: add C++ CLI project
- Date: Wed, 21 Oct 2020 19:50:35 +0000 (UTC)
commit 6f2c8fa22c3dc3a2342e2849593e8b034b1bf48d
Author: mimi89999 <michel lebihan pl>
Date: Wed Oct 21 21:34:50 2020 +0200
meson-templates: add C++ CLI project
src/plugins/meson-templates/meson-templates.gresource.xml | 1 +
src/plugins/meson-templates/meson_templates.py | 4 +++-
src/plugins/meson-templates/resources/src/main-cli.cpp | 7 +++++++
src/plugins/meson-templates/resources/src/meson-cli.build | 2 ++
4 files changed, 13 insertions(+), 1 deletion(-)
---
diff --git a/src/plugins/meson-templates/meson-templates.gresource.xml
b/src/plugins/meson-templates/meson-templates.gresource.xml
index a2d2a0d30..37c30cbfc 100644
--- a/src/plugins/meson-templates/meson-templates.gresource.xml
+++ b/src/plugins/meson-templates/meson-templates.gresource.xml
@@ -20,6 +20,7 @@
<file compressed="true">resources/src/main.c</file>
<file compressed="true">resources/src/main-cli.c</file>
<file compressed="true">resources/src/main.cpp</file>
+ <file compressed="true">resources/src/main-cli.cpp</file>
<file compressed="true">resources/src/hello.src.gresource.xml</file>
<file compressed="true">resources/src/window.c</file>
<file compressed="true">resources/src/window.cpp</file>
diff --git a/src/plugins/meson-templates/meson_templates.py b/src/plugins/meson-templates/meson_templates.py
index e3e522984..eba8d8df4 100644
--- a/src/plugins/meson-templates/meson_templates.py
+++ b/src/plugins/meson-templates/meson_templates.py
@@ -363,7 +363,7 @@ class CLIProjectTemplate(MesonTemplate):
_('Command Line Tool'),
'pattern-cli',
_('Create a new command line project'),
- ['C', 'Vala', 'Rust'],
+ ['C', 'C++', 'Vala', 'Rust'],
200
)
@@ -372,6 +372,8 @@ class CLIProjectTemplate(MesonTemplate):
if self.language == 'c':
files['resources/src/main-cli.c'] = 'src/main.c'
+ elif self.language == 'c++':
+ files['resources/src/main-cli.cpp'] = 'src/main.cpp'
elif self.language == 'vala':
files['resources/src/main-cli.vala'] = 'src/main.vala'
elif self.language == 'rust':
diff --git a/src/plugins/meson-templates/resources/src/main-cli.cpp
b/src/plugins/meson-templates/resources/src/main-cli.cpp
new file mode 100644
index 000000000..70866515b
--- /dev/null
+++ b/src/plugins/meson-templates/resources/src/main-cli.cpp
@@ -0,0 +1,7 @@
+#include <iostream>
+
+int main() {
+ std::cout << "Hello World\n";
+
+ return 0;
+}
diff --git a/src/plugins/meson-templates/resources/src/meson-cli.build
b/src/plugins/meson-templates/resources/src/meson-cli.build
index f9defad53..b0afe09ba 100644
--- a/src/plugins/meson-templates/resources/src/meson-cli.build
+++ b/src/plugins/meson-templates/resources/src/meson-cli.build
@@ -1,6 +1,8 @@
{{name_}}_sources = [
{{if language == "c"}}
'main.c',
+{{else if language == "c++"}}
+ 'main.cpp',
{{else if language == "vala"}}
'main.vala',
{{else if language == "rust"}}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]