mtbuild 0.1.0 → 0.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2396c6643e11dac5f4237283b8008a2197a6f836
4
- data.tar.gz: 633bd1821dcaa7e207456763c2b57b648a380078
3
+ metadata.gz: 5d7930027ed4d42d1bebae2c9640749d41bffb95
4
+ data.tar.gz: a98d8091d96766f11ef77311523781df241696ec
5
5
  SHA512:
6
- metadata.gz: ebf955f1536eaa5cb307ef35ae5494aceaeb7352c25f43920a23797cc03acbceac0121c0a8179d059f9c79fead2b4a340133936b994ecb436f9740bcef16f6b3
7
- data.tar.gz: 1d9c4e05c3ea9ff8ba8ba60bbc2a64e3cf9186a579e72ca5ecc5b308d0c3330e0855ee336931f420ac360ed6e6c82c0f231043bf850c033eb0c9057f5e4e664d
6
+ metadata.gz: 25ee077f6472f68407add1fc65b835e5da0cd8e67120b57f600baf9912134ddefce4ab0f95af446fce7dee13687efc77ff6f0d692df985606c0511d026c898f3
7
+ data.tar.gz: 412fe0aeb34f02fd84af75086ad405d791bb4084bee2944d4703ab1c8b8d5dc491aeee7043c94d0771aff22ce32253e4c2ae4697fae53eac8c29e9cd55efcf9a
data/CHANGES.md CHANGED
@@ -1,6 +1,16 @@
1
1
  # Release Notes #
2
2
 
3
3
 
4
+ ## MTBuild 0.1.1 ##
5
+
6
+ ### Changes ###
7
+
8
+ * Removed the gpp (g++) toolchains. Upon further reflection, these made no
9
+ sense. We're back to simply having "gcc" toolchains, but now these will
10
+ automatically invoke "gcc" or "g++" on C or C++ files, respectively. And if
11
+ a configuration contains any C++ files, the linking is performed with "g++".
12
+
13
+
4
14
  ## MTBuild 0.1.0 ##
5
15
 
6
16
  ### Changes ###
data/README.md CHANGED
@@ -595,25 +595,12 @@ On top of the base Toolchain settings, the ToolchainGcc toolchain offers the fol
595
595
  * ```:linker_script``` - A linker script file to be used when linking
596
596
 
597
597
 
598
- ### MTBuild::ToolchainGpp ###
599
- Define a g++ toolchain by passing ```:gpp``` as the ```toolchain_name``` when invoking the ```toolchain()``` method.
600
-
601
- ##### ToolchainGpp settings #####
602
- The ToolchainGpp toolchain uses the same settings as the ToolchainGcc toolchain.
603
-
604
-
605
598
  ### MTBuild::ToolchainArmNoneEabiGcc ###
606
599
  Define an arm-none-eabi-gcc toolchain by passing ```:arm_none_eabi_gcc``` as the ```toolchain_name``` when invoking the ```toolchain()``` method.
607
600
 
608
601
  ##### ToolchainArmNoneEabiGcc settings #####
609
602
  The ToolchainArmNoneEabiGcc toolchain uses the same settings as the ToolchainGcc toolchain.
610
603
 
611
- ### MTBuild::ToolchainArmNoneEabiGpp ###
612
- Define an arm-none-eabi-g++ toolchain by passing ```:arm_none_eabi_gpp``` as the ```toolchain_name``` when invoking the ```toolchain()``` method.
613
-
614
- ##### ToolchainArmNoneEabiGpp settings #####
615
- The ToolchainArmNoneEabiGpp toolchain uses the same settings as the ToolchainGcc toolchain.
616
-
617
604
 
618
605
  ### MTBuild::Versioner ###
619
606
  Define a Versioner with the following DSL method:
data/lib/mtbuild.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module MTBuild
2
2
  # The current MTBuild version.
3
- VERSION = '0.1.0'
3
+ VERSION = '0.1.1'
4
4
  end
5
5
 
6
6
  require 'rake'
@@ -39,12 +39,18 @@ module MTBuild
39
39
  # Create the actual Rake tasks that will perform the configuration's work
40
40
  def configure_tasks
41
41
  super
42
+ all_sources = []
42
43
  @toolchains.each do |toolchain, sources|
44
+ all_sources |= sources
43
45
  toolchain.output_folder = @output_folder
44
46
  toolchain.project_folder = @project_folder
45
47
  toolchain.output_decorator = "-#{@configuration_name}"
46
48
  CompiledConfiguration.add_framework_dependencies_to_toolchain(toolchain, @dependencies)
47
49
  end
50
+ # Give the default toolchain an opportunity to scan all source files for
51
+ # any special needs. For example, a toolchain might look for .cpp files
52
+ # to determine that it should link a project with the "g++" vs "gcc".
53
+ @default_toolchain.scan_sources(all_sources)
48
54
  end
49
55
 
50
56
  private
@@ -63,6 +63,10 @@ module MTBuild
63
63
  @library_paths |= library_paths
64
64
  end
65
65
 
66
+ # Scan source files for any special processing needs
67
+ def scan_sources(source_files)
68
+ end
69
+
66
70
  # Create Rake tasks for compilation
67
71
  def create_compile_tasks(source_files)
68
72
  fail "Toolchain didn't provide create_compile_tasks"
@@ -53,18 +53,30 @@ module MTBuild
53
53
  return "\"#{objcopy}\"#{objcopyflags} \"#{input_name}\" \"#{output_name}\""
54
54
  end
55
55
 
56
- def compiler
56
+ def assembler
57
57
  return 'arm-none-eabi-gcc'
58
58
  end
59
59
 
60
+ def compiler_c
61
+ return 'arm-none-eabi-gcc'
62
+ end
63
+
64
+ def compiler_cpp
65
+ return 'arm-none-eabi-g++'
66
+ end
67
+
60
68
  def archiver
61
69
  return 'arm-none-eabi-ar'
62
70
  end
63
71
 
64
- def linker
72
+ def linker_c
65
73
  return 'arm-none-eabi-gcc'
66
74
  end
67
75
 
76
+ def linker_cpp
77
+ return 'arm-none-eabi-g++'
78
+ end
79
+
68
80
  def objcopy
69
81
  return 'arm-none-eabi-objcopy'
70
82
  end
@@ -17,14 +17,15 @@ module MTBuild
17
17
  @tracked_folders = []
18
18
 
19
19
  begin
20
- toolchain_test_output=%x{#{compiler} --version 2>&1}
20
+ toolchain_test_output=%x{#{compiler_c} --version 2>&1}
21
21
  toolchain_test_passed=$?.success?
22
22
  rescue
23
23
  toolchain_test_passed = false
24
24
  end
25
- fail "Toolchain component #{compiler} not found." unless toolchain_test_passed
25
+ fail "Toolchain component #{compiler_c} not found." unless toolchain_test_passed
26
26
 
27
27
  @compiler_is_LLVM_gcc = toolchain_test_output.include?'LLVM'
28
+ @link_as_cpp = false
28
29
  @cppflags = Utils.ensure_array(toolchain_configuration.fetch(:cppflags, '')).to_a.flatten.join(' ')
29
30
  @cflags = Utils.ensure_array(toolchain_configuration.fetch(:cflags, '')).to_a.flatten.join(' ')
30
31
  @cxxflags = Utils.ensure_array(toolchain_configuration.fetch(:cxxflags, '')).to_a.flatten.join(' ')
@@ -33,6 +34,10 @@ module MTBuild
33
34
  @linker_script = toolchain_configuration.fetch(:linker_script, '')
34
35
  end
35
36
 
37
+ def scan_sources(source_files)
38
+ @link_as_cpp = source_files.any? { |s| get_file_type(s)==:cplusplus }
39
+ end
40
+
36
41
  # Create Rake tasks for compilation
37
42
  def create_compile_tasks(source_files)
38
43
  object_files = []
@@ -134,9 +139,9 @@ module MTBuild
134
139
  cflags_s = @cflags.empty? ? '' : " #{@cflags}"
135
140
  cxxflags_s = @cxxflags.empty? ? '' : " #{@cxxflags}"
136
141
  asflags_s = @asflags.empty? ? '' : " #{@asflags}"
137
- return "\"#{compiler}\"#{cppflags_s}#{cflags_s}#{prerequisites_s}#{include_paths_s} -MMD -c -o \"#{output_name}\"" if file_type == :c
138
- return "\"#{compiler}\"#{cppflags_s}#{cxxflags_s}#{prerequisites_s}#{include_paths_s} -MMD -c -o \"#{output_name}\"" if file_type == :cplusplus
139
- return "\"#{compiler}\"#{cppflags_s}#{asflags_s}#{prerequisites_s}#{include_paths_s} -MMD -c -o \"#{output_name}\"" if file_type == :asm
142
+ return "\"#{compiler_c}\"#{cppflags_s}#{cflags_s}#{prerequisites_s}#{include_paths_s} -MMD -c -o \"#{output_name}\"" if file_type == :c
143
+ return "\"#{compiler_cpp}\"#{cppflags_s}#{cxxflags_s}#{prerequisites_s}#{include_paths_s} -MMD -c -o \"#{output_name}\"" if file_type == :cplusplus
144
+ return "\"#{assembler}\"#{cppflags_s}#{asflags_s}#{prerequisites_s}#{include_paths_s} -MMD -c -o \"#{output_name}\"" if file_type == :asm
140
145
  end
141
146
 
142
147
  def construct_archive_command(prerequisites, output_name)
@@ -150,9 +155,11 @@ module MTBuild
150
155
  library_paths_s = library_paths.empty? ? '' : " -L\"#{library_paths.join('" -L"')}\""
151
156
  cppflags_s = @cppflags.empty? ? '' : " #{@cppflags}"
152
157
  cflags_s = @cflags.empty? ? '' : " #{@cflags}"
158
+ cxxflags_s = @cxxflags.empty? ? '' : " #{@cxxflags}"
153
159
  ldflags_s = @ldflags.empty? ? '' : " #{@ldflags}"
154
160
  linker_script_s = @linker_script.empty? ? '' : " -Wl,-T\"#{File.join(@project_folder,@linker_script)}\""
155
- return "\"#{compiler}\"#{cppflags_s}#{cflags_s}#{ldflags_s}#{include_paths_s}#{library_paths_s}#{linker_script_s}#{prerequisites_s} #{map_flag(map_name)} -o \"#{output_name}\""
161
+ return "\"#{compiler_cpp}\"#{cppflags_s}#{cxxflags_s}#{ldflags_s}#{include_paths_s}#{library_paths_s}#{linker_script_s}#{prerequisites_s} #{map_flag(map_name)} -o \"#{output_name}\"" if @link_as_cpp
162
+ return "\"#{compiler_c}\"#{cppflags_s}#{cflags_s}#{ldflags_s}#{include_paths_s}#{library_paths_s}#{linker_script_s}#{prerequisites_s} #{map_flag(map_name)} -o \"#{output_name}\""
156
163
  end
157
164
 
158
165
  def map_flag(map_file)
@@ -160,18 +167,30 @@ module MTBuild
160
167
  return "-Wl,-Map=\"#{map_file}\",--cref"
161
168
  end
162
169
 
163
- def compiler
170
+ def assembler
171
+ return 'gcc'
172
+ end
173
+
174
+ def compiler_c
164
175
  return 'gcc'
165
176
  end
166
177
 
178
+ def compiler_cpp
179
+ return 'g++'
180
+ end
181
+
167
182
  def archiver
168
183
  return 'ar'
169
184
  end
170
185
 
171
- def linker
186
+ def linker_c
172
187
  return 'gcc'
173
188
  end
174
189
 
190
+ def linker_cpp
191
+ return 'g++'
192
+ end
193
+
175
194
  include MTBuild::DSL
176
195
 
177
196
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mtbuild
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
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-08-10 00:00:00.000000000 Z
11
+ date: 2015-08-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -125,9 +125,7 @@ files:
125
125
  - lib/mtbuild/test_application_task.rb
126
126
  - lib/mtbuild/toolchain.rb
127
127
  - lib/mtbuild/toolchains/arm_none_eabi_gcc.rb
128
- - lib/mtbuild/toolchains/arm_none_eabi_gpp.rb
129
128
  - lib/mtbuild/toolchains/gcc.rb
130
- - lib/mtbuild/toolchains/gpp.rb
131
129
  - lib/mtbuild/utils.rb
132
130
  - lib/mtbuild/version.rb
133
131
  - lib/mtbuild/versioner.rb
@@ -1,21 +0,0 @@
1
- module MTBuild
2
- require 'mtbuild/toolchains/arm_none_eabi_gcc'
3
-
4
- Toolchain.register_toolchain(:arm_none_eabi_gpp, 'MTBuild::ToolchainArmNoneEabiGpp')
5
-
6
- # This ToolchainGcc subclass can build using arm-non-eabi-g++
7
- class ToolchainArmNoneEabiGpp < ToolchainArmNoneEabiGcc
8
-
9
- private
10
-
11
- def compiler
12
- return 'arm-none-eabi-g++'
13
- end
14
-
15
- def linker
16
- return 'arm-none-eabi-g++'
17
- end
18
-
19
- end
20
-
21
- end
@@ -1,21 +0,0 @@
1
- module MTBuild
2
- require 'mtbuild/toolchains/gcc'
3
-
4
- Toolchain.register_toolchain(:gpp, 'MTBuild::ToolchainGpp')
5
-
6
- # This ToolchainGcc subclass can build using g++
7
- class ToolchainGpp < ToolchainGcc
8
-
9
- private
10
-
11
- def compiler
12
- return 'g++'
13
- end
14
-
15
- def linker
16
- return 'g++'
17
- end
18
-
19
- end
20
-
21
- end