mtbuild 0.0.7 → 0.0.8

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2421f140e27fc06f4acc05b65ceeae4ad18807a2
4
- data.tar.gz: 226f8ccef5e4c26851f2a16838b51a9447dd5918
3
+ metadata.gz: cba59381b91089bdd3e1ce4fcf93b70e7599c8f9
4
+ data.tar.gz: 7f084e0b1d50e2fa1e895128edabf5cfc35a3305
5
5
  SHA512:
6
- metadata.gz: b78783ed1b5e6905891c75e31fd46b5f15b09110334d4596033967e0b4a851c27a6f66ac38a3146e5718201f1bfc14ac44c6d25cb212eed3b80afb00c0842eae
7
- data.tar.gz: 68e1a5e8e8100d6a6cd1c3e68b3c453675e2be3f9e6a4423d9475ae276a80fad0c954fbf6a6238e063a980cd559a2eb8bb0f33c38c61f3b72830c8693178fca7
6
+ metadata.gz: 2a655658ed9b12d20c6a7367267e4c7c0ae391109aa064be9d31534e7774eddfdde9472e9faf464aa02011b248b49325e0713dee7833b20654c679c9eb1e6b56
7
+ data.tar.gz: 1196a725a913057fa61146273d865330ea0c01041dbf55994f5df5dc69e5ea7ef51bc02585d91def6169e0d0b6788d2e34f27c70a9d899be1afb11b0a6adb1a8
data/CHANGES.md CHANGED
@@ -1,5 +1,31 @@
1
1
  # Release Notes #
2
2
 
3
+ ## MTBuild 0.0.8 ##
4
+
5
+ ### Changes ###
6
+
7
+ * MTBuild now uses 'mtbuildfile', 'MTBuildfile', 'mtbuildfile.rb', or 'MTBuildfile.rb'
8
+ instead of the standard rakefile names. This was changed to avoid confusion
9
+ since MTBuild files don't work with the "rake" command.
10
+ * When merging project configurations with workspace defaults, MTBuild now
11
+ merges any arrays using the union operator. This allows projects to extend
12
+ more default workspace configuration.
13
+ * MTBuild now allows strings or arrays for toolchain settings. If arrays are
14
+ used, project configurations will be merged with any default workspace
15
+ configurations. For example, a workspace could declare default cflags as
16
+ and array of individual flags. A project could then declare its own cflags,
17
+ which MTBuild would merge with the workspace defaults instead of
18
+ overriding them.
19
+
20
+
21
+ ## MTBuild 0.0.7 ##
22
+
23
+ ### Changes ###
24
+
25
+ * GCC-based toolchains can now automatically handle renamed header files.
26
+ Previously, if you renamed a header file, you had to manually clean before building.
27
+
28
+
3
29
  ## MTBuild 0.0.6 ##
4
30
 
5
31
  ### Changes ###
data/README.md CHANGED
@@ -16,7 +16,7 @@ MTBuild is distributed as a gem. Install it with:
16
16
  gem install mtbuild
17
17
  ```
18
18
 
19
- To build with MTBuild, switch to a folder containing a rakefile and run:
19
+ To build with MTBuild, switch to a folder containing an mtbuildfile and run:
20
20
 
21
21
  ```Shell
22
22
  mtbuild
@@ -30,7 +30,7 @@ rake install
30
30
 
31
31
  ### Getting Started ###
32
32
 
33
- Here's an example of a very simple Rakefile.rb that defines an MTBuild project:
33
+ Here's an example of a very simple mtbuildfile.rb that defines an MTBuild project:
34
34
 
35
35
  ```Ruby
36
36
  application_project :MyApp, File.dirname(__FILE__) do |app|
@@ -50,9 +50,9 @@ application_project :MyApp, File.dirname(__FILE__) do |app|
50
50
  end
51
51
  ```
52
52
 
53
- This Rakefile builds an application called "MyApp" (```application_project :MyApp```).
53
+ This mtbuildfile builds an application called "MyApp" (```application_project :MyApp```).
54
54
 
55
- 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.
55
+ The project folder is set to the mtbuildfile's containing folder (```File.dirname(__FILE__)```). All folder references in the mtbuildfile are relative to this folder.
56
56
 
57
57
  The MyApp project has one configuration called "Debug" (```app.add_configuration :Debug,```).
58
58
 
@@ -95,9 +95,9 @@ Here is an example of our preferred structure for a complex application that is
95
95
 
96
96
  ```
97
97
  Workspace Folder
98
- Rakefile.rb <-- workspace Rakefile
98
+ mtbuildfile.rb <-- workspace mtbuildfile
99
99
  ├ Library Project Folder
100
- │ ├ Rakefile.rb <-- project Rakefile
100
+ │ ├ mtbuildfile.rb <-- project mtbuildfile
101
101
  │ ├ include <-- public headers
102
102
  │ │ └ *.h
103
103
  │ ├ src <-- private headers and source
@@ -105,7 +105,7 @@ Workspace Folder
105
105
  │ └ test <-- unit tests
106
106
  │ └ *.c/*.cpp
107
107
  └ Application Project Folder
108
- Rakefile.rb <-- project Rakefile
108
+ mtbuildfile.rb <-- project mtbuildfile
109
109
  ├ src <-- headers and source
110
110
  │ └ *.h/*.c/*.cpp
111
111
  └ test <-- unit tests
@@ -118,22 +118,22 @@ Here is an example of a simpler application that is self-contained:
118
118
 
119
119
  ```
120
120
  Application Project Folder
121
- Rakefile.rb <-- project+workspace Rakefile
121
+ mtbuildfile.rb <-- project+workspace mtbuildfile
122
122
  ├ src <-- headers and source
123
123
  │ └ *.h/*.c/*.cpp
124
124
  └ test <-- unit tests
125
125
  └ *.h/*.c/*.cpp
126
126
  ```
127
127
 
128
- 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.
128
+ The project and (optional) workspace are defined in a single mtbuildfile. There are no public headers, so everything goes into the "src" folder, but tests might still be separated into a "test" folder.
129
129
 
130
- #### Rakefiles ####
130
+ #### mtbuildfiles ####
131
131
 
132
- 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.
132
+ MTBuild uses Rake. MTBuild projects and workspaces are defined using mtbuildfiles. 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.
133
133
 
134
134
  #### Building ####
135
135
 
136
- 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.
136
+ Building is as simple as invoking ```mtbuild``` in a folder containing a mtbuildfile. Under the hood, MTBuild pulls in the MTBuild infrastructure and then invokes Rake.
137
137
 
138
138
  #### Project Hierarchy ####
139
139
 
@@ -183,9 +183,9 @@ MTBuild builds only the first workspace it finds. If a workspace includes a proj
183
183
 
184
184
  ###### Simple Workspace Example #####
185
185
 
186
- Rakefile.rb:
186
+ mtbuildfile.rb:
187
187
 
188
- 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":
188
+ This defines a workspace that includes the "MyLibrary" and "MyApp" projects. The projects are presumed to be defined in their own mtbuildfiles inside sub-folders called "MyLibrary" and "MyApp":
189
189
 
190
190
  ```Ruby
191
191
  workspace :AppWithLibrary, File.dirname(__FILE__) do |w|
@@ -196,9 +196,9 @@ end
196
196
 
197
197
  ###### Project Plus Workspace Example #####
198
198
 
199
- Rakefile.rb:
199
+ mtbuildfile.rb:
200
200
 
201
- 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):
201
+ This defines a workspace that includes the MyLibrary project, which is defined in the same mtbuildfile. When a project is defined in the same mtbuildfile, it does not need to be explicitly added to the workspace (in this particular example, the workspace isn't very useful):
202
202
 
203
203
  ```Ruby
204
204
  workspace :MyWorkspace, File.dirname(__FILE__) do |w|
@@ -216,9 +216,9 @@ end
216
216
 
217
217
  ###### Project Plus Workspace With Defaults Example #####
218
218
 
219
- Rakefile.rb:
219
+ mtbuildfile.rb:
220
220
 
221
- 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:
221
+ This defines a workspace that includes the MyLibrary project, which is defined in the same mtbuildfile. The workspace provides a default toolchain for the "Debug" configuration. A higher-level workspace would override this with its own defaults:
222
222
 
223
223
  ```Ruby
224
224
  workspace :MyLibrary, File.dirname(__FILE__) do |w|
@@ -253,7 +253,7 @@ Using configuration headers to configure libraries is such a bad idea that MTBui
253
253
 
254
254
  ###### Automatic Library Dependencies Example #####
255
255
 
256
- Top-level Rakefile.rb:
256
+ Top-level mtbuildfile.rb:
257
257
 
258
258
  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.
259
259
 
@@ -264,7 +264,7 @@ workspace :AppWithLibrary, File.dirname(__FILE__) do |w|
264
264
  end
265
265
  ```
266
266
 
267
- MyLibrary/Rakefile.rb
267
+ MyLibrary/mtbuildfile.rb
268
268
 
269
269
  This defines a library with one configuration called "Debug". The library's API headers are in a folder called "include". This library is foul and therefore has configuration headers for the Debug configuration in a folder called "config/Debug".
270
270
 
@@ -278,7 +278,7 @@ static_library_project :MyLibrary, File.dirname(__FILE__) do |lib|
278
278
  end
279
279
  ```
280
280
 
281
- MyApp/Rakefile.rb:
281
+ MyApp/mtbuildfile.rb:
282
282
 
283
283
  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.
284
284
 
@@ -306,7 +306,7 @@ MTBuild Toolchains generate the individual compile, archival, and link tasks tha
306
306
 
307
307
  #### Versioners ####
308
308
 
309
- 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.
309
+ 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 mtbuildfile.
310
310
 
311
311
  For example, the following project is configure to use the MindTribe Standard Version versioner:
312
312
 
@@ -329,7 +329,7 @@ mtbuild MyApp:Debug:Version[1,0,0,465,"1.0.0 (465)","f1e471b49a4bedc9cf5c6aabf88
329
329
 
330
330
  #### DSL ####
331
331
 
332
- 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.
332
+ MTBuild provides several Domain Specific Language (DSL) methods to wrap up the underlying MTBuild classes into a friendlier syntax. These are called out in the reference section below.
333
333
 
334
334
  ## Reference ##
335
335
 
@@ -343,12 +343,12 @@ workspace(workspace_name, workspace_folder, &configuration_block)
343
343
 
344
344
  ```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.
345
345
 
346
- ```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.
346
+ ```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 mtbuildfile.
347
347
 
348
348
  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.
349
349
 
350
350
  #### add_project ####
351
- 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.
351
+ 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 mtbuildfile 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.
352
352
 
353
353
  #### add_default_tasks ####
354
354
  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.
@@ -367,7 +367,30 @@ workspace :MyWorkspace, File.dirname(__FILE__) do |w|
367
367
  end
368
368
  ```
369
369
 
370
- 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.
370
+ 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 (when both a workspace and a project define the same configuration value), one of two things can happen:
371
+
372
+ 1. If the configuration value is a string in either the project or the workspace, the project configuration wins and completely overrides the workspace's value.
373
+ 2. If the configuration value is an array in both the project or the workspace, the values will be merged using a union operation. This allows the workspace to define, for example, "cflags" to be used for compiling, which could then be extended with more flags inside of a specific project. However, there is currently no way for a project to remove array values that are defined in the workspace. If a project needs to do this, it will have to override the entire workspace configuration using a string for the value.
374
+
375
+ The following example selects the "gcc" toolchain and sets the C standard to C99 for any projects with a configuration named "Debug". The project then extends the "cflags" to add an optimization level. The resulting command line would be "-std=c99 -O0":
376
+
377
+ ```Ruby
378
+ workspace :MyWorkspace, File.dirname(__FILE__) do |w|
379
+ w.set_configuration_defaults :Debug,
380
+ toolchain: toolchain(:gcc,
381
+ cflags: ['-std=c99'],
382
+ )
383
+ end
384
+
385
+ static_library_project :MyLibrary, File.dirname(__FILE__) do |lib|
386
+ lib.add_api_headers 'include'
387
+ lib.add_configuration :Debug,
388
+ sources: ['src/**/*.c']
389
+ toolchain: toolchain(:gcc,
390
+ cflags: ['-O0'],
391
+ )
392
+ end
393
+ ```
371
394
 
372
395
  #### set_output_folder ####
373
396
  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.
@@ -383,7 +406,7 @@ application_project(application_name, project_folder, &configuration_block)
383
406
 
384
407
  ```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".
385
408
 
386
- ```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.
409
+ ```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 mtbuildfile.
387
410
 
388
411
  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.
389
412
 
@@ -425,7 +448,7 @@ static_library_project(library_name, project_folder, &configuration_block)
425
448
 
426
449
  ```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".
427
450
 
428
- ```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.
451
+ ```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 mtbuildfile.
429
452
 
430
453
  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.
431
454
 
@@ -454,7 +477,7 @@ test_application_project(application_name, project_folder, &configuration_block)
454
477
 
455
478
  ```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".
456
479
 
457
- ```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.
480
+ ```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 mtbuildfile.
458
481
 
459
482
  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.
460
483
 
@@ -474,7 +497,7 @@ framework_project(framework_name, project_folder, &configuration_block)
474
497
 
475
498
  ```framework_name``` is your desired name for the framework. This should be a symbol such as ```:MyApplication```. It serves as a human-readable name for the framework. Rake tasks related to this framework will be namespaced with this symbol. For example, the top-level Rake task for building the "MyLibrary" framework with a configuration called "Debug" would be "MyLibrary:Debug".
476
499
 
477
- ```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.
500
+ ```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 mtbuildfile.
478
501
 
479
502
  For ```configuration_block```, you supply a block that takes one parameter. When MTBuild invokes the block, it will pass an FrameworkProject object as this parameter. Inside the block, you can make FrameworkProject calls on this object to add configurations.
480
503
 
@@ -519,15 +542,15 @@ Define a GCC toolchain by passing ```:gcc``` as the ```toolchain_name``` when in
519
542
  ##### ToolchainGcc settings #####
520
543
  On top of the base Toolchain settings, the ToolchainGcc toolchain offers the following optional settings:
521
544
 
522
- * ```:cppflags``` - A string representing C Preprocessor flags to be used in all compilation and link steps
545
+ * ```:cppflags``` - A string or array of strings representing C Preprocessor flags to be used in all compilation and link steps
523
546
 
524
- * ```:cflags``` - A string representing C flags to be used when compiling C files
547
+ * ```:cflags``` - A string or array of strings representing C flags to be used when compiling C files
525
548
 
526
- * ```:cxxflags``` - A string representing C++ flags to be used when compiling C++ files
549
+ * ```:cxxflags``` - A string or array of strings representing C++ flags to be used when compiling C++ files
527
550
 
528
- * ```:asflags``` - A string representing assembler flags to be used when assembling assembly files
551
+ * ```:asflags``` - A string or array of strings representing assembler flags to be used when assembling assembly files
529
552
 
530
- * ```:ldflags``` - A string representing linker flags to be used when linking
553
+ * ```:ldflags``` - A string or array of strings representing linker flags to be used when linking
531
554
 
532
555
  * ```:linker_script``` - A linker script file to be used when linking
533
556
 
@@ -11,10 +11,27 @@ module MTBuild
11
11
 
12
12
  require 'rake'
13
13
 
14
- # This subclasses the Rake::Application class only only to inject the MTBuild
15
- # version number for display when mtbuild is invoked with the --version flag.
14
+ # This subclasses the Rake::Application class to override default Rake
15
+ # behaviors with MTBuild-specific behaviors
16
16
  class Application < Rake::Application
17
17
 
18
+ # List of rakefile names to look for
19
+ attr_reader :rakefiles
20
+
21
+ # Default list of mtbuildfile names
22
+ DEFAULT_RAKEFILES = [
23
+ 'mtbuildfile',
24
+ 'MTBuildfile',
25
+ 'mtbuildfile.rb',
26
+ 'MTBuildfile.rb'
27
+ ].freeze
28
+
29
+ # This overrides the default rakefile names with the mtbuildfile names
30
+ def initialize
31
+ super
32
+ @rakefiles = DEFAULT_RAKEFILES.dup
33
+ end
34
+
18
35
  # This hijacks the "--version" flag and displays the MTBuild version along
19
36
  # with the Rake version. All other options/flags are returned unmodified.
20
37
  def standard_rake_options
@@ -23,11 +23,11 @@ module MTBuild
23
23
  fail "Toolchain component #{compiler} not found." unless toolchain_test_passed
24
24
 
25
25
  @compiler_is_LLVM_gcc = toolchain_test_output.include?'LLVM'
26
- @cppflags = configuration.fetch(:cppflags, '')
27
- @cflags = configuration.fetch(:cflags, '')
28
- @cxxflags = configuration.fetch(:cxxflags, '')
29
- @asflags = configuration.fetch(:asflags, '')
30
- @ldflags = configuration.fetch(:ldflags, '')
26
+ @cppflags = Utils.ensure_array(configuration.fetch(:cppflags, '')).to_a.flatten.join(' ')
27
+ @cflags = Utils.ensure_array(configuration.fetch(:cflags, '')).to_a.flatten.join(' ')
28
+ @cxxflags = Utils.ensure_array(configuration.fetch(:cxxflags, '')).to_a.flatten.join(' ')
29
+ @asflags = Utils.ensure_array(configuration.fetch(:asflags, '')).to_a.flatten.join(' ')
30
+ @ldflags = Utils.ensure_array(configuration.fetch(:ldflags, '')).to_a.flatten.join(' ')
31
31
  @linker_script = configuration.fetch(:linker_script, '')
32
32
  end
33
33
 
data/lib/mtbuild/utils.rb CHANGED
@@ -38,7 +38,10 @@ module MTBuild
38
38
  end
39
39
 
40
40
  def self.merge_configurations(default, override)
41
- return default.merge(override) {|key, old_value, new_value| if old_value.is_a? Hash and new_value.is_a? Hash then merge_configurations(old_value, new_value) else new_value end}
41
+ return default.merge(override) { |key, old_value, new_value|
42
+ if old_value.is_a? Hash and new_value.is_a? Hash then merge_configurations(old_value, new_value)
43
+ elsif old_value.is_a? Array and new_value.is_a? Array then old_value | new_value
44
+ else new_value end }
42
45
  end
43
46
 
44
47
  end
@@ -1,4 +1,4 @@
1
1
  module MTBuild
2
2
  # The current MTBuild version.
3
- VERSION = "0.0.7"
3
+ VERSION = "0.0.8"
4
4
  end
@@ -48,8 +48,8 @@ module MTBuild
48
48
  new_projects = []
49
49
  Utils.expand_folder_list(project_location, Rake.original_dir).each do |project_path|
50
50
  if File.directory? project_path
51
- project_rakefile = File.join(project_path,'Rakefile.rb')
52
- new_projects << project_rakefile if File.file? project_rakefile
51
+ project_rakefile = MTBuild::Workspace.find_mtbuildfile(project_path)
52
+ new_projects << project_rakefile unless project_rakefile.nil?
53
53
  end
54
54
  end
55
55
  $stderr.puts "Could not find a valid project at '#{project_location}'. Ignored." if new_projects.empty?
@@ -105,6 +105,16 @@ module MTBuild
105
105
  @configuration_defaults[configuration_name] = defaults_hash
106
106
  end
107
107
 
108
+ def self.find_mtbuildfile(project_path)
109
+ Rake.application.rakefiles.each do |fn|
110
+ mtbuildfile = File.join(project_path, fn)
111
+ if File.file? mtbuildfile
112
+ return mtbuildfile
113
+ end
114
+ end
115
+ return nil
116
+ end
117
+
108
118
  include Rake::DSL
109
119
 
110
120
  end
metadata CHANGED
@@ -1,93 +1,93 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mtbuild
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jerry Ryle
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-16 00:00:00.000000000 Z
11
+ date: 2015-04-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0.9'
20
- - - '>='
20
+ - - ">="
21
21
  - !ruby/object:Gem::Version
22
22
  version: 0.9.6
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
- - - ~>
27
+ - - "~>"
28
28
  - !ruby/object:Gem::Version
29
29
  version: '0.9'
30
- - - '>='
30
+ - - ">="
31
31
  - !ruby/object:Gem::Version
32
32
  version: 0.9.6
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: rake
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
- - - ~>
37
+ - - "~>"
38
38
  - !ruby/object:Gem::Version
39
39
  version: '0.9'
40
- - - '>='
40
+ - - ">="
41
41
  - !ruby/object:Gem::Version
42
42
  version: 0.9.6
43
43
  type: :development
44
44
  prerelease: false
45
45
  version_requirements: !ruby/object:Gem::Requirement
46
46
  requirements:
47
- - - ~>
47
+ - - "~>"
48
48
  - !ruby/object:Gem::Version
49
49
  version: '0.9'
50
- - - '>='
50
+ - - ">="
51
51
  - !ruby/object:Gem::Version
52
52
  version: 0.9.6
53
53
  - !ruby/object:Gem::Dependency
54
54
  name: rdoc
55
55
  requirement: !ruby/object:Gem::Requirement
56
56
  requirements:
57
- - - ~>
57
+ - - "~>"
58
58
  - !ruby/object:Gem::Version
59
59
  version: '4.0'
60
- - - '>='
60
+ - - ">="
61
61
  - !ruby/object:Gem::Version
62
62
  version: 4.0.0
63
63
  type: :development
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
- - - ~>
67
+ - - "~>"
68
68
  - !ruby/object:Gem::Version
69
69
  version: '4.0'
70
- - - '>='
70
+ - - ">="
71
71
  - !ruby/object:Gem::Version
72
72
  version: 4.0.0
73
73
  - !ruby/object:Gem::Dependency
74
74
  name: rspec
75
75
  requirement: !ruby/object:Gem::Requirement
76
76
  requirements:
77
- - - ~>
77
+ - - "~>"
78
78
  - !ruby/object:Gem::Version
79
79
  version: '2.14'
80
- - - '>='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: 2.14.8
83
83
  type: :development
84
84
  prerelease: false
85
85
  version_requirements: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ~>
87
+ - - "~>"
88
88
  - !ruby/object:Gem::Version
89
89
  version: '2.14'
90
- - - '>='
90
+ - - ">="
91
91
  - !ruby/object:Gem::Version
92
92
  version: 2.14.8
93
93
  description: mtbuild is a rake-based build system for C/C++ projects. It provides
@@ -143,12 +143,12 @@ require_paths:
143
143
  - lib
144
144
  required_ruby_version: !ruby/object:Gem::Requirement
145
145
  requirements:
146
- - - '>='
146
+ - - ">="
147
147
  - !ruby/object:Gem::Version
148
148
  version: 1.9.1
149
149
  required_rubygems_version: !ruby/object:Gem::Requirement
150
150
  requirements:
151
- - - '>='
151
+ - - ">="
152
152
  - !ruby/object:Gem::Version
153
153
  version: '0'
154
154
  requirements: []