mtbuild 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 47891c77240ca894e08fc7365e6061070f2cfe04
4
+ data.tar.gz: debe5f278d337539a7823630ac23a0a7bf667869
5
+ SHA512:
6
+ metadata.gz: b32992c59c8222a1ba40ade766e381d98b88e3eac078ee49cd7a336f0af17c02d3f7c6903eba7563c742816f708d436133ce555577116f98b4b50ccca4357b64
7
+ data.tar.gz: baf679c93b1aa348a2d9cc40d1992b895bf0fa6e3a856354f0bf2a3294c5c1291170ff875fbf0658cd6a3419b7408083ae0b7fec6272cc81ba0cd9a067dec890
data/LICENSE.md ADDED
@@ -0,0 +1,27 @@
1
+ Copyright (c) 2014, MindTribe Product Engineering, Inc.
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without
5
+ modification, are permitted provided that the following conditions are met:
6
+
7
+ 1. Redistributions of source code must retain the above copyright notice, this
8
+ list of conditions and the following disclaimer.
9
+
10
+ 2. Redistributions in binary form must reproduce the above copyright notice,
11
+ this list of conditions and the following disclaimer in the documentation
12
+ and/or other materials provided with the distribution.
13
+
14
+ 3. Neither the name of the copyright holder nor the names of its contributors
15
+ may be used to endorse or promote products derived from this software
16
+ without specific prior written permission.
17
+
18
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
data/README.md ADDED
@@ -0,0 +1,528 @@
1
+ # MTBuild #
2
+
3
+ MTBuild is MindTribe's Rake-based build system for building C/C++ projects.
4
+
5
+ MTBuild lives here: https://github.com/MindTribe/MTBuild
6
+
7
+ ## Quick Start ##
8
+
9
+ ### Installation ###
10
+
11
+ MTBuild is distributed as a gem. Install it with:
12
+
13
+ ```Shell
14
+ gem install mtbuild
15
+ ```
16
+
17
+ To build with MTBuild, switch to a folder containing a rakefile and run:
18
+
19
+ ```Shell
20
+ mtbuild
21
+ ```
22
+
23
+ To install from source, clone the [MTBuild repository](https://github.com/MindTribe/MTBuild) and run the following:
24
+
25
+ ```Shell
26
+ rake install
27
+ ```
28
+
29
+ ### Getting Started ###
30
+
31
+ Here's an example of a very simple Rakefile.rb that defines an MTBuild project:
32
+
33
+ ```Ruby
34
+ application_project :MyApp, File.dirname(__FILE__) do |app|
35
+
36
+ app.add_configuration :Debug,
37
+ sources: ['src/*.c'],
38
+ toolchain: toolchain(:arm_none_eabi_gcc,
39
+ cppflags: "-Dgcc",
40
+ cflags: '-std=c99 -mcpu=cortex-m4 -mthumb -mlittle-endian -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections -Wall -Werror -Wextra -pedantic-errors',
41
+ cxxflags: '-std=c++03 -mcpu=cortex-m4 -mthumb -mlittle-endian -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections -Wall -Werror -Wextra -pedantic-errors',
42
+ ldflags: '-Wl,--entry,ResetISR -Wl,--gc-sections',
43
+ linker_script: 'src/LinkerFile-Debug.ld'
44
+ )
45
+
46
+ app.add_default_tasks('MyApp:Debug')
47
+
48
+ end
49
+ ```
50
+
51
+ This Rakefile builds an application called "MyApp" (```application_project :MyApp```).
52
+
53
+ The project folder is set to the Rakefile's containing folder (```File.dirname(__FILE__)```). All folder references in the Rakefile are relative to this folder.
54
+
55
+ The MyApp project has one configuration called "Debug" (```app.add_configuration :Debug,```).
56
+
57
+ The Debug configuration builds all C files in the "src" folder (```sources: ['src/*.c'],```).
58
+
59
+ The Debug configuration builds with the ARM toolchain (```toolchain: toolchain(:arm_none_eabi_gcc,```)
60
+
61
+ The ARM toolchain should use the specified C Preprocessor flags for all compilation and link steps (```cppflags: ...```)
62
+
63
+ The ARM toolchain should use the specified C flags when compiling C files (```cflags: ...```)
64
+
65
+ The ARM toolchain should use the specified C++ flags when compiling C++ files (```cxxflags: ...```)
66
+
67
+ The ARM toolchain should use the specified linker flags when linking (```ldflags: ...```)
68
+
69
+ The ARM toolchain should use the specified linker script when linking (```linker_script: ...```)
70
+
71
+ When invoked with no parameters, MTBuild will build the Debug configuration of MyApp by default (```app.add_default_tasks('MyApp:Debug')```)
72
+
73
+ You can find more project examples here: [MTBuild examples](https://github.com/MindTribe/MTBuild/tree/master/examples)
74
+
75
+ ## Documentation ##
76
+
77
+ ### MTBuild Goals ###
78
+
79
+ 1. With reasonable syntax (for example, XML is not considered reasonable here), allow a developer to define projects and workspaces that can be built from the command-line.
80
+ 2. Allow developers to easily incorporate cross-compilers.
81
+ 3. Allow developers to easily define multiple configurations for projects intended for multiple targets.
82
+ 4. Support unit and integration testing with command line build and execution.
83
+ 5. Opine on project structure, but allow exceptions where needed.
84
+ 6. Leverage an existing build system's infrastructure and ecosystem.
85
+
86
+ ### MTBuild Concepts ###
87
+
88
+ #### Project Structure ####
89
+
90
+ MTBuild is opinionated in that it is easy to describe our preferred project structure using MTBuild's domain-specific language. Because MTBuild uses Rake, other structures are possible but more difficult to describe.
91
+
92
+ Here is an example of our preferred structure for a complex application that is broken into one or more libraries plus the application itself:
93
+
94
+ ```
95
+ Workspace Folder
96
+ ├ Rakefile.rb <-- workspace Rakefile
97
+ ├ Library Project Folder
98
+ │ ├ Rakefile.rb <-- project Rakefile
99
+ │ ├ include <-- public headers
100
+ │ │ └ *.h
101
+ │ ├ src <-- private headers and source
102
+ │ │ └ *.h/*.c/*.cpp
103
+ │ └ test <-- unit tests
104
+ │ └ *.c/*.cpp
105
+ └ Application Project Folder
106
+ ├ Rakefile.rb <-- project Rakefile
107
+ ├ src <-- headers and source
108
+ │ └ *.h/*.c/*.cpp
109
+ └ test <-- unit tests
110
+ └ *.h/*.c/*.cpp
111
+ ```
112
+
113
+ In this case, we have a top-level workspace folder that contains projects in sub-folders. The project folders have public headers and source files neatly separated. Unit Test files are either located in their own folders, or separated by language--for example, if our project is written in C, but our unit tests are C++, we might put the unit test files alongside the project sources for convenience.
114
+
115
+ Here is an example of a simpler application that is self-contained:
116
+
117
+ ```
118
+ Application Project Folder
119
+ ├ Rakefile.rb <-- project+workspace Rakefile
120
+ ├ src <-- headers and source
121
+ │ └ *.h/*.c/*.cpp
122
+ └ test <-- unit tests
123
+ └ *.h/*.c/*.cpp
124
+ ```
125
+
126
+ In this case, the project and (optional) workspace are defined in a single Rakefile. There are no public headers, so everything goes into the "src" folder, but tests might still be separated into a "test" folder.
127
+
128
+ #### Rakefiles ####
129
+
130
+ MTBuild uses Rake. MTBuild projects and workspaces are defined using Rakefiles. MTBuild offers new syntax to learn for defining projects and workspaces, but this syntax simply results in the generation of standard Rake tasks. Therefore, Rake is highly leveraged--if you encounter a build scenario that MTBuild doesn't quite handle, you can usually drop down to the Rake level and make it work.
131
+
132
+ #### Building ####
133
+
134
+ Building is as simple as invoking ```mtbuild``` in a folder containing a Rakefile. Under the hood, MTBuild pulls in the MTBuild infrastructure and then invokes Rake. It is possible to run MTBuild on a Rakefile that contains no MTBuild-specific syntax. It's also possible to run ```rake``` instead of ```mtbuild``` on a Rakefile that does include MTBuild-specific syntax; however, that Rakefile would need to ```require 'mtbuild'``` in order to work with the ```rake``` command. We recommend that you use the ```mtbuild``` command to build MTBuild projects.
135
+
136
+ #### Project Hierarchy ####
137
+
138
+ The MTBuild project hierarchy looks roughly like this:
139
+
140
+ ```
141
+ Workspace
142
+ ├ Project1
143
+ │ ├ Configuration1
144
+ │ └ Configuration2
145
+ └ Project2
146
+ ├ Configuration1
147
+ └ Configuration2
148
+ ```
149
+
150
+ #### Projects ####
151
+
152
+ MTBuild currently defines three types of projects.
153
+
154
+ ##### Application Project #####
155
+
156
+ An application project defines one or more configurations that contain settings for building an executable application. This project type generates Rake tasks for compiling source files and linking them, along with external libraries, into an executable.
157
+
158
+ ##### Library Project #####
159
+
160
+ A library project defines one or more configurations that contain settings for building a static library. This project type generates Rake tasks for compiling source files and archiving them into a static library container.
161
+
162
+ ##### Test Application Project #####
163
+
164
+ A test application project defines one or more configurations that contain settings for building an executable application that is executed after building. This project type generates Rake tasks for compiling source files, linking them into an executable, and then running the executable. This is intended for building and running unit tests as part of the build process.
165
+
166
+ #### Configurations ####
167
+
168
+ A configuration containa build settings for a project. This includes source files, toolchain, dependencies, etc. By defining multiple configurations, a project can be built for different processors (ARM, x86, etc.), different platforms, or simply different settings (debug vs. release). Configurations generate the actual Rake tasks that begin doing work. They are named with a fixed convention that allows you to refer to them in other Rake tasks. The naming scheme is "Project:Configuration". For example, if you declare a project called "MyLibrary" with configuration "Debug", you could list "MyLibrary:Debug" as a dependency in any Rake task and "MyLibrary:Debug" would be built before that task.
169
+
170
+ #### Workspaces ####
171
+
172
+ An MTBuild workspace contains MTBuild projects and can provide default settings for configurations within those projects. For example, a project configuration can specify source code files, but omit toolchain settings. A workspace could then provide default toolchain settings that the project inherits.
173
+
174
+ MTBuild workspaces are optional. It's possible to build an MTBuild project by itself--assuming the project provides all settings required to build & isn't relying on a workspace to provide those.
175
+
176
+ MTBuild builds only the first workspace it finds. If a workspace includes a project that provides its own workspace, the project's workspace is ignored and the higher-level workspace is used. This allows projects--such as libraries--to be built by themselves or included in other workspaces while allowing the workspace to define toolchain settings.
177
+
178
+ ###### Simple Workspace Example #####
179
+
180
+ Rakefile.rb:
181
+
182
+ This defines a workspace that includes the "MyLibrary" and "MyApp" projects. The projects are presumed to be defined in their own Rakefiles inside sub-folders called "MyLibrary" and "MyApp":
183
+
184
+ ```Ruby
185
+ workspace :AppWithLibrary, File.dirname(__FILE__) do |w|
186
+ w.add_project('MyLibrary')
187
+ w.add_project('MyApp')
188
+ end
189
+ ```
190
+
191
+ ###### Project Plus Workspace Example #####
192
+
193
+ Rakefile.rb:
194
+
195
+ This defines a workspace that includes the MyLibrary project, which is defined in the same Rakefile. When a project is defined in the same Rakefile, it does not need to be explicitly added to the workspace (in this particular example, the workspace isn't very useful):
196
+
197
+ ```Ruby
198
+ workspace :MyWorkspace, File.dirname(__FILE__) do |w|
199
+ end
200
+
201
+ static_library_project :MyLibrary, File.dirname(__FILE__) do |lib|
202
+ lib.add_configuration :Debug,
203
+ sources: ['src/**/*.c'],
204
+ toolchain: toolchain(:gcc,
205
+ cflags: '-std=c99',
206
+ )
207
+ api_headers: 'include'
208
+ end
209
+ ```
210
+
211
+ ###### Project Plus Workspace With Defaults Example #####
212
+
213
+ Rakefile.rb:
214
+
215
+ This defines a workspace that includes the MyLibrary project, which is defined in the same Rakefile. The workspace provides a default toolchain for the "Debug" configuration. A higher-level workspace would override this with its own defaults:
216
+
217
+ ```Ruby
218
+ workspace :MyLibrary, File.dirname(__FILE__) do |w|
219
+ w.set_configuration_defaults :Debug,
220
+ toolchain: toolchain(:gcc,
221
+ cflags: '-std=c99',
222
+ )
223
+ end
224
+
225
+ static_library_project :MyLibrary, File.dirname(__FILE__) do |lib|
226
+ lib.add_configuration :Debug,
227
+ sources: ['src/**/*.c'],
228
+ api_headers: 'include'
229
+ end
230
+ ```
231
+
232
+ #### Dependencies ####
233
+
234
+ Configurations can list dependencies that will be built before the configuration. A configuration's dependencies are specified as a list of Rake tasks. Therefore, these dependencies can refer to other MTBuild projects or any Rake task.
235
+
236
+ #### Automatic Library Dependencies ####
237
+
238
+ MTBuild library projects allow you to specify API header locatinos for library project configurations. If you list a library project as a dependency of an application project, MTbuild will automatically include the library's API header paths when compiling the application. Additionally, it will automatically link the application with the library. This is intended to facilitate the scenario where you're building both a library and an application from a Workspace. To use the library from the application, you simply need to list the library as a dependency and MTBuild will make sure the application can use it.
239
+
240
+ Note that this does not work with non-MTBuild libraries. If you list a non-MTBuild Rake library task as a dependency of a MTBuild project, you will need to manually add the library's headers and library file to the project.
241
+
242
+ ###### Automatic Library Dependencies Example #####
243
+
244
+ Top-level Rakefile.rb:
245
+
246
+ This defines a workspace that includes the "MyLibrary" and "MyApp" projects. Because MyApp will depend upon MyLibrary, the order that the projects are added does matter. MyLibrary needs to be added first.
247
+
248
+ ```Ruby
249
+ workspace :AppWithLibrary, File.dirname(__FILE__) do |w|
250
+ w.add_project('MyLibrary')
251
+ w.add_project('MyApp')
252
+ end
253
+ ```
254
+
255
+ MyLibrary/Rakefile.rb
256
+
257
+ This defines a library with one configuration called "Debug". The library's API headers are in a folder called "include".
258
+
259
+ ```Ruby
260
+ static_library_project :MyLibrary, File.dirname(__FILE__) do |lib|
261
+ lib.add_configuration :Debug,
262
+ sources: ['src/**/*.c'],
263
+ api_headers: 'include',
264
+ toolchain: toolchain(:gcc)
265
+ end
266
+ ```
267
+
268
+ MyApp/Rakefile.rb:
269
+
270
+ This defines an application with one configuration called "Debug". It uses two libraries. It takes advantage of the automatic library dependency feature to include and link with 'MyLibrary:Debug' simply by listing it as a dependency. It includes and links with a 3rd party by manually specifying the include path and the library file for the toolchain.
271
+
272
+ ```Ruby
273
+ application_project :MyApp, File.dirname(__FILE__) do |app|
274
+ app.add_configuration :Debug,
275
+ sources: ['main.c'],
276
+ toolchain: toolchain(:gcc,
277
+ include_paths: '3rdPartyLibrary/include',
278
+ include_objects: 'externalLibrary/lib/lib3rdPartyLibrary.a'
279
+ ),
280
+ dependencies: [
281
+ 'MyLibrary:Debug'
282
+ ]
283
+ end
284
+ ```
285
+
286
+ #### Toolchains ####
287
+
288
+ MTBuild Toolchains generate the individual compile, archival, and link tasks that comprise an application or library. Most of the interesting settings in a project's configuration go in the toolchain. The settings vary based upon the toolchain.
289
+
290
+ #### Versioners ####
291
+
292
+ MTBuild Versioners update version information inside a source or header file. Versioner tasks are typically invoked on their own with a separate invocation of MTBuild. Versioners are an optional convenience intended for Continuous Integration servers. They're not strictly related to the build process; however, because it's common for CI servers to stamp version information into a file when building, it is convenient to be able to describe the files that need updating along with the rest of the project inside the Rakefile.
293
+
294
+ For example, the following project is configure to use the MindTribe Standard Version versioner:
295
+
296
+ ```Ruby
297
+ application_project :MyApp, File.dirname(__FILE__) do |app|
298
+ app.add_configuration :Debug,
299
+ sources: ['main.c'],
300
+ toolchain: toolchain(:gcc),
301
+ versioner: versioner(:mt_std_version,
302
+ files: 'src/version.h'
303
+ )
304
+ end
305
+ ```
306
+
307
+ The following updates the project's "version.h" header. The parameters to this particular versioner are detailed in a later section.
308
+
309
+ ```Shell
310
+ mtbuild MyApp:Debug:Version[1,0,0,465,"1.0.0 (465)","f1e471b49a4bedc9cf5c6aabf88cde478e482a69"]
311
+ ```
312
+
313
+ #### DSL ####
314
+
315
+ MTBuild provides several Domain Specific Language (DSL) methods to wrap up the underlying MTBuild classes into a more Rakefile-friendly syntax. These are called out in the reference section below.
316
+
317
+ ## Reference ##
318
+
319
+ ### MTBuild::Workspace ###
320
+
321
+ Declare a workspace with the following DSL method:
322
+
323
+ ```Ruby
324
+ workspace(workspace_name, workspace_folder, &configuration_block)
325
+ ```
326
+
327
+ ```workspace_name``` is your desired name for the workspace. This should be a symbol like ":MyWorkspace". It serves as a human-readable way to refer to the workspace.
328
+
329
+ ```workspace_folder``` is the location of the workspace. Project folders should be located at or below this location. Typically, you'd simply pass ```File.dirname(__FILE__)``` to use the same folder as the workspace's Rakefile.
330
+
331
+ For ```configuration_block```, you supply a block that takes one parameter. When MTBuild invokes the block, it will pass a Workspace object as this parameter. Inside the block, you can make Workspace calls on this object to add projects, set configuration defaults, etc.
332
+
333
+ #### add_project ####
334
+ Use ```add_project(project_location)``` inside of a workspace configuration block to add a project that lives inside a subfolder. The ```project_location``` parameter must be a subfolder of the workspace. If the project lives at the same level as the workspace, you should define it in the same Rakefile as the workspace. In this case, the project will be implicitly added and you do not need to use ```add_project``` inside the workspace. See the **Project Plus Workspace Example** above for an example of a workspace and project that live at the same folder level.
335
+
336
+ #### add_default_tasks ####
337
+ Use ```add_default_tasks(default_tasks)``` inside of a workspace configuration block to add tasks that run when you invoke MTBuild with no arguments. The ```default_tasks``` parameter expects one or more (in an array) Rake tasks. If no default tasks are specified, then invoking MTBuild with no arguments will effectively do nothing.
338
+
339
+ #### set_configuration_defaults ####
340
+ Use ```set_configuration_defaults(configuration_name, defaults_hash)``` inside of a workspace configuration block to add default settings for a configuration. This is how you would select, for instance, a default toolchain for all projects with a specific configuration.
341
+
342
+ The following example selects the "gcc" toolchain and sets the C standard to C99 for any projects with a configuration named "Debug":
343
+
344
+ ```Ruby
345
+ workspace :MyWorkspace, File.dirname(__FILE__) do |w|
346
+ w.set_configuration_defaults :Debug,
347
+ toolchain: toolchain(:gcc,
348
+ cflags: '-std=c99',
349
+ )
350
+ end
351
+ ```
352
+
353
+ Any configuration value can be specified in the hash passed to ```set_configuration_defaults```. MTBuild merges workspace configuration value defaults with project configuration values. In the case of conflicting settings, the project configuration wins and overrides the workspace.
354
+
355
+ #### set_output_folder ####
356
+ Use ```set_output_folder(output_folder)``` inside of a workspace configuration block to change the build output folder. By default, this folder is set to "build" underneath the workspace folder. The ```output_folder``` parameter expects the name of a folder relative to the workspace. If the folder does not exist, MTBuild will create it.
357
+
358
+
359
+ ### MTBuild::ApplicationProject ###
360
+
361
+ Define an Application Project with the following DSL method:
362
+
363
+ ```Ruby
364
+ application_project(application_name, project_folder, &configuration_block)
365
+ ```
366
+
367
+ ```application_name``` is your desired name for the application. This should be a symbol such as ```:MyApplication```. It serves as a human-readable name for the application. Rake tasks related to this application will be namespaced with this symbol. For example, the top-level Rake task for building the "MyApplication" application with a configuration called "Debug" would be "MyApplication:Debug".
368
+
369
+ ```project_folder``` is the location of the project. Project files should be located at or below this location. Typically, you'd simply pass ```File.dirname(__FILE__)``` to use the same folder as the project's Rakefile.
370
+
371
+ For ```configuration_block```, you supply a block that takes one parameter. When MTBuild invokes the block, it will pass an ApplicationProject object as this parameter. Inside the block, you can make ApplicationProject calls on this object to add configurations.
372
+
373
+ #### add_configuration ####
374
+ Use ```add_configuration(configuration_name, configuration)``` inside of an application project configuration block to add a build configuration for the application. The ```configuration_name``` parameter expects a symbol that serves as a human-readable name for the configuration. Rake tasks related to this configuration will be namespaced with this symbol. For example, the top-level Rake task for building the "Debug" configuration of "MyApplication" would be "MyApplication:Debug". The ```configuration``` parameter expects a hash that contains settings for the configuration.
375
+
376
+ ##### Application Project configuration settings #####
377
+ Application Project configurations require the following settings:
378
+
379
+ * ```:toolchain``` - A toolchain hash constructed with the ```toolchain``` DSL method (detailed in a later section).
380
+
381
+ Application Project configurations offer the following optional settings:
382
+
383
+ * ```:dependencies``` - The Rake task names of one or more dependencies. For example, For example, ```'MyLibrary:Debug'``` or ```['MyLibrary1:Debug', 'MyLibrary2:Debug']```
384
+
385
+ * ```:sources``` - One or more source file names or source file glob patterns. For example, ```'main.c'``` or ```['main.c', 'startup.c']``` or ```['src/main.c', 'src/*.cpp']```. Note that the source file paths should be relative to the project folder.
386
+
387
+ * ```:tests``` - The Rake task names of one or more unit test applications. For example, ```'MyLibraryTest:Test'``` or ```['MyLibraryTest1:Test', 'MyLibraryTest2:Test']```
388
+
389
+ * ```:versioner``` - A versioner hash constructed with the ```versioner``` DSL method (detailed in a later section).
390
+
391
+ ### MTBuild::TestApplicationProject ###
392
+
393
+ Define a Test Application Project with the following DSL method:
394
+
395
+ ```Ruby
396
+ test_application_project(application_name, project_folder, &configuration_block)
397
+ ```
398
+
399
+ Test Application Projects are defined with the same parameters and settings as Application Projects. The only difference is that Test Application Projects attempt to execute their outputs after building. Therefore, Test Application Projects should always be defined with toolchains and settings suitable for execution on the host machine running MTBuild (as opposed to an Application Project, which could be using a cross-compiler).
400
+
401
+ ### MTBuild::StaticLibraryProject ###
402
+
403
+ Define a Static Library Project with the following DSL method:
404
+
405
+ ```Ruby
406
+ static_library_project(library_name, project_folder, &configuration_block)
407
+ ```
408
+
409
+ ```library_name``` is your desired name for the library. This should be a symbol like ```:MyLibrary```. It serves as a human-readable name for the library. Rake tasks related to this library will be namespaced with this symbol. For example, the top-level Rake task for building the "MyLibrary" library with a configuration called "Debug" would be "MyLibrary:Debug".
410
+
411
+ ```project_folder``` is the location of the project. Project files should be located at or below this location. Typically, you'd simply pass ```File.dirname(__FILE__)``` to use the same folder as the project's Rakefile.
412
+
413
+ For ```configuration_block```, you supply a block that takes one parameter. When MTBuild invokes the block, it will pass a StaticLibraryProject object as this parameter. Inside the block, you can make StaticLibraryProject calls on this object to add configurations.
414
+
415
+ #### add_configuration ####
416
+ Use ```add_configuration(configuration_name, configuration)``` inside of a static library project configuration block to add a build configuration for the library. The ```configuration_name``` parameter expects a symbol that serves as a human-readable name for the configuration. Rake tasks related to this configuration will be namespaced with this symbol. For example, the top-level Rake task for building the "Debug" configuration of "MyLibrary" would be "MyLibrary:Debug". The ```configuration``` parameter expects a hash that contains settings for the configuration.
417
+
418
+ ##### Static Library Project configuration settings #####
419
+ Static Library Project configurations use the same settings as Application Project configurations.
420
+
421
+ Additionally, Static Library Project configurations offer the following optional settings:
422
+
423
+ * ```:api_headers``` - One or more API header paths. For example, ```'include'``` or ```['include', 'include/plugins']```. Note that the API header paths should be relative to the project folder.
424
+
425
+ ### MTBuild::TestApplicationProject ###
426
+ Define a Test Application Project with the following DSL method:
427
+
428
+ ```Ruby
429
+ test_application_project(application_name, project_folder, &configuration_block)
430
+ ```
431
+
432
+ ```application_name``` is your desired name for the application. This should be a symbol like ```:MyApplication```. It serves as a human-readable name for the application. Rake tasks related to this application will be namespaced with this symbol. For example, the top-level Rake task for building the "MyTestApplication" application with a configuration called "Debug" would be "MyTestApplication:Debug".
433
+
434
+ ```project_folder``` is the location of the project. Project files should be located at or below this location. Typically, you'd simply pass ```File.dirname(__FILE__)``` to use the same folder as the project's Rakefile.
435
+
436
+ For ```configuration_block```, you supply a block that takes one parameter. When MTBuild invokes the block, it will pass a TestApplicationProject object as this parameter. Inside the block, you can make TestApplicationProject calls on this object to add configurations.
437
+
438
+ #### add_configuration ####
439
+ Use ```add_configuration(configuration_name, configuration)``` inside of a test application project configuration block to add a build configuration for the application. The ```configuration_name``` parameter expects a symbol that serves as a human-readable name for the configuration. Rake tasks related to this configuration will be namespaced with this symbol. For example, the top-level Rake task for building the "Debug" configuration of "MyTestApplication" would be "MyTestApplication:Debug". The ```configuration``` parameter expects a hash that contains settings for the configuration.
440
+
441
+ ##### Test Application Project configuration settings #####
442
+ Test Application Project configurations use the same settings as Application Library Project configurations.
443
+
444
+ ### MTBuild::Toolchain ###
445
+ Define a Toolchain with the following DSL method:
446
+
447
+ ```Ruby
448
+ def toolchain(toolchain_name, toolchain_configuration={})
449
+ ```
450
+
451
+ ```toolchain_name``` is the name of a valid MTBuild toolchain. See following sections for valid toolchain names.
452
+
453
+ ```toolchain_configuration``` expects a hash that contains settings for the toolchain.
454
+
455
+ ##### Toolchain settings #####
456
+ All toolchains offer the following optional settings:
457
+
458
+ * ```:include_paths``` - One or more include folders to use while compiling. For example, ```'include'``` or ```['include', 'include/plugins']```. Note that the paths should be relative to the project folder.
459
+
460
+ * ```:include_objects``` - One or more object files or libraries to link against. For example, ```'startup.o'``` or ```['startup.o', 'lib3rdParty.a']```.
461
+
462
+ * ```:library_paths``` - One or more library paths to search when linking. For example, ```'FancyLibrary/lib'``` or ```['FancyLibrary/lib', 'SuperFancyLibrary/lib']```. Note that the paths should be relative to the project folder.
463
+
464
+ ### MTBuild::ToolchainGcc ###
465
+ Define a GCC toolchain by passing ```:gcc``` as the ```toolchain_name``` when invoking the ```toolchain()``` method.
466
+
467
+ ##### ToolchainGcc settings #####
468
+ On top of the base Toolchain settings, the ToolchainGcc toolchain offers the following optional settings:
469
+
470
+ * ```:cppflags``` - A string representing C Preprocessor flags to be used in all compilation and link steps
471
+
472
+ * ```:cflags``` - A string representing C flags to be used when compiling C files
473
+
474
+ * ```:cxxflags``` - A string representing C++ flags to be used when compiling C++ files
475
+
476
+ * ```:asflags``` - A string representing assembler flags to be used when assembling assembly files
477
+
478
+ * ```:ldflags``` - A string representing linker flags to be used when linking
479
+
480
+ * ```:linker_script``` - A linker script file to be used when linking
481
+
482
+ ### MTBuild::ToolchainArmNoneEabiGcc ###
483
+ Define an arm-none-eabi-gcc toolchain by passing ```:arm_none_eabi_gcc``` as the ```toolchain_name``` when invoking the ```toolchain()``` method.
484
+
485
+ ##### ToolchainArmNoneEabiGcc settings #####
486
+ The ToolchainArmNoneEabiGcc toolchain uses the same settings as the ToolchainGcc toolchain.
487
+
488
+ ### MTBuild::Versioner ###
489
+
490
+ Define a Versioner with the following DSL method:
491
+
492
+ ```Ruby
493
+ def versioner(versioner_name, versioner_configuration={})
494
+ ```
495
+
496
+ ```versioner_name``` is the name of a valid MTBuild versioner. See following sections for valid versioner names.
497
+
498
+ ```versioner_configuration``` expects a hash that contains settings for the versioner.
499
+
500
+ ### MTBuild::VersionerMTStdVersion ###
501
+ Define a MindTribe Standard Version versioner by passing ```:mt_std_version``` as the ```versioner_name``` when invoking the ```versioner()``` method.
502
+
503
+ ##### VersionerMTStdVersion settings #####
504
+ The VersionerMTStdVersion versioner requires the following settings:
505
+
506
+ * ```:files``` - One or more version files to be updated. For example, ```'version.h'``` or ```['src/version.h', 'test/version.h']```.
507
+
508
+ ##### VersionerMTStdVersion invocation #####
509
+
510
+ MindTribe Standard Version parameters should be specified when invoking MTBuild to run a VersionerMTStdVersion versioner task. These parameters, in order, are:
511
+
512
+ * ```major``` - The build's major version number
513
+
514
+ * ```minor``` - The build's minor version number
515
+
516
+ * ```revision``` - The build's revision number
517
+
518
+ * ```build``` - The build's build number
519
+
520
+ * ```version_string``` - The build's version as a complete string
521
+
522
+ * ```git_SHA``` - The build's git SHA as a string
523
+
524
+ For example:
525
+
526
+ ```Shell
527
+ mtbuild MyApp:Debug:Version[1,0,0,465,"1.0.0 (465)","f1e471b49a4bedc9cf5c6aabf88cde478e482a69"]
528
+ ```