diff options
author | Tudor Florea <tudor.florea@enea.com> | 2014-10-10 03:49:30 +0200 |
---|---|---|
committer | Tudor Florea <tudor.florea@enea.com> | 2014-10-10 03:49:30 +0200 |
commit | ede215cf93ba81c963ae62d665d0f32c9407551c (patch) | |
tree | 4a6dc80f259bccb8ff8b76d31e6cc8794bd97a2b /plugins/org.yocto.cmake.managedbuilder | |
download | eclipse-poky-kepler-daisy-140929.tar.gz |
initial commit for Enea Linux 4.0-140929daisy-140929
Migrated from the internal git server on the daisy-enea-point-release branch
Signed-off-by: Tudor Florea <tudor.florea@enea.com>
Diffstat (limited to 'plugins/org.yocto.cmake.managedbuilder')
22 files changed, 1453 insertions, 0 deletions
diff --git a/plugins/org.yocto.cmake.managedbuilder/.classpath b/plugins/org.yocto.cmake.managedbuilder/.classpath new file mode 100644 index 0000000..ad32c83 --- /dev/null +++ b/plugins/org.yocto.cmake.managedbuilder/.classpath | |||
@@ -0,0 +1,7 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <classpath> | ||
3 | <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> | ||
4 | <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> | ||
5 | <classpathentry kind="src" path="src"/> | ||
6 | <classpathentry kind="output" path="bin"/> | ||
7 | </classpath> | ||
diff --git a/plugins/org.yocto.cmake.managedbuilder/.project b/plugins/org.yocto.cmake.managedbuilder/.project new file mode 100644 index 0000000..67c7f68 --- /dev/null +++ b/plugins/org.yocto.cmake.managedbuilder/.project | |||
@@ -0,0 +1,28 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <projectDescription> | ||
3 | <name>org.yocto.cmake.managedbuilder</name> | ||
4 | <comment></comment> | ||
5 | <projects> | ||
6 | </projects> | ||
7 | <buildSpec> | ||
8 | <buildCommand> | ||
9 | <name>org.eclipse.jdt.core.javabuilder</name> | ||
10 | <arguments> | ||
11 | </arguments> | ||
12 | </buildCommand> | ||
13 | <buildCommand> | ||
14 | <name>org.eclipse.pde.ManifestBuilder</name> | ||
15 | <arguments> | ||
16 | </arguments> | ||
17 | </buildCommand> | ||
18 | <buildCommand> | ||
19 | <name>org.eclipse.pde.SchemaBuilder</name> | ||
20 | <arguments> | ||
21 | </arguments> | ||
22 | </buildCommand> | ||
23 | </buildSpec> | ||
24 | <natures> | ||
25 | <nature>org.eclipse.pde.PluginNature</nature> | ||
26 | <nature>org.eclipse.jdt.core.javanature</nature> | ||
27 | </natures> | ||
28 | </projectDescription> | ||
diff --git a/plugins/org.yocto.cmake.managedbuilder/.settings/org.eclipse.jdt.core.prefs b/plugins/org.yocto.cmake.managedbuilder/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..c1a4ce9 --- /dev/null +++ b/plugins/org.yocto.cmake.managedbuilder/.settings/org.eclipse.jdt.core.prefs | |||
@@ -0,0 +1,8 @@ | |||
1 | #Wed Jul 14 11:43:59 CEST 2010 | ||
2 | eclipse.preferences.version=1 | ||
3 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled | ||
4 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 | ||
5 | org.eclipse.jdt.core.compiler.compliance=1.6 | ||
6 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error | ||
7 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error | ||
8 | org.eclipse.jdt.core.compiler.source=1.6 | ||
diff --git a/plugins/org.yocto.cmake.managedbuilder/META-INF/MANIFEST.MF b/plugins/org.yocto.cmake.managedbuilder/META-INF/MANIFEST.MF new file mode 100644 index 0000000..2ed5451 --- /dev/null +++ b/plugins/org.yocto.cmake.managedbuilder/META-INF/MANIFEST.MF | |||
@@ -0,0 +1,16 @@ | |||
1 | Manifest-Version: 1.0 | ||
2 | Bundle-ManifestVersion: 2 | ||
3 | Bundle-Name: %Bundle-Name | ||
4 | Bundle-SymbolicName: org.yocto.cmake.managedbuilder;singleton:=true | ||
5 | Bundle-Version: 1.4.0.qualifier | ||
6 | Bundle-Activator: org.yocto.cmake.managedbuilder.Activator | ||
7 | Bundle-Vendor: %Bundle-Vendor | ||
8 | Require-Bundle: org.eclipse.cdt.managedbuilder.core, | ||
9 | org.eclipse.cdt.core;bundle-version="5.2.1", | ||
10 | org.eclipse.core.resources;bundle-version="3.6.0", | ||
11 | org.eclipse.core.runtime;bundle-version="3.6.0", | ||
12 | org.eclipse.ui.console;bundle-version="3.5.0", | ||
13 | org.eclipse.ui;bundle-version="3.6.2", | ||
14 | org.yocto.sdk.ide | ||
15 | Bundle-RequiredExecutionEnvironment: JavaSE-1.6 | ||
16 | Bundle-ActivationPolicy: lazy | ||
diff --git a/plugins/org.yocto.cmake.managedbuilder/OSGI-INF/l10n/bundle.properties b/plugins/org.yocto.cmake.managedbuilder/OSGI-INF/l10n/bundle.properties new file mode 100644 index 0000000..b2c067f --- /dev/null +++ b/plugins/org.yocto.cmake.managedbuilder/OSGI-INF/l10n/bundle.properties | |||
@@ -0,0 +1,40 @@ | |||
1 | #/******************************************************************************* | ||
2 | # * Copyright (c) 2013 BMW Car IT GmbH. | ||
3 | # * All rights reserved. This program and the accompanying materials | ||
4 | # * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | # * which accompanies this distribution, and is available at | ||
6 | # * http://www.eclipse.org/legal/epl-v10.html | ||
7 | # * | ||
8 | # * Contributors: | ||
9 | # * BMW Car IT - initial implementation | ||
10 | # *******************************************************************************/ | ||
11 | |||
12 | Bundle-Vendor = yoctoproject.org | ||
13 | Bundle-Name = Yocto CMake Plugin | ||
14 | |||
15 | # Artefact type | ||
16 | yocto.cmake.artefactType=Yocto Project ADT CMake Project | ||
17 | |||
18 | # Extension name | ||
19 | extension.name=Yocto CMake Managed Builder | ||
20 | |||
21 | # Builder | ||
22 | builder.name=Yocto CMake Environment Builder | ||
23 | |||
24 | # Toolchain | ||
25 | toolchain=Yocto CMake Build (Toolchain) | ||
26 | |||
27 | # Configuration names | ||
28 | config.debug.name=Debug | ||
29 | config.debug.description=Builds a version of the project which is ready for debugging | ||
30 | |||
31 | # CMake configure | ||
32 | cmakeconfigure.name=CMake configure | ||
33 | cmakeconfigure.options=CMake Options | ||
34 | cmakeconfigure.sourcepath=Relative source path | ||
35 | cmakeconfigure.toolchaincmakefilepath=Relative toolchain.cmake path | ||
36 | cmakeconfigure.debugsymbols=Compile with debug symbols | ||
37 | cmakeconfigure.verbosemakefile=Generate verbose Makefiles | ||
38 | cmakeconfigure.wdev=Enable developer warnings (-Wdev) | ||
39 | cmakeconfigure.wnodev=Suppress developer warnings (-Wno-dev) | ||
40 | cmakeconfigure.otherflags=Other flags | ||
diff --git a/plugins/org.yocto.cmake.managedbuilder/build.properties b/plugins/org.yocto.cmake.managedbuilder/build.properties new file mode 100644 index 0000000..3945652 --- /dev/null +++ b/plugins/org.yocto.cmake.managedbuilder/build.properties | |||
@@ -0,0 +1,7 @@ | |||
1 | source.. = src/ | ||
2 | output.. = bin/ | ||
3 | bin.includes = META-INF/,\ | ||
4 | .,\ | ||
5 | plugin.xml,\ | ||
6 | templates/,\ | ||
7 | OSGI-INF/ | ||
diff --git a/plugins/org.yocto.cmake.managedbuilder/plugin.xml b/plugins/org.yocto.cmake.managedbuilder/plugin.xml new file mode 100644 index 0000000..7aa6671 --- /dev/null +++ b/plugins/org.yocto.cmake.managedbuilder/plugin.xml | |||
@@ -0,0 +1,283 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <?eclipse version="3.4"?> | ||
3 | <plugin> | ||
4 | <extension | ||
5 | point="org.eclipse.cdt.managedbuilder.core.buildProperties"> | ||
6 | <propertyValue | ||
7 | id="org.yocto.sdk.ide.buildArtefact.cmake.exe" | ||
8 | name="%yocto.cmake.artefactType" | ||
9 | property="org.eclipse.cdt.build.core.buildArtefactType"> | ||
10 | </propertyValue> | ||
11 | </extension> | ||
12 | <extension | ||
13 | id="org.yocto.cmake.managedbuilder" | ||
14 | name="%extension.name" | ||
15 | point="org.eclipse.cdt.managedbuilder.core.buildDefinitions"> | ||
16 | <managedBuildRevision | ||
17 | fileVersion="4.0.0"> | ||
18 | </managedBuildRevision> | ||
19 | <builder | ||
20 | id="org.yocto.cmake.managedbuilder.builder" | ||
21 | name="%builder.name" | ||
22 | buildfileGenerator="org.yocto.cmake.managedbuilder.YoctoCMakeMakefileGenerator" | ||
23 | cleanBuildTarget="clean" | ||
24 | command="make" | ||
25 | isVariableCaseSensitive="false" | ||
26 | supportsManagedBuild="true"> | ||
27 | </builder> | ||
28 | <tool | ||
29 | id="org.yocto.cmake.managedbuilder.cmakeconfigure" | ||
30 | name="%cmakeconfigure.name" | ||
31 | command="cmake" | ||
32 | commandLinePattern="${COMMAND} ${FLAGS} " | ||
33 | natureFilter="both"> | ||
34 | <optionCategory | ||
35 | id="org.yocto.cmake.managedbuilder.cmakeconfigure.category.options" | ||
36 | name="%cmakeconfigure.options"> | ||
37 | </optionCategory> | ||
38 | <option | ||
39 | category="org.yocto.cmake.managedbuilder.cmakeconfigure.category.options" | ||
40 | defaultValue="${OECMAKE_SOURCEPATH}" | ||
41 | id="org.yocto.cmake.managedbuilder.cmakeconfigure.options.sourcepath" | ||
42 | isAbstract="false" | ||
43 | name="%cmakeconfigure.sourcepath" | ||
44 | resourceFilter="all" | ||
45 | valueType="string"> | ||
46 | </option> | ||
47 | <option | ||
48 | category="org.yocto.cmake.managedbuilder.cmakeconfigure.category.options" | ||
49 | defaultValue="-DCMAKE_TOOLCHAIN_FILE=${OECMAKE_SOURCEPATH}/toolchain.cmake" | ||
50 | id="org.yocto.cmake.managedbuilder.cmakeconfigure.options.toolchaincmakefilepath" | ||
51 | isAbstract="false" | ||
52 | name="%cmakeconfigure.toolchaincmakefilepath" | ||
53 | resourceFilter="all" | ||
54 | valueType="string"> | ||
55 | </option> | ||
56 | <option | ||
57 | category="org.yocto.cmake.managedbuilder.cmakeconfigure.category.options" | ||
58 | id="org.yocto.cmake.managedbuilder.cmakeconfigure.options.debugsymbols" | ||
59 | name="%cmakeconfigure.debugsymbols" | ||
60 | isAbstract="false" | ||
61 | resourceFilter="all" | ||
62 | valueType="enumerated"> | ||
63 | <enumeratedOptionValue | ||
64 | command="-DCMAKE_BUILD_TYPE=DEBUG" | ||
65 | id="org.yocto.cmake.managedbuilder.cmakeconfigure.options.debugsymbols.eOV1" | ||
66 | isDefault="true" | ||
67 | name="Yes (-DCMAKE_BUILD_TYPE=DEBUG)"> | ||
68 | </enumeratedOptionValue> | ||
69 | <enumeratedOptionValue | ||
70 | command="" | ||
71 | id="org.yocto.cmake.managedbuilder.cmakeconfigure.options.debugsymbols.eOV2" | ||
72 | name="No"> | ||
73 | </enumeratedOptionValue> | ||
74 | </option> | ||
75 | <option | ||
76 | category="org.yocto.cmake.managedbuilder.cmakeconfigure.category.options" | ||
77 | id="org.yocto.cmake.managedbuilder.cmakeconfigure.options.verbosemakefile" | ||
78 | name="%cmakeconfigure.verbosemakefile" | ||
79 | isAbstract="false" | ||
80 | resourceFilter="all" | ||
81 | valueType="enumerated"> | ||
82 | <enumeratedOptionValue | ||
83 | command="-DCMAKE_VERBOSE_MAKEFILE=1" | ||
84 | id="org.yocto.cmake.managedbuilder.cmakeconfigure.options.verbosemakefile.eOV1" | ||
85 | isDefault="true" | ||
86 | name="Yes (-DCMAKE_VERBOSE_MAKEFILE=1)"> | ||
87 | </enumeratedOptionValue> | ||
88 | <enumeratedOptionValue | ||
89 | command="-DCMAKE_VERBOSE_MAKEFILE=0" | ||
90 | id="org.yocto.cmake.managedbuilder.cmakeconfigure.options.verbosemakefile.eOV2" | ||
91 | name="No (-DCMAKE_VERBOSE_MAKEFILE=0)"> | ||
92 | </enumeratedOptionValue> | ||
93 | </option> | ||
94 | <option | ||
95 | category="org.yocto.cmake.managedbuilder.cmakeconfigure.category.options" | ||
96 | command="-Wdev" | ||
97 | id="org.yocto.cmake.managedbuilder.cmakeconfigure.options.enabledevwarn" | ||
98 | isAbstract="false" | ||
99 | name="%cmakeconfigure.wdev" | ||
100 | resourceFilter="all" | ||
101 | valueType="boolean"> | ||
102 | </option> | ||
103 | <option | ||
104 | category="org.yocto.cmake.managedbuilder.cmakeconfigure.category.options" | ||
105 | command="-Wno-dev" | ||
106 | id="org.yocto.cmake.managedbuilder.cmakeconfigure.options.suppressdevwarn" | ||
107 | isAbstract="false" | ||
108 | name="%cmakeconfigure.wnodev" | ||
109 | resourceFilter="all" | ||
110 | valueType="boolean"> | ||
111 | </option> | ||
112 | <option | ||
113 | category="org.yocto.cmake.managedbuilder.cmakeconfigure.category.options" | ||
114 | id="org.yocto.cmake.managedbuilder.cmakeconfigure.options.otherflags" | ||
115 | isAbstract="false" | ||
116 | name="%cmakeconfigure.otherflags" | ||
117 | resourceFilter="all" | ||
118 | tip="e.g.: --warn-unused-vars --debug-output -DCMAKE_SOME_OPTION=something" | ||
119 | valueType="string"> | ||
120 | </option> | ||
121 | </tool> | ||
122 | <toolChain | ||
123 | id="org.yocto.cmake.managedbuilder.toolchain.gnu.exe" | ||
124 | name="%toolchain" | ||
125 | supportsManagedBuild="true"> | ||
126 | <targetPlatform | ||
127 | id="org.yocto.cmake.managedbuilder.target.gnu.exe" | ||
128 | isAbstract="false" | ||
129 | superClass="cdt.managedbuild.target.gnu.platform.base"> | ||
130 | </targetPlatform> | ||
131 | <builder | ||
132 | id="org.yocto.cmake.managedbuilder.builder.gnu.exe" | ||
133 | isAbstract="false" | ||
134 | isVariableCaseSensitive="false" | ||
135 | superClass="org.yocto.cmake.managedbuilder.builder"> | ||
136 | </builder> | ||
137 | <tool | ||
138 | id="org.yocto.cmake.managedbuilder.cmakeconfigure.gnu.exe" | ||
139 | isAbstract="false" | ||
140 | superClass="org.yocto.cmake.managedbuilder.cmakeconfigure"> | ||
141 | </tool> | ||
142 | <tool | ||
143 | id="org.yocto.cmake.managedbuilder.compiler.gnu.exe" | ||
144 | isAbstract="false" | ||
145 | natureFilter="ccnature" | ||
146 | superClass="cdt.managedbuild.tool.gnu.cpp.compiler"> | ||
147 | </tool> | ||
148 | <tool | ||
149 | id="org.yocto.cmake.managedbuilder.linker.gnu.exe" | ||
150 | isAbstract="false" | ||
151 | natureFilter="ccnature" | ||
152 | superClass="cdt.managedbuild.tool.gnu.cpp.linker"> | ||
153 | </tool> | ||
154 | <tool | ||
155 | id="org.yocto.cmake.managedbuilder.compiler.gnu.c.exe" | ||
156 | isAbstract="false" | ||
157 | natureFilter="cnature" | ||
158 | superClass="cdt.managedbuild.tool.gnu.c.compiler"> | ||
159 | </tool> | ||
160 | <tool | ||
161 | id="org.yocto.cmake.managedbuilder.linker.gnu.c.exe" | ||
162 | isAbstract="false" | ||
163 | natureFilter="cnature" | ||
164 | superClass="cdt.managedbuild.tool.gnu.c.linker"> | ||
165 | </tool> | ||
166 | </toolChain> | ||
167 | <projectType | ||
168 | buildArtefactType="org.yocto.sdk.ide.buildArtefact.cmake.exe" | ||
169 | id="org.yocto.sdk.ide.projectTypeCMake" | ||
170 | isAbstract="false" | ||
171 | isTest="false"> | ||
172 | <configuration | ||
173 | buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" | ||
174 | buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug" | ||
175 | cleanCommand="rm -rf" | ||
176 | description="%config.debug.description" | ||
177 | id="org.yocto.cmake.managedbuilder.configuration.gnu.exe.debug" | ||
178 | name="%config.debug.name" | ||
179 | parent="cdt.managedbuild.config.gnu.base"> | ||
180 | <toolChain | ||
181 | id="org.yocto.cmake.managedbuilder.toolchain.gnu.exe.debug" | ||
182 | superClass="org.yocto.cmake.managedbuilder.toolchain.gnu.exe" | ||
183 | supportsManagedBuild="true"> | ||
184 | <targetPlatform | ||
185 | id="org.yocto.cmake.managedbuilder.target.gnu.exe.debug" | ||
186 | isAbstract="false" | ||
187 | superClass="org.yocto.cmake.managedbuilder.target.gnu.exe"> | ||
188 | </targetPlatform> | ||
189 | <builder | ||
190 | cleanBuildTarget="clean" | ||
191 | id="org.yocto.cmake.managedbuilder.builder.gnu.exe.debug" | ||
192 | isVariableCaseSensitive="false" | ||
193 | superClass="org.yocto.cmake.managedbuilder.builder.gnu.exe"> | ||
194 | </builder> | ||
195 | <tool | ||
196 | commandLinePattern="${COMMAND} ${FLAGS} " | ||
197 | id="org.yocto.cmake.managedbuilder.cmakeconfigure.gnu.exe.debug" | ||
198 | isAbstract="false" | ||
199 | superClass="org.yocto.cmake.managedbuilder.cmakeconfigure.gnu.exe"> | ||
200 | <option | ||
201 | id="org.yocto.cmake.managedbuilder.cmakeconfigure.options.sourcepath.gnu.exe.debug" | ||
202 | isAbstract="false" | ||
203 | superClass="org.yocto.cmake.managedbuilder.cmakeconfigure.options.sourcepath"> | ||
204 | </option> | ||
205 | <option | ||
206 | id="org.yocto.cmake.managedbuilder.cmakeconfigure.options.toolchaincmakefilepath.gnu.exe.debug" | ||
207 | isAbstract="false" | ||
208 | superClass="org.yocto.cmake.managedbuilder.cmakeconfigure.options.toolchaincmakefilepath"> | ||
209 | </option> | ||
210 | <option | ||
211 | id="org.yocto.cmake.managedbuilder.cmakeconfigure.options.debugsymbols.gnu.exe.debug" | ||
212 | isAbstract="false" | ||
213 | superClass="org.yocto.cmake.managedbuilder.cmakeconfigure.options.debugsymbols"> | ||
214 | </option> | ||
215 | <option | ||
216 | id="org.yocto.cmake.managedbuilder.cmakeconfigure.options.verbosemakefile.gnu.exe.debug" | ||
217 | isAbstract="false" | ||
218 | superClass="org.yocto.cmake.managedbuilder.cmakeconfigure.options.verbosemakefile"> | ||
219 | </option> | ||
220 | <option | ||
221 | defaultValue="FALSE" | ||
222 | id="org.yocto.cmake.managedbuilder.cmakeconfigure.options.enabledevwarn.gnu.exe.debug" | ||
223 | isAbstract="false" | ||
224 | resourceFilter="all" | ||
225 | superClass="org.yocto.cmake.managedbuilder.cmakeconfigure.options.enabledevwarn" | ||
226 | valueType="boolean"> | ||
227 | </option> | ||
228 | <option | ||
229 | defaultValue="TRUE" | ||
230 | id="org.yocto.cmake.managedbuilder.cmakeconfigure.options.suppressdevwarn.gnu.exe.debug" | ||
231 | isAbstract="false" | ||
232 | resourceFilter="all" | ||
233 | superClass="org.yocto.cmake.managedbuilder.cmakeconfigure.options.suppressdevwarn" | ||
234 | valueType="boolean"> | ||
235 | </option> | ||
236 | <option | ||
237 | id="org.yocto.cmake.managedbuilder.cmakeconfigure.options.otherflags.gnu.exe.debug" | ||
238 | isAbstract="false" | ||
239 | superClass="org.yocto.cmake.managedbuilder.cmakeconfigure.options.otherflags"> | ||
240 | </option> | ||
241 | </tool> | ||
242 | <tool | ||
243 | id="org.yocto.cmake.managedbuilder.compiler.gnu.exe.debug" | ||
244 | isAbstract="false" | ||
245 | superClass="org.yocto.cmake.managedbuilder.compiler.gnu.exe"> | ||
246 | </tool> | ||
247 | <tool | ||
248 | id="org.yocto.cmake.managedbuilder.linker.gnu.exe.debug" | ||
249 | isAbstract="false" | ||
250 | superClass="org.yocto.cmake.managedbuilder.linker.gnu.exe"> | ||
251 | </tool> | ||
252 | <tool | ||
253 | id="org.yocto.cmake.managedbuilder.compiler.gnu.exe.c.debug" | ||
254 | isAbstract="false" | ||
255 | superClass="org.yocto.cmake.managedbuilder.compiler.gnu.c.exe"> | ||
256 | </tool> | ||
257 | <tool | ||
258 | id="org.yocto.cmake.managedbuilder.linker.gnu.exe.c.debug" | ||
259 | isAbstract="false" | ||
260 | superClass="org.yocto.cmake.managedbuilder.linker.gnu.c.exe"> | ||
261 | </tool> | ||
262 | </toolChain> | ||
263 | </configuration> | ||
264 | </projectType> | ||
265 | </extension> | ||
266 | <extension | ||
267 | point="org.eclipse.cdt.core.templates"> | ||
268 | <template | ||
269 | filterPattern=".*gcc" | ||
270 | id="org.yocto.cmake.managedbuilder.template.helloWorldCCMakeProject" | ||
271 | isCategory="false" | ||
272 | location="templates/projecttemplates/HelloWorldCCMakeProject/template.xml" | ||
273 | projectType="org.yocto.sdk.ide.buildArtefact.cmake.exe"> | ||
274 | </template> | ||
275 | <template | ||
276 | filterPattern=".*g\+\+" | ||
277 | id="org.yocto.cmake.managedbuilder.template.helloWorldCPPCMakeProject" | ||
278 | isCategory="false" | ||
279 | location="templates/projecttemplates/HelloWorldCPPCMakeProject/template.xml" | ||
280 | projectType="org.yocto.sdk.ide.buildArtefact.cmake.exe"> | ||
281 | </template> | ||
282 | </extension> | ||
283 | </plugin> | ||
diff --git a/plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/Activator.java b/plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/Activator.java new file mode 100644 index 0000000..6d4e28f --- /dev/null +++ b/plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/Activator.java | |||
@@ -0,0 +1,50 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2013 BMW Car IT GmbH. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * BMW Car IT - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.cmake.managedbuilder; | ||
12 | |||
13 | import org.eclipse.core.runtime.Plugin; | ||
14 | import org.osgi.framework.BundleContext; | ||
15 | |||
16 | public class Activator extends Plugin { | ||
17 | |||
18 | /** The plug-in ID. */ | ||
19 | public static final String PLUGIN_ID = "org.yocto.cmake.managedbuilder"; //$NON-NLS-1$ | ||
20 | |||
21 | /** The shared activator instance. */ | ||
22 | private static Activator plugin; | ||
23 | |||
24 | /* | ||
25 | * (non-Javadoc) | ||
26 | * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) | ||
27 | */ | ||
28 | @Override | ||
29 | public void start(BundleContext context) throws Exception { | ||
30 | super.start(context); | ||
31 | plugin = this; | ||
32 | } | ||
33 | |||
34 | /* | ||
35 | * (non-Javadoc) | ||
36 | * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) | ||
37 | */ | ||
38 | @Override | ||
39 | public void stop(BundleContext context) throws Exception { | ||
40 | plugin = null; | ||
41 | super.stop(context); | ||
42 | } | ||
43 | |||
44 | /** | ||
45 | * @return the shared instance of the Activator | ||
46 | */ | ||
47 | public static Activator getDefault() { | ||
48 | return plugin; | ||
49 | } | ||
50 | } | ||
diff --git a/plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/YoctoCMakeMakefileGenerator.java b/plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/YoctoCMakeMakefileGenerator.java new file mode 100644 index 0000000..b77ae9e --- /dev/null +++ b/plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/YoctoCMakeMakefileGenerator.java | |||
@@ -0,0 +1,281 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2013 BMW Car IT GmbH. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * BMW Car IT - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.cmake.managedbuilder; | ||
12 | |||
13 | import java.io.ByteArrayInputStream; | ||
14 | import java.io.InputStream; | ||
15 | |||
16 | import org.eclipse.cdt.managedbuilder.core.IBuilder; | ||
17 | import org.eclipse.cdt.managedbuilder.core.IConfiguration; | ||
18 | import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo; | ||
19 | import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager; | ||
20 | import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin; | ||
21 | import org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderMakefileGenerator2; | ||
22 | import org.eclipse.core.resources.IFile; | ||
23 | import org.eclipse.core.resources.IProject; | ||
24 | import org.eclipse.core.resources.IResource; | ||
25 | import org.eclipse.core.resources.IResourceDelta; | ||
26 | import org.eclipse.core.runtime.CoreException; | ||
27 | import org.eclipse.core.runtime.IPath; | ||
28 | import org.eclipse.core.runtime.IProgressMonitor; | ||
29 | import org.eclipse.core.runtime.IStatus; | ||
30 | import org.eclipse.core.runtime.MultiStatus; | ||
31 | import org.eclipse.core.runtime.jobs.Job; | ||
32 | import org.yocto.cmake.managedbuilder.job.ExecuteConfigureJob; | ||
33 | import org.yocto.sdk.ide.utils.YoctoSDKUtils; | ||
34 | |||
35 | public class YoctoCMakeMakefileGenerator implements IManagedBuilderMakefileGenerator2 { | ||
36 | |||
37 | private static final String TOOLCHAINCMAKE_FILE_NAME = "toolchain.cmake"; //$NON-NLS-1$ | ||
38 | private static final String MAKEFILE_NAME = "Makefile"; //$NON-NLS-1$ | ||
39 | private static final String CMAKE_FILE_NAME = "CMakeLists.txt"; //$NON-NLS-1$ | ||
40 | private static final String CMAKECACHE_FILE_NAME = "CMakeCache.txt"; //$NON-NLS-1$ | ||
41 | |||
42 | private IProject project; | ||
43 | private int lastBuildInfoChecksum = 0; | ||
44 | private IConfiguration configuration; | ||
45 | private IProgressMonitor monitor; | ||
46 | private IPath buildDir = null; | ||
47 | |||
48 | @Override | ||
49 | public String getMakefileName() { | ||
50 | return MAKEFILE_NAME; | ||
51 | } | ||
52 | |||
53 | @Override | ||
54 | public IPath getBuildWorkingDir() { | ||
55 | IPath buildWorkingDir = null; | ||
56 | |||
57 | if (buildDir != null) { | ||
58 | buildWorkingDir = buildDir.removeFirstSegments(1); | ||
59 | } | ||
60 | |||
61 | return buildWorkingDir; | ||
62 | } | ||
63 | |||
64 | @Override | ||
65 | public boolean isGeneratedResource(IResource resource) { | ||
66 | return false; | ||
67 | } | ||
68 | |||
69 | @Override | ||
70 | public void initialize(IProject project, IManagedBuildInfo info, | ||
71 | IProgressMonitor monitor) { | ||
72 | this.project = project; | ||
73 | this.configuration = info.getDefaultConfiguration(); | ||
74 | this.monitor = monitor; | ||
75 | |||
76 | if (info.getDefaultConfiguration() != null) { | ||
77 | buildDir = project.getFolder(info.getConfigurationName()).getFullPath(); | ||
78 | } | ||
79 | } | ||
80 | |||
81 | @Override | ||
82 | public void initialize(int buildKind, IConfiguration configuration, IBuilder builder, | ||
83 | IProgressMonitor monitor) { | ||
84 | this.project = configuration.getOwner().getProject(); | ||
85 | this.configuration = configuration; | ||
86 | this.monitor = monitor; | ||
87 | this.buildDir = project.getFolder(configuration.getName()).getFullPath(); | ||
88 | } | ||
89 | |||
90 | @Override | ||
91 | public void generateDependencies() throws CoreException { | ||
92 | // nothing to do here | ||
93 | } | ||
94 | |||
95 | @Override | ||
96 | public void regenerateDependencies(boolean force) throws CoreException { | ||
97 | generateDependencies(); | ||
98 | } | ||
99 | |||
100 | @Override | ||
101 | public MultiStatus generateMakefiles(IResourceDelta delta) | ||
102 | throws CoreException { | ||
103 | int currentBuildInfoChecksum = ManagedBuildManager.getBuildInfo(project).hashCode(); | ||
104 | |||
105 | IFile cmakeFile = project.getFile(CMAKE_FILE_NAME); | ||
106 | IResourceDelta cmakeDelta = delta.findMember(cmakeFile.getProjectRelativePath()); | ||
107 | IResourceDelta[] deltas = delta | ||
108 | .getAffectedChildren(IResourceDelta.ADDED | IResourceDelta.REMOVED); | ||
109 | |||
110 | if (deltas.length > 0 || cmakeDelta != null || currentBuildInfoChecksum != lastBuildInfoChecksum) { | ||
111 | lastBuildInfoChecksum = currentBuildInfoChecksum; | ||
112 | return regenerateMakefiles(); | ||
113 | } else { | ||
114 | // CMake is not needed to run prior to building | ||
115 | // just return that makefile generation is completed | ||
116 | return new MultiStatus( | ||
117 | ManagedBuilderCorePlugin.getUniqueIdentifier(), IStatus.OK, | ||
118 | new String(YoctoCMakeMessages.getString("YoctoCMakeMakefileGenerator.ok.makefilesStillValid")), null); //$NON-NLS-1$ | ||
119 | } | ||
120 | } | ||
121 | |||
122 | @Override | ||
123 | public MultiStatus regenerateMakefiles() throws CoreException { | ||
124 | String taskName = | ||
125 | YoctoCMakeMessages.getString("YoctoCMakeMakefileGenerator.configure.creatingMakefiles"); //$NON-NLS-1$ | ||
126 | monitor.beginTask(taskName, 20); | ||
127 | |||
128 | IFile cmakeFile = project.getFile(CMAKE_FILE_NAME); | ||
129 | if (!cmakeFile.exists()) { | ||
130 | return new MultiStatus(ManagedBuilderCorePlugin.getUniqueIdentifier(), IStatus.CANCEL, | ||
131 | new String(YoctoCMakeMessages.getString("YoctoCMakeMakefileGenerator.cancel.missingCMakeList")), null); //$NON-NLS-1$ | ||
132 | } | ||
133 | |||
134 | // Retrieve Build directory | ||
135 | IPath workingDir = getBuildWorkingDir(); | ||
136 | IPath location = project.getLocation().append(workingDir); | ||
137 | monitor.worked(1); | ||
138 | |||
139 | // Create build directory if it doesn't exist | ||
140 | if (!location.toFile().exists()) { | ||
141 | monitor.subTask( | ||
142 | YoctoCMakeMessages.getString("YoctoCMakeMakefileGenerator.creatingBuildDirectory")); //$NON-NLS-1$ | ||
143 | location.toFile().mkdirs(); | ||
144 | } else { | ||
145 | monitor.subTask( | ||
146 | YoctoCMakeMessages.getString("YoctoCMakeMakefileGenerator.removingCacheFiles")); //$NON-NLS-1$ | ||
147 | IFile cmakeCache = project.getFile(workingDir.append(CMAKECACHE_FILE_NAME)); | ||
148 | cmakeCache.delete(true, monitor); | ||
149 | } | ||
150 | monitor.setTaskName(taskName); | ||
151 | |||
152 | createToolchainCMakeFile(workingDir); | ||
153 | |||
154 | // Create the Makefiles by executing cmake | ||
155 | ExecuteConfigureJob job = | ||
156 | new ExecuteConfigureJob( | ||
157 | YoctoCMakeMessages.getString("YoctoCMakeMakefileGenerator.configureJob.name"), //$NON-NLS-1$ | ||
158 | project, configuration, location); | ||
159 | job.setPriority(Job.BUILD); | ||
160 | job.setUser(false); | ||
161 | |||
162 | job.schedule(); | ||
163 | try { | ||
164 | job.join(); | ||
165 | monitor.done(); | ||
166 | return new MultiStatus( | ||
167 | Activator.PLUGIN_ID, job.getResult().getSeverity(), | ||
168 | job.getResult().getMessage(), null); | ||
169 | } catch (InterruptedException e) { | ||
170 | return new MultiStatus( | ||
171 | Activator.PLUGIN_ID, | ||
172 | IStatus.ERROR, new String( | ||
173 | YoctoCMakeMessages.getString("YoctoCMakeMakefileGenerator.error.makeFileGenerationFailed")), null); //$NON-NLS-1$ | ||
174 | } | ||
175 | } | ||
176 | |||
177 | private String createCMakeSetStatement(String variable, String value, String cacheOption) { | ||
178 | String setStatement = "set("; //$NON-NLS-1$ | ||
179 | setStatement += variable + " " + value; //$NON-NLS-1$ | ||
180 | if(cacheOption != null && !cacheOption.equals("")) { //$NON-NLS-1$ | ||
181 | setStatement += " " + cacheOption; //$NON-NLS-1$ | ||
182 | } | ||
183 | setStatement += ")\n"; //$NON-NLS-1$ | ||
184 | return setStatement; | ||
185 | } | ||
186 | |||
187 | // Considered poky's cmake.bbclass for this method | ||
188 | private void createToolchainCMakeFile(IPath workingDir) { | ||
189 | String toolchainCMakeFileContentAsString = "# CMake system name must be something like \"Linux\".\n" + //$NON-NLS-1$ | ||
190 | "# This is important for cross-compiling.\n"; //$NON-NLS-1$ | ||
191 | |||
192 | String targetArchValue = YoctoSDKUtils.getEnvValue(project, "TARGET_ARCH"); //$NON-NLS-1$ | ||
193 | toolchainCMakeFileContentAsString += createCMakeSetStatement("CMAKE_SYSTEM_PROCESSOR", targetArchValue, null); //$NON-NLS-1$ | ||
194 | |||
195 | String oeCMakeCCompilerValue = YoctoSDKUtils.getEnvValue(project, "OECMAKE_C_COMPILER"); //$NON-NLS-1$ | ||
196 | toolchainCMakeFileContentAsString += createCMakeSetStatement("CMAKE_C_COMPILER", oeCMakeCCompilerValue, null); //$NON-NLS-1$ | ||
197 | |||
198 | String oeCMakeCXXCompilerValue = YoctoSDKUtils.getEnvValue(project, "OECMAKE_CXX_COMPILER"); //$NON-NLS-1$ | ||
199 | toolchainCMakeFileContentAsString += createCMakeSetStatement("CMAKE_CXX_COMPILER", oeCMakeCXXCompilerValue, null); //$NON-NLS-1$ | ||
200 | |||
201 | String oeCMakeCFlagsValue = YoctoSDKUtils.getEnvValue(project, "OECMAKE_C_FLAGS"); //$NON-NLS-1$ | ||
202 | toolchainCMakeFileContentAsString += createCMakeSetStatement("CMAKE_C_FLAGS", //$NON-NLS-1$ | ||
203 | "\"" + oeCMakeCFlagsValue + "\"", "CACHE STRING \"CFLAGS\""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ | ||
204 | |||
205 | String oeCMakeCXXFlagsValue = YoctoSDKUtils.getEnvValue(project, "OECMAKE_CXX_FLAGS"); //$NON-NLS-1$ | ||
206 | toolchainCMakeFileContentAsString += createCMakeSetStatement("CMAKE_CXX_FLAGS", //$NON-NLS-1$ | ||
207 | "\"" + oeCMakeCXXFlagsValue + "\"", "CACHE STRING \"CXXFLAGS\""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ | ||
208 | |||
209 | String oeCMakeCFlagsReleaseValue = YoctoSDKUtils.getEnvValue(project, "OECMAKE_C_FLAGS_RELEASE"); //$NON-NLS-1$ | ||
210 | toolchainCMakeFileContentAsString += createCMakeSetStatement("CMAKE_C_FLAGS_RELEASE", //$NON-NLS-1$ | ||
211 | "\"" + oeCMakeCFlagsReleaseValue + "\"", "CACHE STRING \"CFLAGS for release\""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ | ||
212 | |||
213 | String oeCMakeCXXFlagsReleaseValue = YoctoSDKUtils.getEnvValue(project, "OECMAKE_CXX_FLAGS_RELEASE"); //$NON-NLS-1$ | ||
214 | toolchainCMakeFileContentAsString += createCMakeSetStatement("CMAKE_CXX_FLAGS_RELEASE", //$NON-NLS-1$ | ||
215 | "\"" + oeCMakeCXXFlagsReleaseValue + "\"", "CACHE STRING \"CXXFLAGS for release\""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ | ||
216 | |||
217 | String oeCMakeCLinkFlagsValue = YoctoSDKUtils.getEnvValue(project, "OECMAKE_C_LINK_FLAGS"); //$NON-NLS-1$ | ||
218 | toolchainCMakeFileContentAsString += createCMakeSetStatement("CMAKE_C_LINK_FLAGS", //$NON-NLS-1$ | ||
219 | "\"" + oeCMakeCLinkFlagsValue + "\"", "CACHE STRING \"LDFLAGS\""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ | ||
220 | |||
221 | String oeCMakeCXXLinkFlagsValue = YoctoSDKUtils.getEnvValue(project, "OECMAKE_CXX_LINK_FLAGS"); //$NON-NLS-1$ | ||
222 | toolchainCMakeFileContentAsString += createCMakeSetStatement("CMAKE_CXX_LINK_FLAGS", //$NON-NLS-1$ | ||
223 | "\"" + oeCMakeCXXLinkFlagsValue + "\"", "CACHE STRING \"LDFLAGS\""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ | ||
224 | |||
225 | toolchainCMakeFileContentAsString += "\n"; //$NON-NLS-1$ | ||
226 | toolchainCMakeFileContentAsString += "# only search in the paths provided so cmake doesnt pick\n"; //$NON-NLS-1$ | ||
227 | toolchainCMakeFileContentAsString += "# up libraries and tools from the native build machine\n"; //$NON-NLS-1$ | ||
228 | |||
229 | String findRootPathValue = YoctoSDKUtils.getEnvValue(project, "STAGING_DIR_HOST"); //$NON-NLS-1$ | ||
230 | findRootPathValue += " "; //$NON-NLS-1$ | ||
231 | findRootPathValue += YoctoSDKUtils.getEnvValue(project, "STAGING_DIR_NATIVE"); //$NON-NLS-1$ | ||
232 | findRootPathValue += " "; //$NON-NLS-1$ | ||
233 | findRootPathValue += YoctoSDKUtils.getEnvValue(project, "CROSS_DIR"); //$NON-NLS-1$ | ||
234 | findRootPathValue += " "; //$NON-NLS-1$ | ||
235 | findRootPathValue += YoctoSDKUtils.getEnvValue(project, "OECMAKE_PERLNATIVE_DIR"); //$NON-NLS-1$ | ||
236 | findRootPathValue += " "; //$NON-NLS-1$ | ||
237 | findRootPathValue += YoctoSDKUtils.getEnvValue(project, "OECMAKE_EXTRA_ROOT_PATH"); //$NON-NLS-1$ | ||
238 | findRootPathValue += " "; //$NON-NLS-1$ | ||
239 | findRootPathValue += YoctoSDKUtils.getEnvValue(project, "EXTERNAL_TOOLCHAIN"); //$NON-NLS-1$ | ||
240 | toolchainCMakeFileContentAsString += createCMakeSetStatement("CMAKE_FIND_ROOT_PATH", findRootPathValue, null); //$NON-NLS-1$ | ||
241 | |||
242 | toolchainCMakeFileContentAsString += createCMakeSetStatement("CMAKE_FIND_ROOT_PATH_MODE_PROGRAM", "ONLY", null); //$NON-NLS-1$ //$NON-NLS-2$ | ||
243 | toolchainCMakeFileContentAsString += createCMakeSetStatement("CMAKE_FIND_ROOT_PATH_MODE_LIBRARY", "ONLY", null); //$NON-NLS-1$ //$NON-NLS-2$ | ||
244 | toolchainCMakeFileContentAsString += createCMakeSetStatement("CMAKE_FIND_ROOT_PATH_MODE_INCLUDE", "ONLY", null); //$NON-NLS-1$ //$NON-NLS-2$ | ||
245 | toolchainCMakeFileContentAsString += "\n"; //$NON-NLS-1$ | ||
246 | |||
247 | toolchainCMakeFileContentAsString += "# Use qt.conf settings\n"; //$NON-NLS-1$ | ||
248 | toolchainCMakeFileContentAsString += createCMakeSetStatement("ENV{QT_CONF_PATH}", "qt.conf", null); //$NON-NLS-1$ //$NON-NLS-2$ | ||
249 | toolchainCMakeFileContentAsString += "\n"; //$NON-NLS-1$ | ||
250 | |||
251 | toolchainCMakeFileContentAsString += "# We need to set the rpath to the correct directory as cmake does not provide any\n"; //$NON-NLS-1$ | ||
252 | toolchainCMakeFileContentAsString += "# directory as rpath by default\n"; //$NON-NLS-1$ | ||
253 | |||
254 | String oeCMakeRPathValue = YoctoSDKUtils.getEnvValue(project, "OECMAKE_RPATH"); //$NON-NLS-1$ | ||
255 | toolchainCMakeFileContentAsString += createCMakeSetStatement("CMAKE_INSTALL_RPATH", oeCMakeRPathValue, null); //$NON-NLS-1$ | ||
256 | |||
257 | toolchainCMakeFileContentAsString += "\n"; //$NON-NLS-1$ | ||
258 | toolchainCMakeFileContentAsString += "# Use native cmake modules\n"; //$NON-NLS-1$ | ||
259 | |||
260 | String stagingDatadirValue = YoctoSDKUtils.getEnvValue(project, "STAGING_DATADIR"); //$NON-NLS-1$ | ||
261 | toolchainCMakeFileContentAsString += createCMakeSetStatement("CMAKE_MODULE_PATH", //$NON-NLS-1$ | ||
262 | stagingDatadirValue + "/cmake/Modules/", null); //$NON-NLS-1$ | ||
263 | |||
264 | toolchainCMakeFileContentAsString += "\n"; //$NON-NLS-1$ | ||
265 | toolchainCMakeFileContentAsString += "# add for non /usr/lib libdir, e.g. /usr/lib64\n"; //$NON-NLS-1$ | ||
266 | toolchainCMakeFileContentAsString += createCMakeSetStatement("CMAKE_LIBRARY_PATH", //$NON-NLS-1$ | ||
267 | "${libdir} ${base_libdir}", null); //$NON-NLS-1$ | ||
268 | |||
269 | InputStream toolchainCMakeFileContent = new ByteArrayInputStream(toolchainCMakeFileContentAsString.getBytes()); | ||
270 | |||
271 | IFile toolchainCMakeFile = project.getFile(TOOLCHAINCMAKE_FILE_NAME); | ||
272 | try { | ||
273 | if (toolchainCMakeFile.exists()) { | ||
274 | toolchainCMakeFile.delete(true, monitor); | ||
275 | } | ||
276 | toolchainCMakeFile.create(toolchainCMakeFileContent, true, monitor); | ||
277 | } catch (CoreException e) { | ||
278 | e.printStackTrace(); | ||
279 | } | ||
280 | } | ||
281 | } | ||
diff --git a/plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/YoctoCMakeMessages.java b/plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/YoctoCMakeMessages.java new file mode 100644 index 0000000..1bd8b46 --- /dev/null +++ b/plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/YoctoCMakeMessages.java | |||
@@ -0,0 +1,57 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2010 Intel Corporation. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * Intel - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.cmake.managedbuilder; | ||
12 | |||
13 | import java.text.MessageFormat; | ||
14 | import java.util.MissingResourceException; | ||
15 | import java.util.ResourceBundle; | ||
16 | |||
17 | public class YoctoCMakeMessages { | ||
18 | |||
19 | private static final String RESOURCE_BUNDLE= YoctoCMakeMessages.class.getName(); | ||
20 | private static ResourceBundle fgResourceBundle; | ||
21 | static { | ||
22 | try { | ||
23 | fgResourceBundle = ResourceBundle.getBundle(RESOURCE_BUNDLE); | ||
24 | } catch (MissingResourceException x) { | ||
25 | fgResourceBundle = null; | ||
26 | } | ||
27 | } | ||
28 | |||
29 | private YoctoCMakeMessages() { | ||
30 | } | ||
31 | |||
32 | public static String getString(String key) { | ||
33 | try { | ||
34 | return fgResourceBundle.getString(key); | ||
35 | } catch (MissingResourceException e) { | ||
36 | return '!' + key + '!'; | ||
37 | } catch (NullPointerException e) { | ||
38 | return "#" + key + "#"; //$NON-NLS-1$ //$NON-NLS-2$ | ||
39 | } | ||
40 | } | ||
41 | |||
42 | /** | ||
43 | * Gets a string from the resource bundle and formats it with the argument | ||
44 | * | ||
45 | * @param key the string used to get the bundle value, must not be null | ||
46 | */ | ||
47 | public static String getFormattedString(String key, Object arg) { | ||
48 | return MessageFormat.format(getString(key), new Object[] { arg }); | ||
49 | } | ||
50 | |||
51 | /** | ||
52 | * Gets a string from the resource bundle and formats it with arguments | ||
53 | */ | ||
54 | public static String getFormattedString(String key, Object[] args) { | ||
55 | return MessageFormat.format(getString(key), args); | ||
56 | } | ||
57 | } | ||
diff --git a/plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/YoctoCMakeMessages.properties b/plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/YoctoCMakeMessages.properties new file mode 100644 index 0000000..55773ac --- /dev/null +++ b/plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/YoctoCMakeMessages.properties | |||
@@ -0,0 +1,29 @@ | |||
1 | #/******************************************************************************* | ||
2 | # * Copyright (c) 2013 BMW Car IT GmbH. | ||
3 | # * All rights reserved. This program and the accompanying materials | ||
4 | # * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | # * which accompanies this distribution, and is available at | ||
6 | # * http://www.eclipse.org/legal/epl-v10.html | ||
7 | # * | ||
8 | # * Contributors: | ||
9 | # * BMW Car IT - initial implementation | ||
10 | # *******************************************************************************/ | ||
11 | |||
12 | # Job | ||
13 | ExecuteConfigureJob.runConfigure=Running configure | ||
14 | ExecuteConfigureJob.consoleName=Configure using CMake [{0}] | ||
15 | ExecuteConfigureJob.buildingMakefile=Building Makefile | ||
16 | ExecuteConfigureJob.warning.aborted=Build of project has been aborted | ||
17 | ExecuteConfigureJob.error.couldNotStart=Build of project could not be started | ||
18 | ExecuteConfigureJob.error.buildFailed=Build of project failed | ||
19 | ExecuteConfigureJob.cmakeWarning.dialogTitle=Unable to run command "cmake" | ||
20 | ExecuteConfigureJob.cmakeWarning.dialogMessage=Please make sure that cmake is installed properly on this machine. | ||
21 | |||
22 | # File generator | ||
23 | YoctoCMakeMakefileGenerator.configureJob.name=Configuring project | ||
24 | YoctoCMakeMakefileGenerator.configure.creatingMakefiles=Generating Makefiles using CMake | ||
25 | YoctoCMakeMakefileGenerator.cancel.missingCMakeList=CMakeLists.txt file is missing | ||
26 | YoctoCMakeMakefileGenerator.creatingBuildDirectory=Creating build directory | ||
27 | YoctoCMakeMakefileGenerator.error.makeFileGenerationFailed=Makefile generation failed during configuration process | ||
28 | YoctoCMakeMakefileGenerator.ok.makefilesStillValid=Makefiles are still valid. | ||
29 | YoctoCMakeMakefileGenerator.removingCacheFiles=Removing cache files | ||
diff --git a/plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/job/ExecuteConfigureJob.java b/plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/job/ExecuteConfigureJob.java new file mode 100644 index 0000000..354d930 --- /dev/null +++ b/plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/job/ExecuteConfigureJob.java | |||
@@ -0,0 +1,186 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2013 BMW Car IT GmbH. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * BMW Car IT - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.cmake.managedbuilder.job; | ||
12 | |||
13 | import java.io.IOException; | ||
14 | import java.util.Arrays; | ||
15 | import java.util.HashMap; | ||
16 | import java.util.LinkedList; | ||
17 | import java.util.Map; | ||
18 | |||
19 | import org.eclipse.cdt.core.CCorePlugin; | ||
20 | import org.eclipse.cdt.core.envvar.IContributedEnvironment; | ||
21 | import org.eclipse.cdt.core.envvar.IEnvironmentVariable; | ||
22 | import org.eclipse.cdt.core.envvar.IEnvironmentVariableManager; | ||
23 | import org.eclipse.cdt.core.model.CoreModel; | ||
24 | import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; | ||
25 | import org.eclipse.cdt.core.settings.model.ICProjectDescription; | ||
26 | import org.eclipse.cdt.managedbuilder.core.BuildException; | ||
27 | import org.eclipse.cdt.managedbuilder.core.IConfiguration; | ||
28 | import org.eclipse.cdt.managedbuilder.core.ITool; | ||
29 | import org.eclipse.core.resources.IProject; | ||
30 | import org.eclipse.core.runtime.IPath; | ||
31 | import org.eclipse.core.runtime.IProgressMonitor; | ||
32 | import org.eclipse.core.runtime.IStatus; | ||
33 | import org.eclipse.core.runtime.Status; | ||
34 | import org.eclipse.core.runtime.jobs.Job; | ||
35 | import org.eclipse.jface.dialogs.MessageDialog; | ||
36 | import org.eclipse.swt.widgets.Display; | ||
37 | import org.eclipse.ui.console.IOConsoleOutputStream; | ||
38 | import org.yocto.cmake.managedbuilder.Activator; | ||
39 | import org.yocto.cmake.managedbuilder.YoctoCMakeMessages; | ||
40 | import org.yocto.cmake.managedbuilder.util.ConsoleUtility; | ||
41 | import org.yocto.cmake.managedbuilder.util.SystemProcess; | ||
42 | |||
43 | |||
44 | public class ExecuteConfigureJob extends Job { | ||
45 | private SystemProcess configureProcess; | ||
46 | private LinkedList<String> configureCommand; | ||
47 | private IProject project; | ||
48 | private IConfiguration configuration; | ||
49 | private IPath location; | ||
50 | |||
51 | |||
52 | public ExecuteConfigureJob(String name, | ||
53 | IProject project, IConfiguration configuration, IPath location) { | ||
54 | super(name); | ||
55 | this.project = project; | ||
56 | this.configuration = configuration; | ||
57 | this.location = location; | ||
58 | createCommands(); | ||
59 | createProcesses(); | ||
60 | } | ||
61 | |||
62 | protected void createCommands() { | ||
63 | configureCommand = new LinkedList<String>(); | ||
64 | |||
65 | ITool[] configure = configuration | ||
66 | .getToolsBySuperClassId("org.yocto.cmake.managedbuilder.cmakeconfigure.gnu.exe"); //$NON-NLS-1$ | ||
67 | |||
68 | addCommand(configure[0]); | ||
69 | |||
70 | try { | ||
71 | addFlags(configure[0]); | ||
72 | } catch (BuildException e) { | ||
73 | // ignore this exception | ||
74 | } | ||
75 | } | ||
76 | |||
77 | private void addCommand(ITool configure) { | ||
78 | String command = configuration.getToolCommand(configure); | ||
79 | configureCommand.add(command); | ||
80 | } | ||
81 | |||
82 | private void addFlags(ITool configure) throws BuildException { | ||
83 | String[] flags = configure.getToolCommandFlags( | ||
84 | project.getLocation(), location); | ||
85 | for (String flag : flags) { | ||
86 | if (flag.contains(" ")) { //$NON-NLS-1$ | ||
87 | String[] separatedFlags = flag.trim().split(" "); //$NON-NLS-1$ | ||
88 | configureCommand.addAll(Arrays.asList(separatedFlags)); | ||
89 | } else { | ||
90 | configureCommand.add(flag); | ||
91 | } | ||
92 | } | ||
93 | } | ||
94 | |||
95 | protected void createProcesses() { | ||
96 | configureProcess = | ||
97 | new SystemProcess(configureCommand, location.toFile(), getEnvVariablesAsMap(project)); | ||
98 | } | ||
99 | |||
100 | private Map<String,String> getEnvVariablesAsMap (IProject project) { | ||
101 | Map<String, String> result = new HashMap<String, String>(); | ||
102 | |||
103 | ICProjectDescription cpdesc = CoreModel.getDefault().getProjectDescription(project, true); | ||
104 | ICConfigurationDescription ccdesc = cpdesc.getActiveConfiguration(); | ||
105 | IEnvironmentVariableManager manager = CCorePlugin.getDefault().getBuildEnvironmentManager(); | ||
106 | IContributedEnvironment env = manager.getContributedEnvironment(); | ||
107 | |||
108 | for(IEnvironmentVariable var : env.getVariables(ccdesc)) { | ||
109 | result.put(var.getName(), var.getValue()); | ||
110 | } | ||
111 | |||
112 | return result; | ||
113 | } | ||
114 | |||
115 | /* (non-Javadoc) | ||
116 | * @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor) | ||
117 | */ | ||
118 | @Override | ||
119 | protected IStatus run(IProgressMonitor monitor) { | ||
120 | monitor.beginTask( | ||
121 | YoctoCMakeMessages.getString("ExecuteConfigureJob.runConfigure"), 20); //$NON-NLS-1$ | ||
122 | |||
123 | IOConsoleOutputStream cos = | ||
124 | ConsoleUtility.getConsoleOutput(YoctoCMakeMessages.getFormattedString("ExecuteConfigureJob.consoleName", //$NON-NLS-1$ | ||
125 | project.getName())); | ||
126 | monitor.worked(1); | ||
127 | |||
128 | try { | ||
129 | return buildProject(monitor, cos); | ||
130 | } catch (IOException e) { | ||
131 | if(e.getMessage().startsWith("Cannot run program \"cmake\"")) { //$NON-NLS-1$ | ||
132 | Display.getDefault().asyncExec(new Runnable() { | ||
133 | @Override | ||
134 | public void run() { | ||
135 | MessageDialog.openWarning(null, | ||
136 | YoctoCMakeMessages.getString("ExecuteConfigureJob.cmakeWarning.dialogTitle"), //$NON-NLS-1$ | ||
137 | YoctoCMakeMessages.getString("ExecuteConfigureJob.cmakeWarning.dialogMessage")); //$NON-NLS-1$ | ||
138 | } | ||
139 | }); | ||
140 | return Status.OK_STATUS; | ||
141 | } else { | ||
142 | return new Status(Status.ERROR, | ||
143 | Activator.PLUGIN_ID, Status.OK, | ||
144 | YoctoCMakeMessages.getString("ExecuteConfigureJob.error.couldNotStart"), e); //$NON-NLS-1$ | ||
145 | } | ||
146 | } catch (InterruptedException e) { | ||
147 | return new Status(Status.WARNING, | ||
148 | Activator.PLUGIN_ID, | ||
149 | YoctoCMakeMessages.getString("ExecuteConfigureJob.warning.aborted")); //$NON-NLS-1$ | ||
150 | } finally { | ||
151 | try { | ||
152 | cos.close(); | ||
153 | } catch (IOException e) { | ||
154 | cos = null; | ||
155 | } | ||
156 | } | ||
157 | } | ||
158 | |||
159 | private IStatus buildProject(IProgressMonitor monitor, | ||
160 | IOConsoleOutputStream cos) throws IOException, InterruptedException { | ||
161 | monitor.subTask( | ||
162 | YoctoCMakeMessages.getString("ExecuteConfigureJob.buildingMakefile")); //$NON-NLS-1$ | ||
163 | configureProcess.start(cos); | ||
164 | int exitValue = configureProcess.waitForResultAndStop(); | ||
165 | monitor.worked(15); | ||
166 | |||
167 | if (exitValue != 0) { | ||
168 | return new Status(Status.ERROR, Activator.PLUGIN_ID, | ||
169 | YoctoCMakeMessages.getString("ExecuteConfigureJob.error.buildFailed") + " " + exitValue); //$NON-NLS-1$ //$NON-NLS-2$ | ||
170 | } | ||
171 | |||
172 | return Status.OK_STATUS; | ||
173 | } | ||
174 | |||
175 | /* (non-Javadoc) | ||
176 | * @see org.eclipse.core.runtime.jobs.Job#canceling() | ||
177 | */ | ||
178 | /** | ||
179 | * Cancels the job and interrupts the system process. | ||
180 | * {@inheritDoc} | ||
181 | */ | ||
182 | @Override | ||
183 | protected void canceling() { | ||
184 | configureProcess.interrupt(); | ||
185 | } | ||
186 | } | ||
diff --git a/plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/util/ConsoleUtility.java b/plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/util/ConsoleUtility.java new file mode 100644 index 0000000..9fb31e5 --- /dev/null +++ b/plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/util/ConsoleUtility.java | |||
@@ -0,0 +1,49 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2013 BMW Car IT GmbH. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * BMW Car IT - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.cmake.managedbuilder.util; | ||
12 | |||
13 | import org.eclipse.ui.console.ConsolePlugin; | ||
14 | import org.eclipse.ui.console.IConsole; | ||
15 | import org.eclipse.ui.console.IOConsoleOutputStream; | ||
16 | import org.eclipse.ui.console.MessageConsole; | ||
17 | |||
18 | |||
19 | public class ConsoleUtility { | ||
20 | |||
21 | public static IOConsoleOutputStream getConsoleOutput(String consoleName) { | ||
22 | return getConsole(consoleName).newOutputStream(); | ||
23 | } | ||
24 | |||
25 | public static MessageConsole getConsole(String consoleName) { | ||
26 | MessageConsole foundConsole = findConsole(consoleName); | ||
27 | if (foundConsole != null) { | ||
28 | foundConsole.clearConsole(); | ||
29 | } else { | ||
30 | foundConsole = new MessageConsole(consoleName, null); | ||
31 | ConsolePlugin.getDefault(). | ||
32 | getConsoleManager().addConsoles(new IConsole[] { foundConsole }); | ||
33 | } | ||
34 | |||
35 | return foundConsole; | ||
36 | } | ||
37 | |||
38 | public static MessageConsole findConsole(String consoleName) { | ||
39 | IConsole[] consoles = | ||
40 | ConsolePlugin.getDefault().getConsoleManager().getConsoles(); | ||
41 | for (IConsole console : consoles) { | ||
42 | if (console.getName().equals(consoleName)) { | ||
43 | return (MessageConsole) console; | ||
44 | } | ||
45 | } | ||
46 | |||
47 | return null; | ||
48 | } | ||
49 | } | ||
diff --git a/plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/util/SystemProcess.java b/plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/util/SystemProcess.java new file mode 100644 index 0000000..9ca6e60 --- /dev/null +++ b/plugins/org.yocto.cmake.managedbuilder/src/org/yocto/cmake/managedbuilder/util/SystemProcess.java | |||
@@ -0,0 +1,118 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2013 BMW Car IT GmbH. | ||
3 | * All rights reserved. This program and the accompanying materials | ||
4 | * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | * which accompanies this distribution, and is available at | ||
6 | * http://www.eclipse.org/legal/epl-v10.html | ||
7 | * | ||
8 | * Contributors: | ||
9 | * BMW Car IT - initial API and implementation | ||
10 | *******************************************************************************/ | ||
11 | package org.yocto.cmake.managedbuilder.util; | ||
12 | |||
13 | import java.io.File; | ||
14 | import java.io.IOException; | ||
15 | import java.io.InputStream; | ||
16 | import java.io.OutputStream; | ||
17 | import java.util.LinkedList; | ||
18 | import java.util.Map; | ||
19 | |||
20 | public class SystemProcess { | ||
21 | |||
22 | private LinkedList<String> command = new LinkedList<String>(); | ||
23 | private File workingDirectory; | ||
24 | private ProcessBuilder builder; | ||
25 | private Process process; | ||
26 | private StreamPipe outputRedirector; | ||
27 | |||
28 | public SystemProcess(LinkedList<String> command) { | ||
29 | this(command, null); | ||
30 | } | ||
31 | |||
32 | public SystemProcess(LinkedList<String> command, File directory) { | ||
33 | this(command, directory, null); | ||
34 | } | ||
35 | |||
36 | public SystemProcess(LinkedList<String> command, File directory, Map<String, String> additionalEnvironmentVariables) { | ||
37 | super(); | ||
38 | this.command = command; | ||
39 | if (directory != null) { | ||
40 | this.workingDirectory = directory; | ||
41 | } | ||
42 | setUpProcessBuilder(additionalEnvironmentVariables); | ||
43 | } | ||
44 | |||
45 | private void setUpProcessBuilder(Map<String, String> additionalEnvironmentVariables) { | ||
46 | builder = new ProcessBuilder(command); | ||
47 | if (workingDirectory != null) { | ||
48 | builder.directory(workingDirectory); | ||
49 | } | ||
50 | builder.redirectErrorStream(true); | ||
51 | |||
52 | if(additionalEnvironmentVariables != null && !additionalEnvironmentVariables.isEmpty()) { | ||
53 | builder.environment().putAll(additionalEnvironmentVariables); | ||
54 | } | ||
55 | } | ||
56 | |||
57 | public void start(OutputStream out) throws IOException { | ||
58 | if (builder != null) { | ||
59 | process = builder.start(); | ||
60 | outputRedirector = redirectOutput(process, out); | ||
61 | } | ||
62 | } | ||
63 | |||
64 | public int waitForResultAndStop() throws InterruptedException { | ||
65 | if (process == null) { | ||
66 | return -1; | ||
67 | } | ||
68 | |||
69 | process.waitFor(); | ||
70 | outputRedirector.interrupt(); | ||
71 | |||
72 | return process.exitValue(); | ||
73 | } | ||
74 | |||
75 | public void interrupt() { | ||
76 | process.destroy(); | ||
77 | } | ||
78 | |||
79 | private StreamPipe redirectOutput(Process process, OutputStream out) { | ||
80 | InputStream in = process.getInputStream(); | ||
81 | StreamPipe stdoutPipe = new StreamPipe(in, out); | ||
82 | stdoutPipe.start(); | ||
83 | |||
84 | return stdoutPipe; | ||
85 | } | ||
86 | |||
87 | |||
88 | private class StreamPipe extends Thread { | ||
89 | private InputStream in; | ||
90 | private OutputStream out; | ||
91 | boolean shutdown = false; | ||
92 | |||
93 | public StreamPipe(InputStream in, OutputStream out) { | ||
94 | this.in = in; | ||
95 | this.out = out; | ||
96 | } | ||
97 | |||
98 | @Override | ||
99 | public void run() { | ||
100 | byte[] buffer = new byte[1024]; | ||
101 | int length = 0; | ||
102 | |||
103 | try { | ||
104 | while(!shutdown && ((length = in.read(buffer)) > -1)) { | ||
105 | out.write(buffer, 0, length); | ||
106 | } | ||
107 | } catch (IOException e) { | ||
108 | e.printStackTrace(); | ||
109 | } | ||
110 | } | ||
111 | |||
112 | @Override | ||
113 | public void interrupt() { | ||
114 | shutdown = true; | ||
115 | super.interrupt(); | ||
116 | } | ||
117 | } | ||
118 | } | ||
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 @@ | |||
1 | cmake_minimum_required (VERSION 2.8.1) | ||
2 | |||
3 | ######## Project settings ######## | ||
4 | PROJECT($(projectName)) | ||
5 | SET(LICENSE "TBD") | ||
6 | |||
7 | ######## Build and include settings ######## | ||
8 | include_directories( | ||
9 | inc | ||
10 | ) | ||
11 | |||
12 | link_directories( | ||
13 | ${LINK_DIRECTORIES} | ||
14 | ) | ||
15 | |||
16 | |||
17 | file(GLOB SOURCES | ||
18 | "src/*.c" | ||
19 | ) | ||
20 | |||
21 | add_executable( | ||
22 | $(projectName) | ||
23 | |||
24 | ${SOURCES} | ||
25 | ) | ||
26 | |||
27 | TARGET_LINK_LIBRARIES( | ||
28 | $(projectName) | ||
29 | ) | ||
30 | |||
31 | ######## Install targets ######## | ||
32 | INSTALL(TARGETS $(projectName) | ||
33 | RUNTIME DESTINATION usr/bin | ||
34 | ) | ||
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 @@ | |||
1 | /** @mainpage $(projectName) - $(vendor) | ||
2 | * | ||
3 | * @author $(author) <$(email)> | ||
4 | * @version $(projectVersion) | ||
5 | **/ | ||
6 | |||
7 | |||
8 | #include <stdio.h> | ||
9 | /** | ||
10 | * Main class of project $(projectName) | ||
11 | * | ||
12 | * @param argc the number of arguments | ||
13 | * @param argv the arguments from the commandline | ||
14 | * @returns exit code of the application | ||
15 | */ | ||
16 | int main(int argc, char **argv) { | ||
17 | // print a greeting to the console | ||
18 | printf("Hello World!\n"); | ||
19 | |||
20 | return 0; | ||
21 | } | ||
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 @@ | |||
1 | #/******************************************************************************* | ||
2 | # * Copyright (c) 2013 BMW Car IT GmbH. | ||
3 | # * All rights reserved. This program and the accompanying materials | ||
4 | # * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | # * which accompanies this distribution, and is available at | ||
6 | # * http://www.eclipse.org/legal/epl-v10.html | ||
7 | # * | ||
8 | # * Contributors: | ||
9 | # * BMW Car IT - initial implementation | ||
10 | # *******************************************************************************/ | ||
11 | |||
12 | # Template | ||
13 | template.vendor=Yocto Project | ||
14 | template.name=Hello World C CMake Project | ||
15 | template.description=A simple C hello world project based on CMake | ||
16 | |||
17 | # General Settings | ||
18 | general.name=General settings | ||
19 | general.description=Author properties of the project | ||
20 | general.author.name=Author | ||
21 | general.author.description=The author of the project | ||
22 | general.author.default=anonymous | ||
23 | general.email.name=Email address | ||
24 | general.email.description=The email address of the project's author | ||
25 | general.email.default=anony@mo.us | ||
26 | general.vendor.name=Vendor | ||
27 | general.vendor.description=The vendor of the project | ||
28 | general.vendor.default=None | ||
29 | general.projectVersion.name=Version | ||
30 | general.projectVersion.description=The version of the project | ||
31 | 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 @@ | |||
1 | <?xml version="1.0" encoding="ISO-8859-1"?> | ||
2 | <template type="ProjTempl" | ||
3 | version="1.0" supplier="%template.vendor" revision="1.0" author="Atanas Gegov" | ||
4 | id="org.yocto.cmake.template.exe.helloWorldCCMakeProject" label="%template.name" | ||
5 | description="%template.description"> | ||
6 | |||
7 | <property-group id="general_settings" label="%general.name" | ||
8 | description="%general.description" type="PAGES-ONLY"> | ||
9 | <property id="author" label="%general.author.name" description="%general.author.description" | ||
10 | default="%general.author.default" type="input" hidden="false" mandatory="false" | ||
11 | persist="true" /> | ||
12 | |||
13 | <property id="email" label="%general.email.name" | ||
14 | description="%general.email.description" default="%general.email.default" | ||
15 | type="input" hidden="false" mandatory="false" persist="true" /> | ||
16 | |||
17 | <property id="vendor" label="%general.vendor.name" | ||
18 | description="%general.vendor.description" default="%general.vendor.default" | ||
19 | type="input" hidden="false" mandatory="false" persist="true" /> | ||
20 | |||
21 | <property id="projectVersion" label="%general.projectVersion.name" | ||
22 | description="%general.projectVersion.description" checkproject="false" | ||
23 | default="%general.projectVersion.default" type="input" | ||
24 | pattern="([0-9]\.){2}[0-9]" hidden="false" mandatory="false" persist="true" /> | ||
25 | </property-group> | ||
26 | |||
27 | <process type="org.yocto.sdk.ide.NewYoctoProject"> | ||
28 | <simple name="name" value="$(projectName)" /> | ||
29 | <simple name="artifactExtension" value="exe" /> | ||
30 | <simple name="isCProject" value="true" /> | ||
31 | <simple name="isEmptyProject" value="false" /> | ||
32 | <simple name="isAutotoolsProject" value="false" /> | ||
33 | <simple name="isCMakeProject" value="true" /> | ||
34 | </process> | ||
35 | |||
36 | <process type="org.eclipse.cdt.core.CreateSourceFolder"> | ||
37 | <simple name="projectName" value="$(projectName)" /> | ||
38 | <simple name="path" value="src" /> | ||
39 | </process> | ||
40 | |||
41 | <process type="org.eclipse.cdt.managedbuilder.core.CreateIncludeFolder"> | ||
42 | <simple name="projectName" value="$(projectName)" /> | ||
43 | <simple name="path" value="inc" /> | ||
44 | </process> | ||
45 | |||
46 | <process type="org.eclipse.cdt.core.AddFiles"> | ||
47 | <simple name="projectName" value="$(projectName)" /> | ||
48 | <complex-array name="files"> | ||
49 | <element> | ||
50 | <simple name="source" value="src/main.c" /> | ||
51 | <simple name="target" value="src/main.c" /> | ||
52 | <simple name="replaceable" value="true" /> | ||
53 | </element> | ||
54 | <element> | ||
55 | <simple name="source" value="src/CMakeLists.txt" /> | ||
56 | <simple name="target" value="CMakeLists.txt" /> | ||
57 | <simple name="replaceable" value="true" /> | ||
58 | </element> | ||
59 | </complex-array> | ||
60 | </process> | ||
61 | </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 @@ | |||
1 | cmake_minimum_required (VERSION 2.8.1) | ||
2 | |||
3 | ######## Project settings ######## | ||
4 | PROJECT($(projectName)) | ||
5 | SET(LICENSE "TBD") | ||
6 | |||
7 | ######## Build and include settings ######## | ||
8 | include_directories( | ||
9 | inc | ||
10 | ) | ||
11 | |||
12 | link_directories( | ||
13 | ${LINK_DIRECTORIES} | ||
14 | ) | ||
15 | |||
16 | |||
17 | file(GLOB SOURCES | ||
18 | "src/*.cpp" | ||
19 | ) | ||
20 | |||
21 | add_executable( | ||
22 | $(projectName) | ||
23 | |||
24 | ${SOURCES} | ||
25 | ) | ||
26 | |||
27 | TARGET_LINK_LIBRARIES( | ||
28 | $(projectName) | ||
29 | ) | ||
30 | |||
31 | ######## Install targets ######## | ||
32 | INSTALL(TARGETS $(projectName) | ||
33 | RUNTIME DESTINATION usr/bin | ||
34 | ) | ||
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 @@ | |||
1 | /** @mainpage $(projectName) - $(vendor) | ||
2 | * | ||
3 | * @author $(author) <$(email)> | ||
4 | * @version $(projectVersion) | ||
5 | **/ | ||
6 | |||
7 | |||
8 | #include <stdio.h> | ||
9 | /** | ||
10 | * Main class of project $(projectName) | ||
11 | * | ||
12 | * @param argc the number of arguments | ||
13 | * @param argv the arguments from the commandline | ||
14 | * @returns exit code of the application | ||
15 | */ | ||
16 | int main(int argc, char **argv) { | ||
17 | // print a greeting to the console | ||
18 | printf("Hello World!\n"); | ||
19 | |||
20 | return 0; | ||
21 | } | ||
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 @@ | |||
1 | #/******************************************************************************* | ||
2 | # * Copyright (c) 2013 BMW Car IT GmbH. | ||
3 | # * All rights reserved. This program and the accompanying materials | ||
4 | # * are made available under the terms of the Eclipse Public License v1.0 | ||
5 | # * which accompanies this distribution, and is available at | ||
6 | # * http://www.eclipse.org/legal/epl-v10.html | ||
7 | # * | ||
8 | # * Contributors: | ||
9 | # * BMW Car IT - initial implementation | ||
10 | # *******************************************************************************/ | ||
11 | |||
12 | # Template | ||
13 | template.vendor=Yocto Project | ||
14 | template.name=Hello World C++ CMake Project | ||
15 | template.description=A simple C++ hello world project based on CMake | ||
16 | |||
17 | # General Settings | ||
18 | general.name=General settings | ||
19 | general.description=Author properties of the project | ||
20 | general.author.name=Author | ||
21 | general.author.description=The author of the project | ||
22 | general.author.default=anonymous | ||
23 | general.email.name=Email address | ||
24 | general.email.description=The email address of the project's author | ||
25 | general.email.default=anony@mo.us | ||
26 | general.vendor.name=Vendor | ||
27 | general.vendor.description=The vendor of the project | ||
28 | general.vendor.default=None | ||
29 | general.projectVersion.name=Version | ||
30 | general.projectVersion.description=The version of the project | ||
31 | 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 @@ | |||
1 | <?xml version="1.0" encoding="ISO-8859-1"?> | ||
2 | <template type="ProjTempl" | ||
3 | version="1.0" supplier="%template.vendor" revision="1.0" author="Atanas Gegov" | ||
4 | id="org.yocto.cmake.template.exe.helloWorldCPPCMakeProject" label="%template.name" | ||
5 | description="%template.description"> | ||
6 | |||
7 | <property-group id="general_settings" label="%general.name" | ||
8 | description="%general.description" type="PAGES-ONLY"> | ||
9 | <property id="author" label="%general.author.name" description="%general.author.description" | ||
10 | default="%general.author.default" type="input" hidden="false" mandatory="false" | ||
11 | persist="true" /> | ||
12 | |||
13 | <property id="email" label="%general.email.name" | ||
14 | description="%general.email.description" default="%general.email.default" | ||
15 | type="input" hidden="false" mandatory="false" persist="true" /> | ||
16 | |||
17 | <property id="vendor" label="%general.vendor.name" | ||
18 | description="%general.vendor.description" default="%general.vendor.default" | ||
19 | type="input" hidden="false" mandatory="false" persist="true" /> | ||
20 | |||
21 | <property id="projectVersion" label="%general.projectVersion.name" | ||
22 | description="%general.projectVersion.description" checkproject="false" | ||
23 | default="%general.projectVersion.default" type="input" | ||
24 | pattern="([0-9]\.){2}[0-9]" hidden="false" mandatory="false" persist="true" /> | ||
25 | </property-group> | ||
26 | |||
27 | <process type="org.yocto.sdk.ide.NewYoctoProject"> | ||
28 | <simple name="name" value="$(projectName)" /> | ||
29 | <simple name="artifactExtension" value="exe" /> | ||
30 | <simple name="isCProject" value="false" /> | ||
31 | <simple name="isEmptyProject" value="false" /> | ||
32 | <simple name="isAutotoolsProject" value="false" /> | ||
33 | <simple name="isCMakeProject" value="true" /> | ||
34 | </process> | ||
35 | |||
36 | <process type="org.eclipse.cdt.core.CreateSourceFolder"> | ||
37 | <simple name="projectName" value="$(projectName)" /> | ||
38 | <simple name="path" value="src" /> | ||
39 | </process> | ||
40 | |||
41 | <process type="org.eclipse.cdt.managedbuilder.core.CreateIncludeFolder"> | ||
42 | <simple name="projectName" value="$(projectName)" /> | ||
43 | <simple name="path" value="inc" /> | ||
44 | </process> | ||
45 | |||
46 | <process type="org.eclipse.cdt.core.AddFiles"> | ||
47 | <simple name="projectName" value="$(projectName)" /> | ||
48 | <complex-array name="files"> | ||
49 | <element> | ||
50 | <simple name="source" value="src/main.cpp" /> | ||
51 | <simple name="target" value="src/main.cpp" /> | ||
52 | <simple name="replaceable" value="true" /> | ||
53 | </element> | ||
54 | <element> | ||
55 | <simple name="source" value="src/CMakeLists.txt" /> | ||
56 | <simple name="target" value="CMakeLists.txt" /> | ||
57 | <simple name="replaceable" value="true" /> | ||
58 | </element> | ||
59 | </complex-array> | ||
60 | </process> | ||
61 | </template> | ||