Mxx_ru 1.4.4 → 1.4.5

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -31,10 +31,10 @@ end
31
31
  test = Rake::TestTask.new do |t|
32
32
  test_files = FileList[ 'tests/**/{tc,ts}*.rb' ]
33
33
 
34
- # Visual C++ 8.0 specific files must be excluded when working with
34
+ # Visual C++ 8.0-9.0 specific files must be excluded when working with
35
35
  # another compiler.
36
- test_files = test_files.delete_if { |n| /\/vc8/ =~ n } unless
37
- /(mxx_ru\/cpp\/toolsets\/){0,1}vc8/ =~ ENV[ 'MXX_RU_CPP_TOOLSET' ]
36
+ test_files = test_files.delete_if { |n| /\/vc[89]/ =~ n } unless
37
+ /(mxx_ru\/cpp\/toolsets\/){0,1}vc[89]/ =~ ENV[ 'MXX_RU_CPP_TOOLSET' ]
38
38
 
39
39
  # Visual C++ specific files must be excluded when working with
40
40
  # another compiler.
data/THANKS CHANGED
@@ -1,3 +1,4 @@
1
1
  Konstantine Nazarov (rut at user dot sourceforge dot net)
2
2
  Igor Mironchick (imironchick at gmail dot com)
3
3
  Mikhail Pustovalov (mpustovalov at gmail dot com)
4
+ Oleg Nabiullin (nabiullin at tecomgroup dot ru)
@@ -1,7 +1,7 @@
1
1
  #--
2
2
  # Copyright (c) 1996-2004, Yauheni Akhotnikau
3
3
  # Copyright (c) 2004-2006, JSC Intervale
4
- # Copyright (c) 2006, The Mxx_ru Project
4
+ # Copyright (c) 2006-2008, The Mxx_ru Project
5
5
  # All rights reserved.
6
6
  #
7
7
  # Redistribution and use in source and binary forms, with or without modification,
@@ -30,32 +30,10 @@ require 'ostruct'
30
30
  require 'set'
31
31
 
32
32
  require 'mxx_ru/cpp/target'
33
- require 'mxx_ru/cpp/toolsets/vc_family'
33
+ require 'mxx_ru/cpp/toolsets/vc8_family'
34
34
 
35
35
  module MxxRu
36
36
  module Cpp
37
-
38
- # Expand class Target to store source and actual manifest descriptions.
39
- class Target < MxxRu::BinaryTarget
40
- # Get source manifest description. If target has no manifest
41
- # then default manifest will be returned.
42
- def vc8_source_manifest
43
- if nil != @vc8_source_manifest
44
- @vc8_source_manifest
45
- else
46
- MxxRu::Cpp::Toolsets::Vc8::default_manifest
47
- end
48
- end
49
-
50
- # Setter for source manifest description.
51
- def vc8_source_manifest=( manifest )
52
- @vc8_source_manifest = manifest
53
- end
54
-
55
- attr_accessor :vc8_actual_manifest
56
-
57
- end
58
-
59
37
  module Toolsets
60
38
 
61
39
  # Toolset implementation for Visual C++ 2005 (8.0)
@@ -63,397 +41,17 @@ module MxxRu
63
41
  # Setups following tags:
64
42
  # [_ver_hi_] high version number. Value: 8.
65
43
  # [_ver_lo_] low version number. Value: 0.
66
- class Vc8 < MxxRu::Cpp::Toolsets::VcFamily
67
-
68
- # Tag name for a custom manifest tool name.
69
- #
70
- # Since v.1.4.0
71
- MT_NAME_TAG = 'mt_name'
72
-
73
- # Actual manifest description.
74
- class ActualManifest
75
- attr_reader :manifest_file
76
- attr_reader :digital_resource_id
77
-
78
- def initialize(
79
- source_manifest,
80
- manifest_file,
81
- digital_resource_id )
82
- @source_manifest = source_manifest
83
- @manifest_file = manifest_file
84
- @digital_resource_id = digital_resource_id
85
- end
86
-
87
- # Is autogeneration of manifest must be used?
88
- def autogen?
89
- @source_manifest.autogen
90
- end
91
-
92
- # Is manifest tool (mt.exe) must be used?
93
- def mt?
94
- @source_manifest.mt
95
- end
96
-
97
- # Is autogenerated manifest file should be kept after
98
- # embeding into executable?
99
- # By default autogenerated manifest file will be deleted.
100
- def keep_manifest_file?
101
- ( mt? and autogen? ) ? @source_manifest.keep_manifest_file : true
102
- end
103
- end # class ActualManifest
104
-
105
- # For compatibility with previous versions.
106
- Actual_manifest = ActualManifest
107
-
108
- @@default_manifest = OpenStruct.new(
109
- :autogen => true,
110
- :mt => true,
111
- :manifest_file => :default,
112
- :resource_id => :default,
113
- :keep_manifest_file => false )
114
-
115
- # Set of avaliable values for :resource_id key-value pair
116
- # in manifest description.
117
- @@resource_id_names = Set.new( [
118
- :default,
119
- :process_manifest,
120
- :isolationaware_manifest,
121
- :isolationaware_nostaticimport_manifest ] )
122
-
123
- public
44
+ class Vc8 < MxxRu::Cpp::Toolsets::Vc8Family
124
45
  def initialize( a_name = "vc" )
125
46
  super( a_name )
126
47
 
127
48
  setup_tag( "ver_hi", "8" )
128
49
  setup_tag( "ver_lo", "0" )
129
50
  end
130
-
131
- # Check some VC8.0 constraints before calling superclass
132
- # implementation
133
- #
134
- # VC8.0 does not support Single-Thread Run-Time.
135
- def setup_mandatory_options( target )
136
- if THREADING_SINGLE == target.mxx_threading_mode
137
- raise MxxRu::UnsupportedModeEx.new(
138
- "Visual C++ 2005 not supports " +
139
- "single-threaded static RTL" )
140
- elsif THREADING_DEFAULT == target.mxx_threading_mode
141
- # Because VC8.0 not support Single Thread Run-Time then
142
- # by default we must use Mutli-Threading Run-Time.
143
- target.threading_mode( THREADING_MULTI )
144
- end
145
-
146
- super( target )
147
-
148
- setup_manifest( target )
149
- setup_manifest_params( target )
150
- end
151
-
152
- # Remove autogenerated manifest file if any.
153
- def clean_dll_specific_files( dll_file, dll_info, target )
154
- super( dll_file, dll_info, target )
155
- clean_autogenerated_manifest( target )
156
- end
157
-
158
- # Remove autogenerated manifest file if any.
159
- def clean_exe_specific_files( exe_file, exe_info, target )
160
- super( exe_file, exe_info, target )
161
- clean_autogenerated_manifest( target )
162
- end
163
-
164
- # Append command line for embeding manifest file to result
165
- # of super class implementation.
166
- def make_dll_command_lines(
167
- dll_name,
168
- dll_info,
169
- linker_lists,
170
- target )
171
-
172
- append_mt_command_lines(
173
- super( dll_name, dll_info, linker_lists, target ),
174
- dll_name,
175
- target )
176
- end
177
-
178
- # Append command line for embeding manifest file to result
179
- # of super class implementation.
180
- def make_exe_command_lines(
181
- exe_name,
182
- exe_info,
183
- linker_lists,
184
- target )
185
- append_mt_command_lines(
186
- super( exe_name, exe_info, linker_lists, target ),
187
- exe_name,
188
- target )
189
- end
190
-
191
- # Make manifest description.
192
- #
193
- # Examples:
194
- # # Autogenerate manifest for target. Do not embed into executable.
195
- # # Manifest stored in <target>.manifest file.
196
- # MxxRu::Cpp::Toolsets::Vc8::manifest(
197
- # :target => self,
198
- # :autogen => :to_default_file )
199
- #
200
- # # Autogenerate manifest for target. Embed into executable.
201
- # # Autogenerated manifest will be deleted after embeding.
202
- # MxxRu::Cpp::Toolsets::Vc8::manifest(
203
- # :target => self,
204
- # :autogen => :to_default_file,
205
- # :mt => {} )
206
- #
207
- # # Autogenerate manifest for target. Embed into executable.
208
- # # Autogenerated manifest will be kept after embeding.
209
- # MxxRu::Cpp::Toolsets::Vc8::manifest(
210
- # :target => self,
211
- # :autogen => :to_default_file,
212
- # :mt => { :keep_manifest_file => true } )
213
- #
214
- # # Autogenerate manifest for target. Embed into executable as
215
- # # resource with id CREATEPROCESS_MANIFEST_RESOURCE_ID id.
216
- # MxxRu::Cpp::Toolsets::Vc8::manifest(
217
- # :target => self,
218
- # :autogen => :to_default_file,
219
- # :mt => { :resource_id => :process_manifest } )
220
- #
221
- # # Autogenerate manifest for target. Store manifest into
222
- # # file 'hello_world.exe.manifest'. Embed info executable.
223
- # MxxRu::Cpp::Toolsets::Vc8::manifest(
224
- # :target => self,
225
- # :autogen => 'hello_world.exe.manifest',
226
- # :mt => {} )
227
- #
228
- # # Embed manifest from file 'hello_world.exe.manifest' into
229
- # # target executable.
230
- # MxxRu::Cpp::Toolsets::Vc8::manifest(
231
- # :target => self,
232
- # :mt => { :manifest => 'hello_world.exe.manifest' } )
233
- # # Embed manifest from file 'hello_world.dll.manifest' into
234
- # # target executable as resource with
235
- # # ISOLATIONAWARE_NOSTATICIMPORT_MANIFEST_RESOURCE_ID id.
236
- # MxxRu::Cpp::Toolsets::Vc8::manifest(
237
- # :target => self,
238
- # :mt => { :manifest => 'hello_world.exe.manifest',
239
- # :resource_id => :isolationaware_nonstaticimport } )
240
- #
241
- # # Autogenerate manifest for all targets in build. Store manifest
242
- # # in default files. Do not embed manifest into executable.
243
- # MxxRu::Cpp::Toolsets::Vc8::manifest(
244
- # :autogen => :to_default_file )
245
- #
246
- # # Autogenerate manifest for all targets in build. Store manifest
247
- # # in default files. Embed manifest into executable.
248
- # MxxRu::Cpp::Toolsets::Vc8::manifest(
249
- # :autogen => :to_default_file,
250
- # :mt => {} )
251
- #
252
- # # Drop default manifest for build. Only explicitly specified
253
- # # manifest will be generated.
254
- # MxxRu::Cpp::Toolsets::Vc8::manifest( nil )
255
- #
256
- def self.manifest( params )
257
- if nil == params
258
- # No default manifest.
259
- @@default_manifest = nil
260
- else
261
- check_manifest_params( params )
262
-
263
- d = OpenStruct.new( :keep_manifest_file => true )
264
-
265
- if params.key?( :autogen )
266
- d.autogen = true
267
- d.manifest_file = ( params[ :autogen ] == :to_default_file ?
268
- :default : params[ :autogen ] )
269
- d.keep_manifest_file = false
270
- else
271
- d.autogen = false
272
- end
273
-
274
- if params.key?( :mt ) && nil != params[ :mt ]
275
- d.mt = true
276
- mt_params = params[ :mt ]
277
- d.manifest_file = mt_params[ :manifest ] if
278
- mt_params.key?( :manifest )
279
- d.resource_id = ( mt_params.key?( :resource_id ) ?
280
- mt_params[ :resource_id ] : :default )
281
-
282
- if mt_params.key?( :keep_manifest_file ) and
283
- params.key?( :autogen )
284
- d.keep_manifest_file = mt_params[ :keep_manifest_file ]
285
- end
286
- else
287
- d.mt = false
288
- end
289
-
290
- if params.key?( :target )
291
- # Source manifest must be set for specified target.
292
- params[ :target ].vc8_source_manifest = d
293
- else
294
- # This is new default manifest.
295
- @@default_manifest = d
296
- end
297
- end
298
- end
299
-
300
- # Get default manifest.
301
- def self.default_manifest
302
- @@default_manifest
303
- end
304
-
305
- protected
306
- # Set actual manifest for target if source manifest defined
307
- # (or default manifest exists).
308
- def setup_manifest( target )
309
- # Manifest can be set only for EXE or DLL.
310
- if ExeTargetType::TYPE == target.target_type.name or
311
- DllTargetType::TYPE == target.target_type.name
312
- desc = target.vc8_source_manifest
313
-
314
- if nil != desc
315
- # Actual manifest must be created for target.
316
- manifest_file =
317
- if :default == desc.manifest_file
318
- # We must create name for manifest.
319
- if ExeTargetType::TYPE == target.target_type.name
320
- make_exe_name(
321
- target.mxx_target_name,
322
- target ).full_name
323
- else
324
- make_dll_name(
325
- target.mxx_target_name,
326
- target ).full_name
327
- end + ".manifest"
328
- else
329
- # Manifest filename already specified.
330
- desc.manifest_file
331
- end
332
-
333
- # If mt.exe will be used then we must determine
334
- # digital resource_id for manifest resource.
335
- digital_resource_id =
336
- if desc.mt
337
- case desc.resource_id
338
- when :default:
339
- # Resource ID must be caclulated based on
340
- # target type.
341
- ExeTargetType::TYPE == target.target_type.name ? 1 : 2
342
- when :process_manifest: 1
343
- when :isolationaware_manifest: 2
344
- else
345
- # :isolationaware_nostaticimport_manifest
346
- 3
347
- end
348
- else
349
- nil
350
- end
351
-
352
- target.vc8_actual_manifest = ActualManifest.new(
353
- desc,
354
- manifest_file,
355
- digital_resource_id )
356
- end
357
- end
358
- end
359
-
360
- # Setup linker params for processing target manifest.
361
- def setup_manifest_params( target )
362
- m = target.vc8_actual_manifest
363
- if nil != m and m.autogen?
364
- # Linker must generate manifest.
365
- target.linker_option( '/MANIFEST' )
366
- target.linker_option( '/MANIFESTFILE:' + m.manifest_file )
367
- else
368
- # Linker should not generate manifest.
369
- target.linker_option( '/MANIFEST:NO' )
370
- end
371
- end
372
-
373
- # Remove autogenerated manifest file if any.
374
- def clean_autogenerated_manifest( target )
375
- m = target.vc8_actual_manifest
376
- MxxRu::Util::delete_file( m.manifest_file ) if
377
- m != nil and m.autogen?
378
- end
379
-
380
- # Append command line for embeding manifest file to end of
381
- # specified command line list.
382
- def append_mt_command_lines(
383
- cmd_lines,
384
- target_name,
385
- target )
386
-
387
- m = target.vc8_actual_manifest
388
- if nil != m and m.mt?
389
- cmd_lines << "#{mt_name} /nologo " +
390
- "/outputresource:\"#{target_name};\#" +
391
- "#{m.digital_resource_id}\" " +
392
- "/manifest \"#{m.manifest_file}\""
393
-
394
- if !m.keep_manifest_file?
395
- # del utility doesn't work with unix slashes
396
- cmd_lines << "del \"#{MxxRu::Util::native_pathname(m.manifest_file)}\""
397
- end
398
- end
399
-
400
- cmd_lines
401
- end
402
-
403
- # Name of manifest tool executable
404
- def mt_name
405
- tag( MT_NAME_TAG, "mt" )
406
- end
407
-
408
- # Checking manifest params validity.
409
- def self.check_manifest_params( params )
410
- if nil != params
411
- if params.key?( :mt )
412
- mt_hash = params[ :mt ]
413
-
414
- # :resource_id must have one of avaliable values.
415
- if mt_hash.key?( :resource_id ) and
416
- !@@resource_id_names.member?( mt_hash[ :resource_id ] )
417
- raise InvalidValueEx.new(
418
- "invalid value for :resource_id key: " +
419
- "'#{mt_hash[:resource_id]}'" )
420
- end
421
-
422
- if !mt_hash.key?( :manifest ) and
423
- !params.key?( :autogen )
424
-
425
- raise InvalidValueEx.new(
426
- "no manifest file name specified" )
427
- end
428
-
429
- # :keep_manifest_file should be Bool.
430
- if mt_hash.key?( :keep_manifest_file ) and
431
- true != mt_hash[ :keep_manifest_file ] and
432
- false != mt_hash[ :keep_manifest_file ]
433
- raise InvalidValueEx.new(
434
- "value for :keep_manifest_file should be 'true' " +
435
- "or 'false'" )
436
- end
437
- end
438
-
439
- if params.key?( :autogen )
440
- v = params[ :autogen ]
441
- if !( v == :to_default_file or
442
- v.kind_of?( String ) )
443
- raise InvalidValueEx.new(
444
- "invalid value for :autogen (must be " +
445
- ":to_default_file or String instance)" )
446
- end
447
- end
448
- end
449
- end
450
-
451
51
  end # class Vc8
452
52
 
453
53
  end # module Toolsets
454
-
455
54
  end # module Cpp
456
-
457
55
  end # module MxxRu
458
56
 
459
57
  MxxRu::Cpp::setup_toolset( MxxRu::Cpp::Toolsets::Vc8.new )
@@ -0,0 +1,452 @@
1
+ #--
2
+ # Copyright (c) 1996-2004, Yauheni Akhotnikau
3
+ # Copyright (c) 2004-2006, JSC Intervale
4
+ # Copyright (c) 2006-2008, The Mxx_ru Project
5
+ # All rights reserved.
6
+ #
7
+ # Redistribution and use in source and binary forms, with or without modification,
8
+ # are permitted provided that the following conditions are met:
9
+ #
10
+ # 1. Redistributions of source code must retain the above copyright notice,
11
+ # this list of conditions and the following disclaimer.
12
+ # 2. Redistributions in binary form must reproduce the above copyright notice,
13
+ # this list of conditions and the following disclaimer in the documentation
14
+ # and/or other materials provided with the distribution.
15
+ # 3. The name of the author may not be used to endorse or promote products derived
16
+ # from this software without specific prior written permission.
17
+ #
18
+ # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
19
+ # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
20
+ # AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
21
+ # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22
+ # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23
+ # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24
+ # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
25
+ # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
26
+ # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
+ #++
28
+
29
+ require 'ostruct'
30
+ require 'set'
31
+
32
+ require 'mxx_ru/cpp/target'
33
+ require 'mxx_ru/cpp/toolsets/vc_family'
34
+
35
+ module MxxRu
36
+ module Cpp
37
+
38
+ # Expand class Target to store source and actual manifest descriptions.
39
+ class Target < MxxRu::BinaryTarget
40
+ # Get source manifest description. If target has no manifest
41
+ # then default manifest will be returned.
42
+ def vc8_source_manifest
43
+ if nil != @vc8_source_manifest
44
+ @vc8_source_manifest
45
+ else
46
+ MxxRu::Cpp::Toolsets::Vc8Family::default_manifest
47
+ end
48
+ end
49
+
50
+ # Setter for source manifest description.
51
+ def vc8_source_manifest=( manifest )
52
+ @vc8_source_manifest = manifest
53
+ end
54
+
55
+ attr_accessor :vc8_actual_manifest
56
+
57
+ end
58
+
59
+ module Toolsets
60
+
61
+ # Toolset implementation for Visual C++ 2005 (8.0) and above.
62
+ #
63
+ class Vc8Family < MxxRu::Cpp::Toolsets::VcFamily
64
+
65
+ # Tag name for a custom manifest tool name.
66
+ #
67
+ # Since v.1.4.0
68
+ MT_NAME_TAG = 'mt_name'
69
+
70
+ # Actual manifest description.
71
+ class ActualManifest
72
+ attr_reader :manifest_file
73
+ attr_reader :digital_resource_id
74
+
75
+ def initialize(
76
+ source_manifest,
77
+ manifest_file,
78
+ digital_resource_id )
79
+ @source_manifest = source_manifest
80
+ @manifest_file = manifest_file
81
+ @digital_resource_id = digital_resource_id
82
+ end
83
+
84
+ # Is autogeneration of manifest must be used?
85
+ def autogen?
86
+ @source_manifest.autogen
87
+ end
88
+
89
+ # Is manifest tool (mt.exe) must be used?
90
+ def mt?
91
+ @source_manifest.mt
92
+ end
93
+
94
+ # Is autogenerated manifest file should be kept after
95
+ # embeding into executable?
96
+ # By default autogenerated manifest file will be deleted.
97
+ def keep_manifest_file?
98
+ ( mt? and autogen? ) ? @source_manifest.keep_manifest_file : true
99
+ end
100
+ end # class ActualManifest
101
+
102
+ # For compatibility with previous versions.
103
+ Actual_manifest = ActualManifest
104
+
105
+ @@default_manifest = OpenStruct.new(
106
+ :autogen => true,
107
+ :mt => true,
108
+ :manifest_file => :default,
109
+ :resource_id => :default,
110
+ :keep_manifest_file => false )
111
+
112
+ # Set of avaliable values for :resource_id key-value pair
113
+ # in manifest description.
114
+ @@resource_id_names = Set.new( [
115
+ :default,
116
+ :process_manifest,
117
+ :isolationaware_manifest,
118
+ :isolationaware_nostaticimport_manifest ] )
119
+
120
+ public
121
+ def initialize( a_name = "vc" )
122
+ super( a_name )
123
+ end
124
+
125
+ # Check some VC8.0 constraints before calling superclass
126
+ # implementation
127
+ #
128
+ # VC8.0 does not support Single-Thread Run-Time.
129
+ def setup_mandatory_options( target )
130
+ if THREADING_SINGLE == target.mxx_threading_mode
131
+ raise MxxRu::UnsupportedModeEx.new(
132
+ "Visual C++ 2005 and above doesn't support " +
133
+ "single-threaded static RTL" )
134
+ elsif THREADING_DEFAULT == target.mxx_threading_mode
135
+ # Because VC8.0 doesn't support Single Thread Run-Time then
136
+ # by default we must use Mutli-Threading Run-Time.
137
+ target.threading_mode( THREADING_MULTI )
138
+ end
139
+
140
+ super( target )
141
+
142
+ setup_manifest( target )
143
+ setup_manifest_params( target )
144
+ end
145
+
146
+ # Remove autogenerated manifest file if any.
147
+ def clean_dll_specific_files( dll_file, dll_info, target )
148
+ super( dll_file, dll_info, target )
149
+ clean_autogenerated_manifest( target )
150
+ end
151
+
152
+ # Remove autogenerated manifest file if any.
153
+ def clean_exe_specific_files( exe_file, exe_info, target )
154
+ super( exe_file, exe_info, target )
155
+ clean_autogenerated_manifest( target )
156
+ end
157
+
158
+ # Append command line for embeding manifest file to result
159
+ # of super class implementation.
160
+ def make_dll_command_lines(
161
+ dll_name,
162
+ dll_info,
163
+ linker_lists,
164
+ target )
165
+
166
+ append_mt_command_lines(
167
+ super( dll_name, dll_info, linker_lists, target ),
168
+ dll_name,
169
+ target )
170
+ end
171
+
172
+ # Append command line for embeding manifest file to result
173
+ # of super class implementation.
174
+ def make_exe_command_lines(
175
+ exe_name,
176
+ exe_info,
177
+ linker_lists,
178
+ target )
179
+ append_mt_command_lines(
180
+ super( exe_name, exe_info, linker_lists, target ),
181
+ exe_name,
182
+ target )
183
+ end
184
+
185
+ # Make manifest description.
186
+ #
187
+ # Examples:
188
+ # # Autogenerate manifest for target. Do not embed into executable.
189
+ # # Manifest stored in <target>.manifest file.
190
+ # MxxRu::Cpp::Toolsets::Vc8::manifest(
191
+ # :target => self,
192
+ # :autogen => :to_default_file )
193
+ #
194
+ # # Autogenerate manifest for target. Embed into executable.
195
+ # # Autogenerated manifest will be deleted after embeding.
196
+ # MxxRu::Cpp::Toolsets::Vc8::manifest(
197
+ # :target => self,
198
+ # :autogen => :to_default_file,
199
+ # :mt => {} )
200
+ #
201
+ # # Autogenerate manifest for target. Embed into executable.
202
+ # # Autogenerated manifest will be kept after embeding.
203
+ # MxxRu::Cpp::Toolsets::Vc8::manifest(
204
+ # :target => self,
205
+ # :autogen => :to_default_file,
206
+ # :mt => { :keep_manifest_file => true } )
207
+ #
208
+ # # Autogenerate manifest for target. Embed into executable as
209
+ # # resource with id CREATEPROCESS_MANIFEST_RESOURCE_ID id.
210
+ # MxxRu::Cpp::Toolsets::Vc8::manifest(
211
+ # :target => self,
212
+ # :autogen => :to_default_file,
213
+ # :mt => { :resource_id => :process_manifest } )
214
+ #
215
+ # # Autogenerate manifest for target. Store manifest into
216
+ # # file 'hello_world.exe.manifest'. Embed info executable.
217
+ # MxxRu::Cpp::Toolsets::Vc8::manifest(
218
+ # :target => self,
219
+ # :autogen => 'hello_world.exe.manifest',
220
+ # :mt => {} )
221
+ #
222
+ # # Embed manifest from file 'hello_world.exe.manifest' into
223
+ # # target executable.
224
+ # MxxRu::Cpp::Toolsets::Vc8::manifest(
225
+ # :target => self,
226
+ # :mt => { :manifest => 'hello_world.exe.manifest' } )
227
+ # # Embed manifest from file 'hello_world.dll.manifest' into
228
+ # # target executable as resource with
229
+ # # ISOLATIONAWARE_NOSTATICIMPORT_MANIFEST_RESOURCE_ID id.
230
+ # MxxRu::Cpp::Toolsets::Vc8::manifest(
231
+ # :target => self,
232
+ # :mt => { :manifest => 'hello_world.exe.manifest',
233
+ # :resource_id => :isolationaware_nonstaticimport } )
234
+ #
235
+ # # Autogenerate manifest for all targets in build. Store manifest
236
+ # # in default files. Do not embed manifest into executable.
237
+ # MxxRu::Cpp::Toolsets::Vc8::manifest(
238
+ # :autogen => :to_default_file )
239
+ #
240
+ # # Autogenerate manifest for all targets in build. Store manifest
241
+ # # in default files. Embed manifest into executable.
242
+ # MxxRu::Cpp::Toolsets::Vc8::manifest(
243
+ # :autogen => :to_default_file,
244
+ # :mt => {} )
245
+ #
246
+ # # Drop default manifest for build. Only explicitly specified
247
+ # # manifest will be generated.
248
+ # MxxRu::Cpp::Toolsets::Vc8::manifest( nil )
249
+ #
250
+ def self.manifest( params )
251
+ if nil == params
252
+ # No default manifest.
253
+ @@default_manifest = nil
254
+ else
255
+ check_manifest_params( params )
256
+
257
+ d = OpenStruct.new( :keep_manifest_file => true )
258
+
259
+ if params.key?( :autogen )
260
+ d.autogen = true
261
+ d.manifest_file = ( params[ :autogen ] == :to_default_file ?
262
+ :default : params[ :autogen ] )
263
+ d.keep_manifest_file = false
264
+ else
265
+ d.autogen = false
266
+ end
267
+
268
+ if params.key?( :mt ) && nil != params[ :mt ]
269
+ d.mt = true
270
+ mt_params = params[ :mt ]
271
+ d.manifest_file = mt_params[ :manifest ] if
272
+ mt_params.key?( :manifest )
273
+ d.resource_id = ( mt_params.key?( :resource_id ) ?
274
+ mt_params[ :resource_id ] : :default )
275
+
276
+ if mt_params.key?( :keep_manifest_file ) and
277
+ params.key?( :autogen )
278
+ d.keep_manifest_file = mt_params[ :keep_manifest_file ]
279
+ end
280
+ else
281
+ d.mt = false
282
+ end
283
+
284
+ if params.key?( :target )
285
+ # Source manifest must be set for specified target.
286
+ params[ :target ].vc8_source_manifest = d
287
+ else
288
+ # This is new default manifest.
289
+ @@default_manifest = d
290
+ end
291
+ end
292
+ end
293
+
294
+ # Get default manifest.
295
+ def self.default_manifest
296
+ @@default_manifest
297
+ end
298
+
299
+ protected
300
+ # Set actual manifest for target if source manifest defined
301
+ # (or default manifest exists).
302
+ def setup_manifest( target )
303
+ # Manifest can be set only for EXE or DLL.
304
+ if ExeTargetType::TYPE == target.target_type.name or
305
+ DllTargetType::TYPE == target.target_type.name
306
+ desc = target.vc8_source_manifest
307
+
308
+ if nil != desc
309
+ # Actual manifest must be created for target.
310
+ manifest_file =
311
+ if :default == desc.manifest_file
312
+ # We must create name for manifest.
313
+ if ExeTargetType::TYPE == target.target_type.name
314
+ make_exe_name(
315
+ target.mxx_target_name,
316
+ target ).full_name
317
+ else
318
+ make_dll_name(
319
+ target.mxx_target_name,
320
+ target ).full_name
321
+ end + ".manifest"
322
+ else
323
+ # Manifest filename already specified.
324
+ desc.manifest_file
325
+ end
326
+
327
+ # If mt.exe will be used then we must determine
328
+ # digital resource_id for manifest resource.
329
+ digital_resource_id =
330
+ if desc.mt
331
+ case desc.resource_id
332
+ when :default:
333
+ # Resource ID must be caclulated based on
334
+ # target type.
335
+ ExeTargetType::TYPE == target.target_type.name ? 1 : 2
336
+ when :process_manifest: 1
337
+ when :isolationaware_manifest: 2
338
+ else
339
+ # :isolationaware_nostaticimport_manifest
340
+ 3
341
+ end
342
+ else
343
+ nil
344
+ end
345
+
346
+ target.vc8_actual_manifest = ActualManifest.new(
347
+ desc,
348
+ manifest_file,
349
+ digital_resource_id )
350
+ end
351
+ end
352
+ end
353
+
354
+ # Setup linker params for processing target manifest.
355
+ def setup_manifest_params( target )
356
+ m = target.vc8_actual_manifest
357
+ if nil != m and m.autogen?
358
+ # Linker must generate manifest.
359
+ target.linker_option( '/MANIFEST' )
360
+ target.linker_option( '/MANIFESTFILE:' + m.manifest_file )
361
+ else
362
+ # Linker should not generate manifest.
363
+ target.linker_option( '/MANIFEST:NO' )
364
+ end
365
+ end
366
+
367
+ # Remove autogenerated manifest file if any.
368
+ def clean_autogenerated_manifest( target )
369
+ m = target.vc8_actual_manifest
370
+ MxxRu::Util::delete_file( m.manifest_file ) if
371
+ m != nil and m.autogen?
372
+ end
373
+
374
+ # Append command line for embeding manifest file to end of
375
+ # specified command line list.
376
+ def append_mt_command_lines(
377
+ cmd_lines,
378
+ target_name,
379
+ target )
380
+
381
+ m = target.vc8_actual_manifest
382
+ if nil != m and m.mt?
383
+ cmd_lines << "#{mt_name} /nologo " +
384
+ "/outputresource:\"#{target_name};\#" +
385
+ "#{m.digital_resource_id}\" " +
386
+ "/manifest \"#{m.manifest_file}\""
387
+
388
+ if !m.keep_manifest_file?
389
+ # del utility doesn't work with unix slashes
390
+ cmd_lines << "del \"#{MxxRu::Util::native_pathname(m.manifest_file)}\""
391
+ end
392
+ end
393
+
394
+ cmd_lines
395
+ end
396
+
397
+ # Name of manifest tool executable
398
+ def mt_name
399
+ tag( MT_NAME_TAG, "mt" )
400
+ end
401
+
402
+ # Checking manifest params validity.
403
+ def self.check_manifest_params( params )
404
+ if nil != params
405
+ if params.key?( :mt )
406
+ mt_hash = params[ :mt ]
407
+
408
+ # :resource_id must have one of avaliable values.
409
+ if mt_hash.key?( :resource_id ) and
410
+ !@@resource_id_names.member?( mt_hash[ :resource_id ] )
411
+ raise InvalidValueEx.new(
412
+ "invalid value for :resource_id key: " +
413
+ "'#{mt_hash[:resource_id]}'" )
414
+ end
415
+
416
+ if !mt_hash.key?( :manifest ) and
417
+ !params.key?( :autogen )
418
+
419
+ raise InvalidValueEx.new(
420
+ "no manifest file name specified" )
421
+ end
422
+
423
+ # :keep_manifest_file should be Bool.
424
+ if mt_hash.key?( :keep_manifest_file ) and
425
+ true != mt_hash[ :keep_manifest_file ] and
426
+ false != mt_hash[ :keep_manifest_file ]
427
+ raise InvalidValueEx.new(
428
+ "value for :keep_manifest_file should be 'true' " +
429
+ "or 'false'" )
430
+ end
431
+ end
432
+
433
+ if params.key?( :autogen )
434
+ v = params[ :autogen ]
435
+ if !( v == :to_default_file or
436
+ v.kind_of?( String ) )
437
+ raise InvalidValueEx.new(
438
+ "invalid value for :autogen (must be " +
439
+ ":to_default_file or String instance)" )
440
+ end
441
+ end
442
+ end
443
+ end
444
+
445
+ end # class Vc8Family
446
+
447
+ end # module Toolsets
448
+
449
+ end # module Cpp
450
+
451
+ end # module MxxRu
452
+
@@ -0,0 +1,58 @@
1
+ #--
2
+ # Copyright (c) 1996-2004, Yauheni Akhotnikau
3
+ # Copyright (c) 2004-2006, JSC Intervale
4
+ # Copyright (c) 2006-2008, The Mxx_ru Project
5
+ # All rights reserved.
6
+ #
7
+ # Redistribution and use in source and binary forms, with or without modification,
8
+ # are permitted provided that the following conditions are met:
9
+ #
10
+ # 1. Redistributions of source code must retain the above copyright notice,
11
+ # this list of conditions and the following disclaimer.
12
+ # 2. Redistributions in binary form must reproduce the above copyright notice,
13
+ # this list of conditions and the following disclaimer in the documentation
14
+ # and/or other materials provided with the distribution.
15
+ # 3. The name of the author may not be used to endorse or promote products derived
16
+ # from this software without specific prior written permission.
17
+ #
18
+ # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
19
+ # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
20
+ # AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
21
+ # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22
+ # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23
+ # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24
+ # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
25
+ # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
26
+ # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
+ #++
28
+
29
+ require 'ostruct'
30
+ require 'set'
31
+
32
+ require 'mxx_ru/cpp/target'
33
+ require 'mxx_ru/cpp/toolsets/vc8_family'
34
+
35
+ module MxxRu
36
+ module Cpp
37
+ module Toolsets
38
+
39
+ # Toolset implementation for Visual C++ 9.0
40
+ #
41
+ # Setups following tags:
42
+ # [_ver_hi_] high version number. Value: 9.
43
+ # [_ver_lo_] low version number. Value: 0.
44
+ class Vc9 < MxxRu::Cpp::Toolsets::Vc8Family
45
+ def initialize( a_name = "vc" )
46
+ super( a_name )
47
+
48
+ setup_tag( "ver_hi", "9" )
49
+ setup_tag( "ver_lo", "0" )
50
+ end
51
+ end # class Vc9
52
+
53
+ end # module Toolsets
54
+ end # module Cpp
55
+ end # module MxxRu
56
+
57
+ MxxRu::Cpp::setup_toolset( MxxRu::Cpp::Toolsets::Vc9.new )
58
+
@@ -34,5 +34,5 @@
34
34
  #
35
35
  # puts 'Mxx_ru version is: ' + MXX_RU_VERSION
36
36
  #
37
- MXX_RU_VERSION = '1.4.4'
37
+ MXX_RU_VERSION = '1.4.5'
38
38
 
@@ -1,6 +1,6 @@
1
- #include <cstdio>
2
-
3
- void B() {
4
- std::printf( "B\n" );
5
- }
6
-
1
+ #include <cstdio>
2
+
3
+ void B() {
4
+ std::printf( "B\n" );
5
+ }
6
+
@@ -1,10 +1,10 @@
1
- void A();
2
- void B();
3
-
4
- int main() {
5
- A();
6
- B();
7
-
8
- return 0;
9
- }
10
-
1
+ void A();
2
+ void B();
3
+
4
+ int main() {
5
+ A();
6
+ B();
7
+
8
+ return 0;
9
+ }
10
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: Mxx_ru
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.4
4
+ version: 1.4.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - The Mxx_ru Project
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-04-03 00:00:00 +04:00
12
+ date: 2008-04-14 00:00:00 +04:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -86,7 +86,6 @@ files:
86
86
  - tests/cpp/lib_from_lib_dependecies/etalon/second.txt
87
87
  - tests/cpp/lib_from_lib_dependecies/first.ut.rb
88
88
  - tests/cpp/lib_from_lib_dependecies/o
89
- - tests/cpp/lib_from_lib_dependecies/o/main.obj
90
89
  - tests/cpp/lib_from_lib_dependecies/out
91
90
  - tests/cpp/lib_from_lib_dependecies/second.ut.rb
92
91
  - tests/cpp/lib_from_lib_dependecies/tc_checker.rb
@@ -373,6 +372,8 @@ files:
373
372
  - lib/mxx_ru/cpp/toolsets/gcc_unix_family.rb
374
373
  - lib/mxx_ru/cpp/toolsets/vc7.rb
375
374
  - lib/mxx_ru/cpp/toolsets/vc8.rb
375
+ - lib/mxx_ru/cpp/toolsets/vc8_family.rb
376
+ - lib/mxx_ru/cpp/toolsets/vc9.rb
376
377
  - lib/mxx_ru/cpp/toolsets/vc_family.rb
377
378
  - lib/mxx_ru/cpp.rb
378
379
  - lib/mxx_ru/ex.rb