[yocto] [PATCH 11/13] plugins/cmake: Added CMake template projects
Atanas Gegov
atanas.gegov.oss at gmail.com
Thu May 23 01:39:50 PDT 2013
From: Atanas Gegov <atanas.gegov at bmw-carit.de>
Added a C and C++ HelloWorld template projects for
CMake. The both have the new CMake project type
and are therefore built with the CMake toolchain.
---
.../build.properties | 1 +
plugins/org.yocto.cmake.managedbuilder/plugin.xml | 17 ++++++
.../HelloWorldCCMakeProject/src/CMakeLists.txt | 34 +++++++++++
.../HelloWorldCCMakeProject/src/main.c | 21 +++++++
.../HelloWorldCCMakeProject/template.properties | 31 ++++++++++
.../HelloWorldCCMakeProject/template.xml | 61 ++++++++++++++++++++
.../HelloWorldCPPCMakeProject/src/CMakeLists.txt | 34 +++++++++++
.../HelloWorldCPPCMakeProject/src/main.cpp | 21 +++++++
.../HelloWorldCPPCMakeProject/template.properties | 31 ++++++++++
.../HelloWorldCPPCMakeProject/template.xml | 61 ++++++++++++++++++++
10 files changed, 312 insertions(+)
create mode 100644 plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCCMakeProject/src/CMakeLists.txt
create mode 100644 plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCCMakeProject/src/main.c
create mode 100644 plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCCMakeProject/template.properties
create mode 100644 plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCCMakeProject/template.xml
create mode 100644 plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCPPCMakeProject/src/CMakeLists.txt
create mode 100644 plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCPPCMakeProject/src/main.cpp
create mode 100644 plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCPPCMakeProject/template.properties
create mode 100644 plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCPPCMakeProject/template.xml
diff --git a/plugins/org.yocto.cmake.managedbuilder/build.properties b/plugins/org.yocto.cmake.managedbuilder/build.properties
index 3e5f9ad..3945652 100644
--- a/plugins/org.yocto.cmake.managedbuilder/build.properties
+++ b/plugins/org.yocto.cmake.managedbuilder/build.properties
@@ -3,4 +3,5 @@ output.. = bin/
bin.includes = META-INF/,\
.,\
plugin.xml,\
+ templates/,\
OSGI-INF/
diff --git a/plugins/org.yocto.cmake.managedbuilder/plugin.xml b/plugins/org.yocto.cmake.managedbuilder/plugin.xml
index 8718ae6..7aa6671 100644
--- a/plugins/org.yocto.cmake.managedbuilder/plugin.xml
+++ b/plugins/org.yocto.cmake.managedbuilder/plugin.xml
@@ -263,4 +263,21 @@
</configuration>
</projectType>
</extension>
+ <extension
+ point="org.eclipse.cdt.core.templates">
+ <template
+ filterPattern=".*gcc"
+ id="org.yocto.cmake.managedbuilder.template.helloWorldCCMakeProject"
+ isCategory="false"
+ location="templates/projecttemplates/HelloWorldCCMakeProject/template.xml"
+ projectType="org.yocto.sdk.ide.buildArtefact.cmake.exe">
+ </template>
+ <template
+ filterPattern=".*g\+\+"
+ id="org.yocto.cmake.managedbuilder.template.helloWorldCPPCMakeProject"
+ isCategory="false"
+ location="templates/projecttemplates/HelloWorldCPPCMakeProject/template.xml"
+ projectType="org.yocto.sdk.ide.buildArtefact.cmake.exe">
+ </template>
+ </extension>
</plugin>
diff --git a/plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCCMakeProject/src/CMakeLists.txt b/plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCCMakeProject/src/CMakeLists.txt
new file mode 100644
index 0000000..e6482a7
--- /dev/null
+++ b/plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCCMakeProject/src/CMakeLists.txt
@@ -0,0 +1,34 @@
+cmake_minimum_required (VERSION 2.8.1)
+
+######## Project settings ########
+PROJECT($(projectName))
+SET(LICENSE "TBD")
+
+######## Build and include settings ########
+include_directories(
+ inc
+)
+
+link_directories(
+ ${LINK_DIRECTORIES}
+)
+
+
+file(GLOB SOURCES
+ "src/*.c"
+)
+
+add_executable(
+ $(projectName)
+
+ ${SOURCES}
+)
+
+TARGET_LINK_LIBRARIES(
+ $(projectName)
+)
+
+######## Install targets ########
+INSTALL(TARGETS $(projectName)
+ RUNTIME DESTINATION usr/bin
+)
diff --git a/plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCCMakeProject/src/main.c b/plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCCMakeProject/src/main.c
new file mode 100644
index 0000000..78b4e23
--- /dev/null
+++ b/plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCCMakeProject/src/main.c
@@ -0,0 +1,21 @@
+/** @mainpage $(projectName) - $(vendor)
+ *
+ * @author $(author) <$(email)>
+ * @version $(projectVersion)
+**/
+
+
+#include <stdio.h>
+/**
+ * Main class of project $(projectName)
+ *
+ * @param argc the number of arguments
+ * @param argv the arguments from the commandline
+ * @returns exit code of the application
+ */
+int main(int argc, char **argv) {
+ // print a greeting to the console
+ printf("Hello World!\n");
+
+ return 0;
+}
diff --git a/plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCCMakeProject/template.properties b/plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCCMakeProject/template.properties
new file mode 100644
index 0000000..bc37c1c
--- /dev/null
+++ b/plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCCMakeProject/template.properties
@@ -0,0 +1,31 @@
+#/*******************************************************************************
+# * Copyright (c) 2013 BMW Car IT GmbH.
+# * All rights reserved. This program and the accompanying materials
+# * are made available under the terms of the Eclipse Public License v1.0
+# * which accompanies this distribution, and is available at
+# * http://www.eclipse.org/legal/epl-v10.html
+# *
+# * Contributors:
+# * BMW Car IT - initial implementation
+# *******************************************************************************/
+
+# Template
+template.vendor=Yocto Project
+template.name=Hello World C CMake Project
+template.description=A simple C hello world project based on CMake
+
+# General Settings
+general.name=General settings
+general.description=Author properties of the project
+general.author.name=Author
+general.author.description=The author of the project
+general.author.default=anonymous
+general.email.name=Email address
+general.email.description=The email address of the project's author
+general.email.default=anony at mo.us
+general.vendor.name=Vendor
+general.vendor.description=The vendor of the project
+general.vendor.default=None
+general.projectVersion.name=Version
+general.projectVersion.description=The version of the project
+general.projectVersion.default=1.0.0
diff --git a/plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCCMakeProject/template.xml b/plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCCMakeProject/template.xml
new file mode 100644
index 0000000..7c3774e
--- /dev/null
+++ b/plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCCMakeProject/template.xml
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<template type="ProjTempl"
+ version="1.0" supplier="%template.vendor" revision="1.0" author="Atanas Gegov"
+ id="org.yocto.cmake.template.exe.helloWorldCCMakeProject" label="%template.name"
+ description="%template.description">
+
+ <property-group id="general_settings" label="%general.name"
+ description="%general.description" type="PAGES-ONLY">
+ <property id="author" label="%general.author.name" description="%general.author.description"
+ default="%general.author.default" type="input" hidden="false" mandatory="false"
+ persist="true" />
+
+ <property id="email" label="%general.email.name"
+ description="%general.email.description" default="%general.email.default"
+ type="input" hidden="false" mandatory="false" persist="true" />
+
+ <property id="vendor" label="%general.vendor.name"
+ description="%general.vendor.description" default="%general.vendor.default"
+ type="input" hidden="false" mandatory="false" persist="true" />
+
+ <property id="projectVersion" label="%general.projectVersion.name"
+ description="%general.projectVersion.description" checkproject="false"
+ default="%general.projectVersion.default" type="input"
+ pattern="([0-9]\.){2}[0-9]" hidden="false" mandatory="false" persist="true" />
+ </property-group>
+
+ <process type="org.yocto.sdk.ide.NewYoctoProject">
+ <simple name="name" value="$(projectName)" />
+ <simple name="artifactExtension" value="exe" />
+ <simple name="isCProject" value="true" />
+ <simple name="isEmptyProject" value="false" />
+ <simple name="isAutotoolsProject" value="false" />
+ <simple name="isCMakeProject" value="true" />
+ </process>
+
+ <process type="org.eclipse.cdt.core.CreateSourceFolder">
+ <simple name="projectName" value="$(projectName)" />
+ <simple name="path" value="src" />
+ </process>
+
+ <process type="org.eclipse.cdt.managedbuilder.core.CreateIncludeFolder">
+ <simple name="projectName" value="$(projectName)" />
+ <simple name="path" value="inc" />
+ </process>
+
+ <process type="org.eclipse.cdt.core.AddFiles">
+ <simple name="projectName" value="$(projectName)" />
+ <complex-array name="files">
+ <element>
+ <simple name="source" value="src/main.c" />
+ <simple name="target" value="src/main.c" />
+ <simple name="replaceable" value="true" />
+ </element>
+ <element>
+ <simple name="source" value="src/CMakeLists.txt" />
+ <simple name="target" value="CMakeLists.txt" />
+ <simple name="replaceable" value="true" />
+ </element>
+ </complex-array>
+ </process>
+</template>
diff --git a/plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCPPCMakeProject/src/CMakeLists.txt b/plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCPPCMakeProject/src/CMakeLists.txt
new file mode 100644
index 0000000..0436959
--- /dev/null
+++ b/plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCPPCMakeProject/src/CMakeLists.txt
@@ -0,0 +1,34 @@
+cmake_minimum_required (VERSION 2.8.1)
+
+######## Project settings ########
+PROJECT($(projectName))
+SET(LICENSE "TBD")
+
+######## Build and include settings ########
+include_directories(
+ inc
+)
+
+link_directories(
+ ${LINK_DIRECTORIES}
+)
+
+
+file(GLOB SOURCES
+ "src/*.cpp"
+)
+
+add_executable(
+ $(projectName)
+
+ ${SOURCES}
+)
+
+TARGET_LINK_LIBRARIES(
+ $(projectName)
+)
+
+######## Install targets ########
+INSTALL(TARGETS $(projectName)
+ RUNTIME DESTINATION usr/bin
+)
diff --git a/plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCPPCMakeProject/src/main.cpp b/plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCPPCMakeProject/src/main.cpp
new file mode 100644
index 0000000..78b4e23
--- /dev/null
+++ b/plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCPPCMakeProject/src/main.cpp
@@ -0,0 +1,21 @@
+/** @mainpage $(projectName) - $(vendor)
+ *
+ * @author $(author) <$(email)>
+ * @version $(projectVersion)
+**/
+
+
+#include <stdio.h>
+/**
+ * Main class of project $(projectName)
+ *
+ * @param argc the number of arguments
+ * @param argv the arguments from the commandline
+ * @returns exit code of the application
+ */
+int main(int argc, char **argv) {
+ // print a greeting to the console
+ printf("Hello World!\n");
+
+ return 0;
+}
diff --git a/plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCPPCMakeProject/template.properties b/plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCPPCMakeProject/template.properties
new file mode 100644
index 0000000..99e7047
--- /dev/null
+++ b/plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCPPCMakeProject/template.properties
@@ -0,0 +1,31 @@
+#/*******************************************************************************
+# * Copyright (c) 2013 BMW Car IT GmbH.
+# * All rights reserved. This program and the accompanying materials
+# * are made available under the terms of the Eclipse Public License v1.0
+# * which accompanies this distribution, and is available at
+# * http://www.eclipse.org/legal/epl-v10.html
+# *
+# * Contributors:
+# * BMW Car IT - initial implementation
+# *******************************************************************************/
+
+# Template
+template.vendor=Yocto Project
+template.name=Hello World C++ CMake Project
+template.description=A simple C++ hello world project based on CMake
+
+# General Settings
+general.name=General settings
+general.description=Author properties of the project
+general.author.name=Author
+general.author.description=The author of the project
+general.author.default=anonymous
+general.email.name=Email address
+general.email.description=The email address of the project's author
+general.email.default=anony at mo.us
+general.vendor.name=Vendor
+general.vendor.description=The vendor of the project
+general.vendor.default=None
+general.projectVersion.name=Version
+general.projectVersion.description=The version of the project
+general.projectVersion.default=1.0.0
diff --git a/plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCPPCMakeProject/template.xml b/plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCPPCMakeProject/template.xml
new file mode 100644
index 0000000..a664d8a
--- /dev/null
+++ b/plugins/org.yocto.cmake.managedbuilder/templates/projecttemplates/HelloWorldCPPCMakeProject/template.xml
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<template type="ProjTempl"
+ version="1.0" supplier="%template.vendor" revision="1.0" author="Atanas Gegov"
+ id="org.yocto.cmake.template.exe.helloWorldCPPCMakeProject" label="%template.name"
+ description="%template.description">
+
+ <property-group id="general_settings" label="%general.name"
+ description="%general.description" type="PAGES-ONLY">
+ <property id="author" label="%general.author.name" description="%general.author.description"
+ default="%general.author.default" type="input" hidden="false" mandatory="false"
+ persist="true" />
+
+ <property id="email" label="%general.email.name"
+ description="%general.email.description" default="%general.email.default"
+ type="input" hidden="false" mandatory="false" persist="true" />
+
+ <property id="vendor" label="%general.vendor.name"
+ description="%general.vendor.description" default="%general.vendor.default"
+ type="input" hidden="false" mandatory="false" persist="true" />
+
+ <property id="projectVersion" label="%general.projectVersion.name"
+ description="%general.projectVersion.description" checkproject="false"
+ default="%general.projectVersion.default" type="input"
+ pattern="([0-9]\.){2}[0-9]" hidden="false" mandatory="false" persist="true" />
+ </property-group>
+
+ <process type="org.yocto.sdk.ide.NewYoctoProject">
+ <simple name="name" value="$(projectName)" />
+ <simple name="artifactExtension" value="exe" />
+ <simple name="isCProject" value="false" />
+ <simple name="isEmptyProject" value="false" />
+ <simple name="isAutotoolsProject" value="false" />
+ <simple name="isCMakeProject" value="true" />
+ </process>
+
+ <process type="org.eclipse.cdt.core.CreateSourceFolder">
+ <simple name="projectName" value="$(projectName)" />
+ <simple name="path" value="src" />
+ </process>
+
+ <process type="org.eclipse.cdt.managedbuilder.core.CreateIncludeFolder">
+ <simple name="projectName" value="$(projectName)" />
+ <simple name="path" value="inc" />
+ </process>
+
+ <process type="org.eclipse.cdt.core.AddFiles">
+ <simple name="projectName" value="$(projectName)" />
+ <complex-array name="files">
+ <element>
+ <simple name="source" value="src/main.cpp" />
+ <simple name="target" value="src/main.cpp" />
+ <simple name="replaceable" value="true" />
+ </element>
+ <element>
+ <simple name="source" value="src/CMakeLists.txt" />
+ <simple name="target" value="CMakeLists.txt" />
+ <simple name="replaceable" value="true" />
+ </element>
+ </complex-array>
+ </process>
+</template>
--
1.7.9.5
More information about the yocto
mailing list