Mxx_ru 1.1.0

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.
Files changed (147) hide show
  1. data/COPYING +26 -0
  2. data/NEWS +52 -0
  3. data/README +21 -0
  4. data/Rakefile +32 -0
  5. data/examples/exe_and_lib/main.cpp +15 -0
  6. data/examples/exe_and_lib/prj.rb +11 -0
  7. data/examples/exe_and_lib/say.cpp +13 -0
  8. data/examples/exe_and_lib/say.hpp +11 -0
  9. data/examples/exe_and_lib/say.rb +7 -0
  10. data/examples/exe_dll_lib/inout.cpp +15 -0
  11. data/examples/exe_dll_lib/inout.hpp +26 -0
  12. data/examples/exe_dll_lib/inout.rb +18 -0
  13. data/examples/exe_dll_lib/main.cpp +23 -0
  14. data/examples/exe_dll_lib/prj.rb +11 -0
  15. data/examples/exe_dll_lib/say.cpp +13 -0
  16. data/examples/exe_dll_lib/say.hpp +12 -0
  17. data/examples/exe_dll_lib/say.rb +9 -0
  18. data/examples/exe_dll_lib_2/build.rb +7 -0
  19. data/examples/exe_dll_lib_2/inout/inout.cpp +15 -0
  20. data/examples/exe_dll_lib_2/inout/inout.hpp +26 -0
  21. data/examples/exe_dll_lib_2/inout/prj.rb +16 -0
  22. data/examples/exe_dll_lib_2/main/main.cpp +23 -0
  23. data/examples/exe_dll_lib_2/main/prj.rb +9 -0
  24. data/examples/exe_dll_lib_2/say/prj.rb +8 -0
  25. data/examples/exe_dll_lib_2/say/say.cpp +13 -0
  26. data/examples/exe_dll_lib_2/say/say.hpp +12 -0
  27. data/examples/simple_exe/main.cpp +26 -0
  28. data/examples/simple_exe/prj.rb +7 -0
  29. data/lib/mxx_ru/abstract_target.rb +283 -0
  30. data/lib/mxx_ru/binary_target.rb +89 -0
  31. data/lib/mxx_ru/binary_unittest.rb +130 -0
  32. data/lib/mxx_ru/cpp/analyzer.rb +230 -0
  33. data/lib/mxx_ru/cpp/composite.rb +106 -0
  34. data/lib/mxx_ru/cpp/detect_toolset.rb +122 -0
  35. data/lib/mxx_ru/cpp/mode.rb +85 -0
  36. data/lib/mxx_ru/cpp/obj_placement.rb +321 -0
  37. data/lib/mxx_ru/cpp/qt.rb +333 -0
  38. data/lib/mxx_ru/cpp/rucodegen.rb +114 -0
  39. data/lib/mxx_ru/cpp/source_file.rb +71 -0
  40. data/lib/mxx_ru/cpp/target.rb +1371 -0
  41. data/lib/mxx_ru/cpp/toolset.rb +1029 -0
  42. data/lib/mxx_ru/cpp/toolsets/bcc_win32_5.rb +52 -0
  43. data/lib/mxx_ru/cpp/toolsets/bcc_win32_family.rb +451 -0
  44. data/lib/mxx_ru/cpp/toolsets/c89_etk_nsk.rb +56 -0
  45. data/lib/mxx_ru/cpp/toolsets/c89_nsk.rb +56 -0
  46. data/lib/mxx_ru/cpp/toolsets/c89_nsk_family.rb +273 -0
  47. data/lib/mxx_ru/cpp/toolsets/gcc_cygwin.rb +54 -0
  48. data/lib/mxx_ru/cpp/toolsets/gcc_family.rb +382 -0
  49. data/lib/mxx_ru/cpp/toolsets/gcc_linux.rb +60 -0
  50. data/lib/mxx_ru/cpp/toolsets/gcc_mingw.rb +144 -0
  51. data/lib/mxx_ru/cpp/toolsets/gcc_sparc_solaris.rb +87 -0
  52. data/lib/mxx_ru/cpp/toolsets/vc7.rb +62 -0
  53. data/lib/mxx_ru/cpp/toolsets/vc8.rb +452 -0
  54. data/lib/mxx_ru/cpp/toolsets/vc_family.rb +428 -0
  55. data/lib/mxx_ru/cpp.rb +36 -0
  56. data/lib/mxx_ru/ex.rb +134 -0
  57. data/lib/mxx_ru/makestyle_generator.rb +138 -0
  58. data/lib/mxx_ru/textfile_unittest.rb +284 -0
  59. data/lib/mxx_ru/util.rb +258 -0
  60. data/tests/c/pcre/chartables.c +183 -0
  61. data/tests/c/pcre/config.h +99 -0
  62. data/tests/c/pcre/dftables.c +167 -0
  63. data/tests/c/pcre/get.c +349 -0
  64. data/tests/c/pcre/internal.h +677 -0
  65. data/tests/c/pcre/maketables.c +140 -0
  66. data/tests/c/pcre/pcre.c +8304 -0
  67. data/tests/c/pcre/pcre.h +193 -0
  68. data/tests/c/pcre/pcre.rb +14 -0
  69. data/tests/c/pcre/pcredemo.c +316 -0
  70. data/tests/c/pcre/pcregrep.c +642 -0
  71. data/tests/c/pcre/pcreposix.c +305 -0
  72. data/tests/c/pcre/pcreposix.h +88 -0
  73. data/tests/c/pcre/pcretest.c +1483 -0
  74. data/tests/c/pcre/perltest +211 -0
  75. data/tests/c/pcre/printint.c +360 -0
  76. data/tests/c/pcre/study.c +472 -0
  77. data/tests/cpp/mswin_res_dll/build.rb +14 -0
  78. data/tests/cpp/mswin_res_dll/dll.cpp +17 -0
  79. data/tests/cpp/mswin_res_dll/dll.rb +30 -0
  80. data/tests/cpp/mswin_res_dll/dll.rc +48 -0
  81. data/tests/cpp/mswin_res_dll/h/dll.hpp +8 -0
  82. data/tests/cpp/mswin_res_dll/h/res.h +3 -0
  83. data/tests/cpp/mswin_res_dll/main.cpp +13 -0
  84. data/tests/cpp/mswin_res_dll/main.rb +20 -0
  85. data/tests/cpp/mswin_res_dll/res/tree_fol.bmp +0 -0
  86. data/tests/cpp/mswin_res_dll/res/tree_state_1.bmp +0 -0
  87. data/tests/cpp/mswin_res_dll/res/tree_state_2.bmp +0 -0
  88. data/tests/cpp/mswin_res_exe/build.rb +23 -0
  89. data/tests/cpp/mswin_res_exe/h/res.h +3 -0
  90. data/tests/cpp/mswin_res_exe/main.cpp +17 -0
  91. data/tests/cpp/mswin_res_exe/main.rc +48 -0
  92. data/tests/cpp/mswin_res_exe/res/tree_fol.bmp +0 -0
  93. data/tests/cpp/mswin_res_exe/res/tree_state_1.bmp +0 -0
  94. data/tests/cpp/mswin_res_exe/res/tree_state_2.bmp +0 -0
  95. data/tests/cpp/rucodegen/host_config.cpp +20 -0
  96. data/tests/cpp/rucodegen/host_config.rb +14 -0
  97. data/tests/cpp/rucodegen/impl/conn_params.cpp +7 -0
  98. data/tests/cpp/rucodegen/impl/conn_params.rb +14 -0
  99. data/tests/cpp/rucodegen/impl/h/conn_params.hpp +10 -0
  100. data/tests/cpp/rucodegen/prj.rb +17 -0
  101. data/tests/cpp/textfile_unittest/build.rb +8 -0
  102. data/tests/cpp/textfile_unittest/etalons/out_0.txt +0 -0
  103. data/tests/cpp/textfile_unittest/etalons/out_1.txt +1 -0
  104. data/tests/cpp/textfile_unittest/etalons/out_128.txt +128 -0
  105. data/tests/cpp/textfile_unittest/main.cpp +89 -0
  106. data/tests/cpp/textfile_unittest/prj.rb +8 -0
  107. data/tests/cpp/textfile_unittest/prj.ut.rb +18 -0
  108. data/tests/cpp/toolset_name.rb +6 -0
  109. data/tests/cpp/vc_cleanup/cout.log +72 -0
  110. data/tests/cpp/vc_cleanup/dll_hi.cpp +5 -0
  111. data/tests/cpp/vc_cleanup/exe_hi.cpp +10 -0
  112. data/tests/cpp/vc_cleanup/lib_hi.cpp +5 -0
  113. data/tests/cpp/vc_cleanup/prj_dll_no_implib.rb +10 -0
  114. data/tests/cpp/vc_cleanup/prj_dll_no_implib_simple_target_root.rb +11 -0
  115. data/tests/cpp/vc_cleanup/prj_dll_with_implib.rb +11 -0
  116. data/tests/cpp/vc_cleanup/prj_dll_with_implib_simple_target_root.rb +14 -0
  117. data/tests/cpp/vc_cleanup/prj_exe_no_implib.rb +10 -0
  118. data/tests/cpp/vc_cleanup/prj_exe_no_implib_simple_target_root.rb +11 -0
  119. data/tests/cpp/vc_cleanup/prj_lib.rb +10 -0
  120. data/tests/cpp/vc_cleanup/prj_lib_with_simple_target_root.rb +11 -0
  121. data/tests/cpp/vc_cleanup/tc_vc_cleanup.rb +60 -0
  122. data/tests/mxx_ru/change_default_value/ignoring_by_build_root/build.rb +8 -0
  123. data/tests/mxx_ru/change_default_value/ignoring_by_build_root/child_1.rb +5 -0
  124. data/tests/mxx_ru/change_default_value/ignoring_by_child_1/build.rb +7 -0
  125. data/tests/mxx_ru/change_default_value/ignoring_by_child_1/child_1.rb +5 -0
  126. data/tests/mxx_ru/change_default_value/ignoring_by_child_1/child_2.rb +5 -0
  127. data/tests/mxx_ru/change_default_value/ok/build.rb +8 -0
  128. data/tests/mxx_ru/change_default_value/ok/child_1.rb +8 -0
  129. data/tests/mxx_ru/tc_makestyle_generator.rb +117 -0
  130. data/tests/mxx_ru/vc8/tc_actual_manifest.rb +230 -0
  131. data/tests/mxx_ru/vc8/tc_append_mt_commands.rb +104 -0
  132. data/tests/mxx_ru/vc8/tc_default_manifest.rb +17 -0
  133. data/tests/mxx_ru/vc8/tc_define_manifest.rb +173 -0
  134. data/tests/mxx_ru/vc8/tc_drop_default_manifest.rb +16 -0
  135. data/tests/mxx_ru/vc8/tc_invalid_params.rb +81 -0
  136. data/tests/mxx_ru/vc8/ts_vc8.rb +10 -0
  137. data/tests/qt/aclock/aclock.cpp +148 -0
  138. data/tests/qt/aclock/aclock.h +45 -0
  139. data/tests/qt/aclock/main.cpp +28 -0
  140. data/tests/qt/aclock/prj.rb +21 -0
  141. data/tests/qt/iconview/main.cpp +76 -0
  142. data/tests/qt/iconview/prj.rb +21 -0
  143. data/tests/qt/toplevel/main.cpp +9 -0
  144. data/tests/qt/toplevel/options.ui +587 -0
  145. data/tests/qt/toplevel/options.ui.h +98 -0
  146. data/tests/qt/toplevel/prj.rb +21 -0
  147. metadata +241 -0
@@ -0,0 +1,452 @@
1
+ #--
2
+ # Copyright (c) 1996-2004, Yauheni Akhotnikau
3
+ # Copyright (c) 2004-2006, JSC Intervale
4
+ # Copyright (c) 2006, 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 Mxx_ru
36
+ module Cpp
37
+
38
+ # Expand class Target to store source and actual manifest descriptions.
39
+ class Target < Mxx_ru::Binary_target
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
+ Mxx_ru::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
+ module Toolsets
60
+
61
+ # Toolset implementation for Visual C++ 2005 (8.0)
62
+ #
63
+ # Setups following tags:
64
+ # [_ver_hi_] high version number. Value: 8.
65
+ # [_ver_lo_] low version number. Value: 0.
66
+ class Vc8 < Mxx_ru::Cpp::Toolsets::Vc_family
67
+
68
+ # Actual manifest description.
69
+ class Actual_manifest
70
+ attr_reader :manifest_file
71
+ attr_reader :digital_resource_id
72
+
73
+ def initialize(
74
+ source_manifest,
75
+ manifest_file,
76
+ digital_resource_id )
77
+ @source_manifest = source_manifest
78
+ @manifest_file = manifest_file
79
+ @digital_resource_id = digital_resource_id
80
+ end
81
+
82
+ # Is autogeneration of manifest must be used?
83
+ def autogen?
84
+ @source_manifest.autogen
85
+ end
86
+
87
+ # Is manifest tool (mt.exe) must be used?
88
+ def mt?
89
+ @source_manifest.mt
90
+ end
91
+
92
+ # Is autogenerated manifest file should be kept after
93
+ # embeding into executable?
94
+ # By default autogenerated manifest file will be deleted.
95
+ def keep_manifest_file?
96
+ ( mt? and autogen? ) ? @source_manifest.keep_manifest_file : true
97
+ end
98
+ end # class Actual_manifest
99
+
100
+ @@default_manifest = OpenStruct.new(
101
+ :autogen => true,
102
+ :mt => true,
103
+ :manifest_file => :default,
104
+ :resource_id => :default,
105
+ :keep_manifest_file => false )
106
+
107
+ # Set of avaliable values for :resource_id key-value pair
108
+ # in manifest description.
109
+ @@resource_id_names = Set.new( [
110
+ :default,
111
+ :process_manifest,
112
+ :isolationaware_manifest,
113
+ :isolationaware_nostaticimport_manifest ] )
114
+
115
+ public
116
+ def initialize( a_name = "vc" )
117
+ super( a_name )
118
+
119
+ setup_tag( "ver_hi", "8" )
120
+ setup_tag( "ver_lo", "0" )
121
+ end
122
+
123
+ # Check some VC8.0 constraints before calling superclass
124
+ # implementation
125
+ #
126
+ # VC8.0 does not support Single-Thread Run-Time.
127
+ def setup_mandatory_options( target )
128
+ if THREADING_SINGLE == target.mxx_threading_mode
129
+ raise Mxx_ru::Unsupported_mode_ex.new(
130
+ "Visual C++ 2005 not supports " +
131
+ "single-threaded static RTL" )
132
+ elsif THREADING_DEFAULT == target.mxx_threading_mode
133
+ # Because VC8.0 not support Single Thread Run-Time then
134
+ # by default we must use Mutli-Threading Run-Time.
135
+ target.threading_mode( THREADING_MULTI )
136
+ end
137
+
138
+ super( target )
139
+
140
+ setup_manifest( target )
141
+ setup_manifest_params( target )
142
+ end
143
+
144
+ # Remove autogenerated manifest file if any.
145
+ def clean_dll_specific_files( dll_file, dll_info, target )
146
+ super( dll_file, dll_info, target )
147
+ clean_autogenerated_manifest( target )
148
+ end
149
+
150
+ # Remove autogenerated manifest file if any.
151
+ def clean_exe_specific_files( exe_file, exe_info, target )
152
+ super( exe_file, exe_info, target )
153
+ clean_autogenerated_manifest( target )
154
+ end
155
+
156
+ # Append command line for embeding manifest file to result
157
+ # of super class implementation.
158
+ def make_dll_command_lines(
159
+ dll_name,
160
+ dll_info,
161
+ linker_lists,
162
+ target )
163
+
164
+ append_mt_command_lines(
165
+ super( dll_name, dll_info, linker_lists, target ),
166
+ dll_name,
167
+ target )
168
+ end
169
+
170
+ # Append command line for embeding manifest file to result
171
+ # of super class implementation.
172
+ def make_exe_command_lines(
173
+ exe_name,
174
+ exe_info,
175
+ linker_lists,
176
+ target )
177
+ append_mt_command_lines(
178
+ super( exe_name, exe_info, linker_lists, target ),
179
+ exe_name,
180
+ target )
181
+ end
182
+
183
+ # Make manifest description.
184
+ #
185
+ # Examples:
186
+ # # Autogenerate manifest for target. Do not embed into executable.
187
+ # # Manifest stored in <target>.manifest file.
188
+ # Mxx_ru::Cpp::Toolsets::Vc8::manifest(
189
+ # :target => self,
190
+ # :autogen => :to_default_file )
191
+ #
192
+ # # Autogenerate manifest for target. Embed into executable.
193
+ # # Autogenerated manifest will be deleted after embeding.
194
+ # Mxx_ru::Cpp::Toolsets::Vc8::manifest(
195
+ # :target => self,
196
+ # :autogen => :to_default_file,
197
+ # :mt => {} )
198
+ #
199
+ # # Autogenerate manifest for target. Embed into executable.
200
+ # # Autogenerated manifest will be kept after embeding.
201
+ # Mxx_ru::Cpp::Toolsets::Vc8::manifest(
202
+ # :target => self,
203
+ # :autogen => :to_default_file,
204
+ # :mt => { :keep_manifest_file => true } )
205
+ #
206
+ # # Autogenerate manifest for target. Embed into executable as
207
+ # # resource with id CREATEPROCESS_MANIFEST_RESOURCE_ID id.
208
+ # Mxx_ru::Cpp::Toolsets::Vc8::manifest(
209
+ # :target => self,
210
+ # :autogen => :to_default_file,
211
+ # :mt => { :resource_id => :process_manifest } )
212
+ #
213
+ # # Autogenerate manifest for target. Store manifest into
214
+ # # file 'hello_world.exe.manifest'. Embed info executable.
215
+ # Mxx_ru::Cpp::Toolsets::Vc8::manifest(
216
+ # :target => self,
217
+ # :autogen => 'hello_world.exe.manifest',
218
+ # :mt => {} )
219
+ #
220
+ # # Embed manifest from file 'hello_world.exe.manifest' into
221
+ # # target executable.
222
+ # Mxx_ru::Cpp::Toolsets::Vc8::manifest(
223
+ # :target => self,
224
+ # :mt => { :manifest => 'hello_world.exe.manifest' } )
225
+ # # Embed manifest from file 'hello_world.dll.manifest' into
226
+ # # target executable as resource with
227
+ # # ISOLATIONAWARE_NOSTATICIMPORT_MANIFEST_RESOURCE_ID id.
228
+ # Mxx_ru::Cpp::Toolsets::Vc8::manifest(
229
+ # :target => self,
230
+ # :mt => { :manifest => 'hello_world.exe.manifest',
231
+ # :resource_id => :isolationaware_nonstaticimport } )
232
+ #
233
+ # # Autogenerate manifest for all targets in build. Store manifest
234
+ # # in default files. Do not embed manifest into executable.
235
+ # Mxx_ru::Cpp::Toolsets::Vc8::manifest(
236
+ # :autogen => :to_default_file )
237
+ #
238
+ # # Autogenerate manifest for all targets in build. Store manifest
239
+ # # in default files. Embed manifest into executable.
240
+ # Mxx_ru::Cpp::Toolsets::Vc8::manifest(
241
+ # :autogen => :to_default_file,
242
+ # :mt => {} )
243
+ #
244
+ # # Drop default manifest for build. Only explicitly specified
245
+ # # manifest will be generated.
246
+ # Mxx_ru::Cpp::Toolsets::Vc8::manifest( nil )
247
+ #
248
+ def self.manifest( params )
249
+ if nil == params
250
+ # No default manifest.
251
+ @@default_manifest = nil
252
+ else
253
+ check_manifest_params( params )
254
+
255
+ d = OpenStruct.new( :keep_manifest_file => true )
256
+
257
+ if params.key?( :autogen )
258
+ d.autogen = true
259
+ d.manifest_file = ( params[ :autogen ] == :to_default_file ?
260
+ :default : params[ :autogen ] )
261
+ d.keep_manifest_file = false
262
+ else
263
+ d.autogen = false
264
+ end
265
+
266
+ if params.key?( :mt ) && nil != params[ :mt ]
267
+ d.mt = true
268
+ mt_params = params[ :mt ]
269
+ d.manifest_file = mt_params[ :manifest ] if
270
+ mt_params.key?( :manifest )
271
+ d.resource_id = ( mt_params.key?( :resource_id ) ?
272
+ mt_params[ :resource_id ] : :default )
273
+
274
+ if mt_params.key?( :keep_manifest_file ) and
275
+ params.key?( :autogen )
276
+ d.keep_manifest_file = mt_params[ :keep_manifest_file ]
277
+ end
278
+ else
279
+ d.mt = false
280
+ end
281
+
282
+ if params.key?( :target )
283
+ # Source manifest must be set for specified target.
284
+ params[ :target ].vc8_source_manifest = d
285
+ else
286
+ # This is new default manifest.
287
+ @@default_manifest = d
288
+ end
289
+ end
290
+ end
291
+
292
+ # Get default manifest.
293
+ def self.default_manifest
294
+ @@default_manifest
295
+ end
296
+
297
+ protected
298
+ # Set actual manifest for target if source manifest defined
299
+ # (or default manifest exists).
300
+ def setup_manifest( target )
301
+ # Manifest can be set only for EXE or DLL.
302
+ if Exe_target_type::TYPE == target.target_type.name or
303
+ Dll_target_type::TYPE == target.target_type.name
304
+ desc = target.vc8_source_manifest
305
+
306
+ if nil != desc
307
+ # Actual manifest must be created for target.
308
+ manifest_file =
309
+ if :default == desc.manifest_file
310
+ # We must create name for manifest.
311
+ if Exe_target_type::TYPE == target.target_type.name
312
+ make_exe_name(
313
+ target.mxx_target_name,
314
+ target ).full_name
315
+ else
316
+ make_dll_name(
317
+ target.mxx_target_name,
318
+ target ).full_name
319
+ end + ".manifest"
320
+ else
321
+ # Manifest filename already specified.
322
+ desc.manifest_file
323
+ end
324
+
325
+ # If mt.exe will be used then we must determine
326
+ # digital resource_id for manifest resource.
327
+ digital_resource_id =
328
+ if desc.mt
329
+ case desc.resource_id
330
+ when :default:
331
+ # Resource ID must be caclulated based on
332
+ # target type.
333
+ Exe_target_type::TYPE == target.target_type.name ? 1 : 2
334
+ when :process_manifest: 1
335
+ when :isolationaware_manifest: 2
336
+ else
337
+ # :isolationaware_nostaticimport_manifest
338
+ 3
339
+ end
340
+ else
341
+ nil
342
+ end
343
+
344
+ target.vc8_actual_manifest = Actual_manifest.new(
345
+ desc,
346
+ manifest_file,
347
+ digital_resource_id )
348
+ end
349
+ end
350
+ end
351
+
352
+ # Setup linker params for processing target manifest.
353
+ def setup_manifest_params( target )
354
+ m = target.vc8_actual_manifest
355
+ if nil != m and m.autogen?
356
+ # Linker must generate manifest.
357
+ target.linker_option( '/MANIFEST' )
358
+ target.linker_option( '/MANIFESTFILE:' + m.manifest_file )
359
+ else
360
+ # Linker should not generate manifest.
361
+ target.linker_option( '/MANIFEST:NO' )
362
+ end
363
+ end
364
+
365
+ # Remove autogenerated manifest file if any.
366
+ def clean_autogenerated_manifest( target )
367
+ m = target.vc8_actual_manifest
368
+ Mxx_ru::Util::delete_file( m.manifest_file ) if
369
+ m != nil and m.autogen?
370
+ end
371
+
372
+ # Append command line for embeding manifest file to end of
373
+ # specified command line list.
374
+ def append_mt_command_lines(
375
+ cmd_lines,
376
+ target_name,
377
+ target )
378
+
379
+ m = target.vc8_actual_manifest
380
+ if nil != m and m.mt?
381
+ cmd_lines << "#{mt_name} /nologo " +
382
+ "/outputresource:\"#{target_name};\#" +
383
+ "#{m.digital_resource_id}\" " +
384
+ "/manifest \"#{m.manifest_file}\""
385
+
386
+ if !m.keep_manifest_file?
387
+ # del utility doesn't work with unix slashes
388
+ cmd_lines << "del \"#{Mxx_ru::Util::native_pathname(m.manifest_file)}\""
389
+ end
390
+ end
391
+
392
+ cmd_lines
393
+ end
394
+
395
+ # Name of manifest tool executable
396
+ def mt_name
397
+ "mt"
398
+ end
399
+
400
+ # Checking manifest params validity.
401
+ def self.check_manifest_params( params )
402
+ if nil != params
403
+ if params.key?( :mt )
404
+ mt_hash = params[ :mt ]
405
+
406
+ # :resource_id must have one of avaliable values.
407
+ if mt_hash.key?( :resource_id ) and
408
+ !@@resource_id_names.member?( mt_hash[ :resource_id ] )
409
+ raise Invalid_value_ex.new(
410
+ "invalid value for :resource_id key: " +
411
+ "'#{mt_hash[:resource_id]}'" )
412
+ end
413
+
414
+ if !mt_hash.key?( :manifest ) and
415
+ !params.key?( :autogen )
416
+
417
+ raise Invalid_value_ex.new(
418
+ "no manifest file name specified" )
419
+ end
420
+
421
+ # :keep_manifest_file should be Bool.
422
+ if mt_hash.key?( :keep_manifest_file ) and
423
+ true != mt_hash[ :keep_manifest_file ] and
424
+ false != mt_hash[ :keep_manifest_file ]
425
+ raise Invalid_value_ex.new(
426
+ "value for :keep_manifest_file should be 'true' " +
427
+ "or 'false'" )
428
+ end
429
+ end
430
+
431
+ if params.key?( :autogen )
432
+ v = params[ :autogen ]
433
+ if !( v == :to_default_file or
434
+ v.kind_of?( String ) )
435
+ raise Invalid_value_ex.new(
436
+ "invalid value for :autogen (must be " +
437
+ ":to_default_file or String instance)" )
438
+ end
439
+ end
440
+ end
441
+ end
442
+
443
+ end # class Vc8
444
+
445
+ end # module Toolsets
446
+
447
+ end # module Cpp
448
+
449
+ end # module Mxx_ru
450
+
451
+ Mxx_ru::Cpp::setup_toolset( Mxx_ru::Cpp::Toolsets::Vc8.new )
452
+