Mxx_ru 1.2.1 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (111) hide show
  1. data/NEWS +38 -0
  2. data/Rakefile +29 -2
  3. data/examples/exe_dll_lib_2/build.rb +4 -1
  4. data/examples/exe_dll_lib_2/inout/prj.rb +1 -1
  5. data/examples/exe_dll_lib_2/main/prj.rb +1 -1
  6. data/examples/exe_dll_lib_2/say/prj.rb +1 -1
  7. data/lib/mxx_ru/abstract_target.rb +71 -49
  8. data/lib/mxx_ru/binary_library.rb +106 -0
  9. data/lib/mxx_ru/binary_target.rb +91 -7
  10. data/lib/mxx_ru/binary_unittest.rb +30 -17
  11. data/lib/mxx_ru/compat.rb +33 -0
  12. data/lib/mxx_ru/cpp/analyzer.rb +16 -9
  13. data/lib/mxx_ru/cpp/composite.rb +24 -13
  14. data/lib/mxx_ru/cpp/detect_toolset.rb +7 -7
  15. data/lib/mxx_ru/cpp/mode.rb +11 -6
  16. data/lib/mxx_ru/cpp/obj_placement.rb +42 -33
  17. data/lib/mxx_ru/cpp/obj_placements/custom_subdir.rb +155 -0
  18. data/lib/mxx_ru/cpp/qt.rb +97 -68
  19. data/lib/mxx_ru/cpp/rucodegen.rb +56 -19
  20. data/lib/mxx_ru/cpp/source_file.rb +14 -6
  21. data/lib/mxx_ru/cpp/target.rb +341 -226
  22. data/lib/mxx_ru/cpp/toolset.rb +188 -145
  23. data/lib/mxx_ru/cpp/toolsets/bcc_win32_5.rb +5 -4
  24. data/lib/mxx_ru/cpp/toolsets/bcc_win32_family.rb +42 -35
  25. data/lib/mxx_ru/cpp/toolsets/c89_etk_nsk.rb +8 -5
  26. data/lib/mxx_ru/cpp/toolsets/c89_nsk.rb +8 -5
  27. data/lib/mxx_ru/cpp/toolsets/c89_nsk_family.rb +24 -20
  28. data/lib/mxx_ru/cpp/toolsets/gcc_cygwin.rb +9 -5
  29. data/lib/mxx_ru/cpp/toolsets/gcc_family.rb +61 -38
  30. data/lib/mxx_ru/cpp/toolsets/gcc_linux.rb +10 -6
  31. data/lib/mxx_ru/cpp/toolsets/gcc_mingw.rb +17 -15
  32. data/lib/mxx_ru/cpp/toolsets/gcc_sparc_solaris.rb +11 -7
  33. data/lib/mxx_ru/cpp/toolsets/gcc_unix_family.rb +84 -0
  34. data/lib/mxx_ru/cpp/toolsets/vc7.rb +4 -4
  35. data/lib/mxx_ru/cpp/toolsets/vc8.rb +33 -30
  36. data/lib/mxx_ru/cpp/toolsets/vc_family.rb +70 -50
  37. data/lib/mxx_ru/cpp.rb +3 -1
  38. data/lib/mxx_ru/ex.rb +44 -13
  39. data/lib/mxx_ru/makestyle_generator.rb +17 -12
  40. data/lib/mxx_ru/textfile_unittest.rb +46 -27
  41. data/lib/mxx_ru/util.rb +51 -26
  42. data/tests/cpp/cpp_sources_glob/tc_cpp_sources_glob.rb +18 -0
  43. data/tests/cpp/mswin_res_dll/tc_mswin_res_dll.rb +18 -0
  44. data/tests/cpp/mswin_res_exe/tc_mswin_res_exe.rb +18 -0
  45. data/tests/cpp/rucodegen/prj.rb +1 -2
  46. data/tests/cpp/rucodegen/tc_rucodegen.rb +18 -0
  47. data/tests/cpp/rucodegen.embedded/host_config.cpp +32 -0
  48. data/tests/cpp/rucodegen.embedded/impl/conn_params.cpp +7 -0
  49. data/tests/cpp/rucodegen.embedded/impl/conn_params.rb +14 -0
  50. data/tests/cpp/rucodegen.embedded/impl/h/conn_params.hpp +10 -0
  51. data/tests/cpp/rucodegen.embedded/prj.rb +16 -0
  52. data/tests/cpp/rucodegen.embedded/tc_rucodegen.rb +18 -0
  53. data/tests/cpp/textfile_unittest/tc_textfile_unittest.rb +18 -0
  54. data/tests/cpp/vc_cleanup/tc_vc_cleanup.rb +7 -44
  55. data/tests/mxx_ru/binary_library/tc_binary_library.rb +57 -0
  56. data/tests/mxx_ru/binary_library/tc_binary_target_lib_methods.rb +114 -0
  57. data/tests/mxx_ru/lib_path/build.rb +8 -0
  58. data/tests/mxx_ru/lib_path/bye.c +3 -0
  59. data/tests/mxx_ru/lib_path/bye.rb +8 -0
  60. data/tests/mxx_ru/lib_path/hi.c +3 -0
  61. data/tests/mxx_ru/lib_path/hi.rb +8 -0
  62. data/tests/mxx_ru/lib_path/main.c +9 -0
  63. data/tests/mxx_ru/lib_path/main.rb +12 -0
  64. data/tests/mxx_ru/lib_path/tc_lib_path.rb +18 -0
  65. data/tests/mxx_ru/obj_placements/tc_custom_subdir.rb +58 -0
  66. data/tests/mxx_ru/opt_lib_ext/build.rb +7 -0
  67. data/tests/mxx_ru/opt_lib_ext/hi.c +3 -0
  68. data/tests/mxx_ru/opt_lib_ext/hi.h +1 -0
  69. data/tests/mxx_ru/opt_lib_ext/hi.rb +7 -0
  70. data/tests/mxx_ru/opt_lib_ext/main.c +7 -0
  71. data/tests/mxx_ru/opt_lib_ext/tc_opt_lib_ext.rb +18 -0
  72. data/tests/mxx_ru/opt_lib_ext/test-no-ext.rb +9 -0
  73. data/tests/mxx_ru/opt_lib_ext/test-with-ext.rb +13 -0
  74. data/tests/mxx_ru/qt_gen/tc_uic_result_subdir.rb +76 -0
  75. data/tests/mxx_ru/target_ext/dll_hi.cpp +1 -0
  76. data/tests/mxx_ru/target_ext/exe_hi.cpp +4 -0
  77. data/tests/mxx_ru/target_ext/lib_hi.cpp +1 -0
  78. data/tests/mxx_ru/target_ext/prj_dll.rb +8 -0
  79. data/tests/mxx_ru/target_ext/prj_exe.rb +8 -0
  80. data/tests/mxx_ru/target_ext/prj_lib.rb +8 -0
  81. data/tests/mxx_ru/target_ext/tc_target_ext.rb +24 -0
  82. data/tests/qt/toplevel/prj.rb +1 -0
  83. data/tests/test_with_compilation.rb +110 -0
  84. data/tests/unix/lib_linking_mode/a.hpp +12 -0
  85. data/tests/unix/lib_linking_mode/a_shared.cpp +8 -0
  86. data/tests/unix/lib_linking_mode/a_shared.rb +7 -0
  87. data/tests/unix/lib_linking_mode/a_static.cpp +7 -0
  88. data/tests/unix/lib_linking_mode/a_static.rb +7 -0
  89. data/tests/unix/lib_linking_mode/etalon/shared.txt +2 -0
  90. data/tests/unix/lib_linking_mode/etalon/static.txt +2 -0
  91. data/tests/unix/lib_linking_mode/main.impl.cpp +7 -0
  92. data/tests/unix/lib_linking_mode/main_conflict.cpp +2 -0
  93. data/tests/unix/lib_linking_mode/main_conflict.rb +12 -0
  94. data/tests/unix/lib_linking_mode/main_conflict_2.rb +11 -0
  95. data/tests/unix/lib_linking_mode/main_shared.cpp +2 -0
  96. data/tests/unix/lib_linking_mode/main_shared.rb +9 -0
  97. data/tests/unix/lib_linking_mode/main_shared.ut.rb +11 -0
  98. data/tests/unix/lib_linking_mode/main_shared_2.cpp +2 -0
  99. data/tests/unix/lib_linking_mode/main_shared_2.rb +10 -0
  100. data/tests/unix/lib_linking_mode/main_shared_2.ut.rb +11 -0
  101. data/tests/unix/lib_linking_mode/main_static.cpp +2 -0
  102. data/tests/unix/lib_linking_mode/main_static.rb +9 -0
  103. data/tests/unix/lib_linking_mode/main_static.ut.rb +11 -0
  104. data/tests/unix/lib_linking_mode/main_static_2.cpp +2 -0
  105. data/tests/unix/lib_linking_mode/main_static_2.rb +10 -0
  106. data/tests/unix/lib_linking_mode/main_static_2.ut.rb +11 -0
  107. data/tests/unix/lib_linking_mode/tc_conflicted_build.rb +18 -0
  108. data/tests/unix/lib_linking_mode/tc_normal_build.rb +18 -0
  109. metadata +90 -11
  110. data/tests/cpp/vc_cleanup/cout.log +0 -72
  111. data/tests/qt/toplevel/options.ui.h +0 -98
@@ -33,7 +33,7 @@ require 'mxx_ru/cpp/obj_placement'
33
33
  require 'mxx_ru/cpp/analyzer'
34
34
 
35
35
  # Base class for all targets of C/C++ projects.
36
- module Mxx_ru
36
+ module MxxRu
37
37
 
38
38
  module Cpp
39
39
  # Runtime mode types.
@@ -90,7 +90,7 @@ module Mxx_ru
90
90
  # Auxiliary class, intended to store objects like
91
91
  # runtime_mode, rtl_mode, etc, with information about
92
92
  # who has set this or that mode.
93
- class Global_single_value_option
93
+ class GlobalSingleValueOption
94
94
  attr_reader :name
95
95
  attr_reader :default_value
96
96
  attr_reader :value
@@ -153,7 +153,7 @@ module Mxx_ru
153
153
  # Value is already changed. It is necessary to be convinced,
154
154
  # that values are the same. Otherwise there is a conflict.
155
155
  if a_value != @value
156
- raise Mxx_ru::Global_option_conflict_ex.new(
156
+ raise MxxRu::GlobalOptionConflictEx.new(
157
157
  @name, @value, @who, a_value, a_who )
158
158
  end
159
159
  end
@@ -165,33 +165,38 @@ module Mxx_ru
165
165
  # not found.
166
166
  def check_value( value, who )
167
167
  if !@available_values.include?( value )
168
- raise Mxx_ru::Global_option_disallowed_value_ex.new(
168
+ raise MxxRu::GlobalOptionDisallowedValueEx.new(
169
169
  @name, @available_values, value, who )
170
170
  end
171
171
  end
172
- end # class Global_single_value_option
172
+ end # class GlobalSingleValueOption
173
+
174
+ # For compatibility with previous versions.
175
+ Global_single_value_option = GlobalSingleValueOption
173
176
 
174
177
  # Auxiliary class for a storage of options, which can be broken on 3 groups:
175
178
  # global, local and upspread.
176
179
  # Examples of such options are: defines, include_paths,
177
180
  # compiler_options, linker_options, ...
178
- class Spreadable_option
181
+ class SpreadableOption
179
182
  # A name of a method, which should be used for reception of all options.
180
183
  ALL_OPT_METHOD = "all"
181
- # A name of a method, which should be used for reception of all upspread options.
184
+ # A name of a method, which should be used for reception of all upspread
185
+ # options.
182
186
  ALL_UPSPREAD_METHOD = "all_upspreads"
183
187
 
184
- # The global tick counter which is used for check that cached values are still correct.
185
- # Is increased at each reference to add.
188
+ # The global tick counter which is used for check that cached values are
189
+ # still correct. Is increased at each reference to add.
186
190
  @@last_change_time = 1
187
- # Global hash, in which the time of last change of options with a concrete name is fixed.
191
+ # Global hash, in which the time of last change of options with a
192
+ # concrete name is fixed.
188
193
  @@cache_times = Hash.new
189
194
 
190
- # Set new time of change of value of an option.
191
- # This method is intended for use at change of global options, which are stored
192
- # separately from spreadable-options, but which values are included
193
- # in values of spreadable-options.
194
- def Spreadable_option.refresh_option_change_time( a_option_name )
195
+ # Set new time of change of value of an option. This method is intended
196
+ # for use at change of global options, which are stored separately from
197
+ # spreadable-options, but which values are included in values of
198
+ # spreadable-options.
199
+ def SpreadableOption.refresh_option_change_time( a_option_name )
195
200
  @@last_change_time = @@last_change_time + 1
196
201
  @@cache_times[ a_option_name ] = @@last_change_time
197
202
  end
@@ -229,11 +234,11 @@ module Mxx_ru
229
234
  #
230
235
  # [_a_option_] Added value.
231
236
  # [_a_mode_] Local or upspread option.
232
- # Is set by values Mxx_ru::Cpp::Target::OPT_LOCAL,
233
- # Mxx_ru::Cpp::Target::OPT_UPSPEAD.
237
+ # Is set by values MxxRu::Cpp::Target::OPT_LOCAL,
238
+ # MxxRu::Cpp::Target::OPT_UPSPEAD.
234
239
  def add(
235
240
  a_option,
236
- a_mode = Mxx_ru::Cpp::Target::OPT_LOCAL )
241
+ a_mode = MxxRu::Cpp::Target::OPT_LOCAL )
237
242
  add_unique_to( a_option, check_opt_mode( a_mode ) )
238
243
  end
239
244
 
@@ -244,11 +249,13 @@ module Mxx_ru
244
249
 
245
250
  # To generate the list of all options.
246
251
  #
247
- # [_a_globals_] The storage of global options, from which is necessary to take values.
252
+ # [_a_globals_] The storage of global options, from which is necessary
253
+ # to take values.
248
254
  # [_a_subprojects_] The list of all subordinated projects.
249
- # Array of Mxx_ru::Abstract_target.
250
- # [_a_upspreads_method_] The name of a method, which needs to be called from
251
- # the subordinated project, to get it's list of all upspread options.
255
+ # Array of MxxRu::AbstractTarget.
256
+ # [_a_upspreads_method_] The name of a method, which needs to be called
257
+ # from the subordinated project, to get it's list
258
+ # of all upspread options.
252
259
  def all(
253
260
  a_globals,
254
261
  a_subprojects,
@@ -260,19 +267,7 @@ module Mxx_ru
260
267
  r << a_globals << @locals
261
268
 
262
269
  # At the same time it is possible to update cache of upspread-options.
263
- if @all_upspread_cache_time < @@cache_times[ @name ]
264
- u = Array.new
265
- u << @upspreads
266
-
267
- a_subprojects.each { |p|
268
- if p.kind_of?( Mxx_ru::Cpp::Target )
269
- u << p.send( a_upspreads_method )
270
- end
271
- }
272
-
273
- @all_upspread_cache_time = @@last_change_time
274
- @all_upspread_cache_value = u.flatten.uniq
275
- end
270
+ try_update_upspread_options( a_subprojects, a_upspreads_method )
276
271
 
277
272
  r << @all_upspread_cache_value
278
273
 
@@ -286,27 +281,15 @@ module Mxx_ru
286
281
  # To generate the list of all upspread options.
287
282
  #
288
283
  # [_a_subprojects_] The list of all subordinated projects.
289
- # Array of Mxx_ru::Abstract_target.
290
- # [_a_upspreads_method_] The name of a method, which needs to be called from
291
- # the subordinated project, to get it's list of all upspread options.
284
+ # Array of MxxRu::AbstractTarget.
285
+ # [_a_upspreads_method_] The name of a method, which needs to be called
286
+ # from the subordinated project, to get it's list
287
+ # of all upspread options.
292
288
  def all_upspreads(
293
289
  a_subprojects,
294
290
  a_upspreads_method )
295
291
 
296
- if @all_upspread_cache_time < @@cache_times[ @name ]
297
- # It is necessary to calculate cache anew.
298
- r = Array.new
299
- r << @upspreads
300
-
301
- a_subprojects.each { |p|
302
- if p.kind_of?( Mxx_ru::Cpp::Target )
303
- r << p.send( a_upspreads_method )
304
- end
305
- }
306
-
307
- @all_upspread_cache_value = r.flatten.uniq
308
- @all_upspread_cache_time = @@last_change_time
309
- end
292
+ try_update_upspread_options( a_subprojects, a_upspreads_method )
310
293
 
311
294
  return @all_upspread_cache_value
312
295
  end
@@ -317,7 +300,7 @@ module Mxx_ru
317
300
  if !to.include?( what )
318
301
  to.push( what )
319
302
 
320
- Spreadable_option::refresh_option_change_time( @name )
303
+ SpreadableOption::refresh_option_change_time( @name )
321
304
  end
322
305
  end
323
306
 
@@ -328,27 +311,53 @@ module Mxx_ru
328
311
  # [_a_mode_] mode parameter value for check.
329
312
  def check_opt_mode(
330
313
  a_mode )
331
- if Mxx_ru::Cpp::Target::OPT_UPSPREAD == a_mode
314
+ if MxxRu::Cpp::Target::OPT_UPSPREAD == a_mode
332
315
  return @upspreads
333
- elsif Mxx_ru::Cpp::Target::OPT_LOCAL == a_mode
316
+ elsif MxxRu::Cpp::Target::OPT_LOCAL == a_mode
334
317
  return @locals
335
318
  else
336
- raise Mxx_ru::Invalid_value_ex.new(
319
+ raise MxxRu::InvalidValueEx.new(
337
320
  "invalid option mode #{a_mode}" )
338
321
  end
339
322
  end
340
- end
323
+
324
+ # Checks upspread options cache time and updates upspread
325
+ # options if needed.
326
+ def try_update_upspread_options( subprojects, upspreads_method )
327
+ if @all_upspread_cache_time < @@cache_times[ @name ]
328
+ # It is necessary to calculate cache anew.
329
+ r = Array.new
330
+ r << @upspreads
331
+
332
+ subprojects.each { |p|
333
+ if p.kind_of?( MxxRu::Cpp::Target )
334
+ r << p.send( upspreads_method )
335
+ end
336
+ }
337
+
338
+ @all_upspread_cache_value = r.flatten.uniq
339
+ @all_upspread_cache_time = @@last_change_time
340
+ end
341
+ end
342
+
343
+ end # class SpreadableOption
344
+
345
+ # For compatibility with previous versions.
346
+ Spreadable_option = SpreadableOption
341
347
 
342
348
  # Target type (exe, lib, dll, unittest, composite etc.).
343
349
  # The real type of the target is defined by a derivative class.
344
- class Target_type
350
+ class TargetType
345
351
  def name
346
- raise Abstract_method_ex.new( "Mxx_ru::Cpp::Target_type::name" )
352
+ raise AbstractMethodEx.new( "MxxRu::Cpp::TargetType::name" )
347
353
  end
348
354
  end
349
355
 
356
+ # For compatibility with previous versions.
357
+ Target_type = TargetType
358
+
350
359
  # Target type is application.
351
- class Exe_target_type < Target_type
360
+ class ExeTargetType < TargetType
352
361
  TYPE = "exe"
353
362
 
354
363
  def name
@@ -356,8 +365,11 @@ module Mxx_ru
356
365
  end
357
366
  end
358
367
 
368
+ # For compatibility with previous versions.
369
+ Exe_target_type = ExeTargetType
370
+
359
371
  # Target type is static library (lib).
360
- class Lib_target_type < Target_type
372
+ class LibTargetType < TargetType
361
373
  TYPE = "lib"
362
374
 
363
375
  def name
@@ -365,8 +377,11 @@ module Mxx_ru
365
377
  end
366
378
  end
367
379
 
380
+ # For compatibility with previous versions.
381
+ Lib_target_type = LibTargetType
382
+
368
383
  # Target type is shared library (dll).
369
- class Dll_target_type < Target_type
384
+ class DllTargetType < TargetType
370
385
  TYPE = "dll"
371
386
 
372
387
  def name
@@ -374,11 +389,14 @@ module Mxx_ru
374
389
  end
375
390
  end
376
391
 
392
+ # For compatibility with previous versions.
393
+ Dll_target_type = DllTargetType
394
+
377
395
  # Base class for all targets of C/C++ projects.
378
- class Target < Mxx_ru::Binary_target
396
+ class Target < MxxRu::BinaryTarget
379
397
  # Description of obj_placement object installed.
380
398
  # Used to store global obj_placement.
381
- class Global_obj_placement_info
399
+ class GlobalObjPlacementInfo
382
400
  # Global obj_placement.
383
401
  attr_reader :placement
384
402
  # Who was set obj_placement.
@@ -393,7 +411,7 @@ module Mxx_ru
393
411
  # If placement already set, exception thrown.
394
412
  def change( a_placement, a_who )
395
413
  if nil != a_placement && nil != @placement
396
- raise Mxx_ru::Global_option_conflict_ex.new(
414
+ raise MxxRu::GlobalOptionConflictEx.new(
397
415
  "global_obj_placement",
398
416
  @placement.class.name,
399
417
  @who,
@@ -404,14 +422,17 @@ module Mxx_ru
404
422
  @placement = a_placement
405
423
  @who = a_who
406
424
  end
407
- end
425
+ end # class GlobalObjPlacementInfo
426
+
427
+ # For compatibility with previous versions.
428
+ Global_obj_placement_info = GlobalObjPlacementInfo
408
429
 
409
430
  # Action class to store option in Array.
410
- class Global_option_inserter
431
+ class GlobalOptionInserter
411
432
 
412
433
  # [_a_option_name_] Name of option served. It is necessary for
413
434
  # referecne to
414
- # Spreadable_option.refresh_option_change_time
435
+ # SpreadableOption.refresh_option_change_time
415
436
  # method.
416
437
  # [_a_receiver_] Where to add value.
417
438
  def initialize(
@@ -424,12 +445,15 @@ module Mxx_ru
424
445
  def call( *args )
425
446
  @receiver.push( *args )
426
447
 
427
- Spreadable_option::refresh_option_change_time( @option_name )
448
+ SpreadableOption::refresh_option_change_time( @option_name )
428
449
  end
429
- end # class Global_option_inserter
450
+ end # class GlobalOptionInserter
451
+
452
+ # For compatibility with previous versions.
453
+ Global_option_inserter = GlobalOptionInserter
430
454
 
431
- # Action class to store option in Spreadable_option object.
432
- class Spreadable_option_inserter
455
+ # Action class to store option in SpreadableOption object.
456
+ class SpreadableOptionInserter
433
457
 
434
458
  # [_a_receiver_] Where to add value.
435
459
  def initialize(
@@ -438,13 +462,16 @@ module Mxx_ru
438
462
  end
439
463
 
440
464
  def call( *args )
441
- @receiver.send( "add", *args )
465
+ @receiver.send( :add, *args )
442
466
  end
443
- end # class Spreadable_option_inserter
467
+ end # class SpreadableOptionInserter
468
+
469
+ # For compatibility with previous versions.
470
+ Spreadable_option_inserter = SpreadableOptionInserter
444
471
 
445
472
  # Action class to get all option values (local, global and upspread)
446
- # from Spreadable_option object.
447
- class Spreadable_option_all_extractor
473
+ # from SpreadableOption object.
474
+ class SpreadableOptionAllExtractor
448
475
 
449
476
  # [_a_option_] In whom to call a "call" method.
450
477
  # [_a_globals_] Whence to take values of global options.
@@ -469,11 +496,14 @@ module Mxx_ru
469
496
  return @option.all( @globals, @target.mxx_required_prjs,
470
497
  @upspreads_only_method )
471
498
  end
472
- end # class Spreadable_option_all_extractor
499
+ end # class SpreadableOptionAllExtractor
500
+
501
+ # For compatibility with previous versions.
502
+ Spreadable_option_all_extractor = SpreadableOptionAllExtractor
473
503
 
474
504
  # Action class to get upspreadable option values only
475
- # from Spreadable_option object.
476
- class Spreadable_option_upspread_extractor
505
+ # from SpreadableOption object.
506
+ class SpreadableOptionUpspreadExtractor
477
507
 
478
508
  # [_a_option_] In whom to call a "call" method.
479
509
  # [_a_target_] The target, from which is necessary to take the list
@@ -495,27 +525,30 @@ module Mxx_ru
495
525
  return @option.all_upspreads( @target.mxx_required_prjs,
496
526
  @upspreads_only_method )
497
527
  end
498
- end # class Spreadable_option_all_extractor
528
+ end # class SpreadableOptionAllExtractor
529
+
530
+ # For compatibility with previous versions.
531
+ Spreadable_option_upspread_extractor = SpreadableOptionUpspreadExtractor
499
532
 
500
533
  # Runtime mode storage.
501
- @@mxx_runtime_mode = Global_single_value_option.new(
534
+ @@mxx_runtime_mode = GlobalSingleValueOption.new(
502
535
  "runtime_mode", RUNTIME_DEFAULT,
503
536
  [ RUNTIME_RELEASE, RUNTIME_DEBUG ] )
504
537
  # RTTI mode storage.
505
- @@mxx_rtti_mode = Global_single_value_option.new(
538
+ @@mxx_rtti_mode = GlobalSingleValueOption.new(
506
539
  "rtti_mode", RTTI_DEFAULT,
507
540
  [ RTTI_ENABLED, RTTI_DISABLED ] )
508
541
  # RTL mode storage.
509
- @@mxx_rtl_mode = Global_single_value_option.new(
542
+ @@mxx_rtl_mode = GlobalSingleValueOption.new(
510
543
  "rtl_mode", RTL_DEFAULT,
511
544
  [ RTL_SHARED, RTL_STATIC ] )
512
545
  # Threading mode storage.
513
- @@mxx_threading_mode = Global_single_value_option.new(
546
+ @@mxx_threading_mode = GlobalSingleValueOption.new(
514
547
  "threading_mode", THREADING_DEFAULT,
515
548
  [ THREADING_MULTI, THREADING_SINGLE ] )
516
549
 
517
550
  # The storage of global description of obj_placement.
518
- @@mxx_global_obj_placement = Global_obj_placement_info.new
551
+ @@mxx_global_obj_placement = GlobalObjPlacementInfo.new
519
552
 
520
553
  # Global options storage.
521
554
  # The key is a String, the value is Array of String.
@@ -528,22 +561,26 @@ module Mxx_ru
528
561
 
529
562
  # Path, the name of result of a target is related to.
530
563
  # If contains an empty value, target should be defined using a full path.
531
- # Otherwise the value of mxx_target_root is concatenated with a given target name.
564
+ # Otherwise the value of mxx_target_root is concatenated with a given
565
+ # target name.
532
566
  attr_reader :mxx_target_root
567
+ # Custom extension for target.
568
+ # NIL, if custom extension not defined.
569
+ attr_reader :mxx_target_ext
533
570
  # Path, the names of source files are related to.
534
571
  attr_reader :mxx_sources_root
535
572
  # Screen mode. Console by default.
536
573
  attr_reader :mxx_screen_mode
537
574
  # The list of source C-files.
538
- # Array of Mxx_ru::Cpp::Cpp_source_file objects.
575
+ # Array of MxxRu::Cpp::CppSourceFile objects.
539
576
  attr_reader :mxx_c_files
540
577
  # The list of source C++-files.
541
- # Array of Mxx_ru::Cpp::Cpp_source_file objects.
578
+ # Array of MxxRu::Cpp::CppSourceFile objects.
542
579
  attr_reader :mxx_cpp_files
543
580
  # Object files list.
544
581
  attr_reader :mxx_obj_files
545
582
  # Name of mswin resource file.
546
- # Should be object of Mxx-ru::Cpp::Mswin_rc_file type.
583
+ # Should be object of MxxRu::Cpp::MswinRcFile type.
547
584
  # May contain nil value, if resources are not used.
548
585
  attr_reader :mxx_mswin_rc_file
549
586
  # The name of compiled mswin resource file.
@@ -595,6 +632,8 @@ module Mxx_ru
595
632
 
596
633
  @mxx_target_root = ""
597
634
 
635
+ @mxx_target_exe = nil
636
+
598
637
  @mxx_sources_root = File.dirname( a_prj_alias )
599
638
 
600
639
  @mxx_screen_mode = SCREEN_CONSOLE
@@ -608,7 +647,7 @@ module Mxx_ru
608
647
  @mxx_obj_files = Array.new
609
648
 
610
649
  # The storage of local options.
611
- # The key is a String, the value is Spreadable_option.
650
+ # The key is a String, the value is SpreadableOption.
612
651
  @mxx_locals = Hash.new
613
652
 
614
653
  @mxx_implib_path = nil
@@ -660,11 +699,11 @@ module Mxx_ru
660
699
  end
661
700
 
662
701
  # A simple way to get access to the toolset.
663
- # In a class, inherited from Mxx_ru::Cpp::Target is more convinient
664
- # to call toolset method, instead of Mxx_ru::Cpp::toolset function.
665
- # Just calling Mxx_ru::Cpp::toolset function.
702
+ # In a class, inherited from MxxRu::Cpp::Target is more convinient
703
+ # to call toolset method, instead of MxxRu::Cpp::toolset function.
704
+ # Just calling MxxRu::Cpp::toolset function.
666
705
  def toolset()
667
- return Mxx_ru::Cpp::toolset()
706
+ return MxxRu::Cpp::toolset()
668
707
  end
669
708
 
670
709
  global_option_methods :runtime_mode, :nogetter
@@ -676,16 +715,16 @@ module Mxx_ru
676
715
  # is required (--mxx-cpp-release, --mxx-cpp-debug).
677
716
  result = @@mxx_runtime_mode.value
678
717
  if @@mxx_runtime_mode.default_value == result
679
- if Mxx_ru::Cpp::Mode.instance.is_release &&
680
- Mxx_ru::Cpp::Mode.instance.is_debug
718
+ if MxxRu::Cpp::Mode.instance.is_release &&
719
+ MxxRu::Cpp::Mode.instance.is_debug
681
720
  # This is an invalid combination of flags.
682
- raise Mxx_ru::Invalid_value_ex.new(
683
- "#{Mxx_ru::Cpp::MXXCPPARG_RELEASE} and " +
684
- "#{Mxx_ru::Cpp::MXXCPPARG_DEBUG} cannot be used " +
721
+ raise MxxRu::InvalidValueEx.new(
722
+ "#{MxxRu::Cpp::MXXCPPARG_RELEASE} and " +
723
+ "#{MxxRu::Cpp::MXXCPPARG_DEBUG} cannot be used " +
685
724
  "together" )
686
- elsif Mxx_ru::Cpp::Mode.instance.is_release
725
+ elsif MxxRu::Cpp::Mode.instance.is_release
687
726
  result = RUNTIME_RELEASE
688
- elsif Mxx_ru::Cpp::Mode.instance.is_debug
727
+ elsif MxxRu::Cpp::Mode.instance.is_debug
689
728
  result = RUNTIME_DEBUG
690
729
  end
691
730
  end
@@ -715,12 +754,13 @@ module Mxx_ru
715
754
  #
716
755
  # If global or local obj_placement is defined, it is returned.
717
756
  #
718
- # If nor global nor local obj_placement is set, local obj_placement is created
719
- # with a help of Mxx_ru::Cpp::default_obj_placement function and it's returned.
757
+ # If nor global nor local obj_placement is set, local obj_placement is
758
+ # created with a help of MxxRu::Cpp::default_obj_placement function and
759
+ # it's returned.
720
760
  def mxx_obj_placement
721
761
  if nil != @mxx_obj_placement &&
722
762
  nil != @@mxx_global_obj_placement.placement
723
- raise Mxx_ru::Invalid_value_ex.new(
763
+ raise MxxRu::InvalidValueEx.new(
724
764
  "Global and local obj_placement object exists! " +
725
765
  "Global created by: #{@@mxx_global_obj_placement.who}. " +
726
766
  "Local created by: #{prj_alias}" )
@@ -731,7 +771,7 @@ module Mxx_ru
731
771
  end
732
772
 
733
773
  if nil == @mxx_obj_placement
734
- @mxx_obj_placement = Mxx_ru::Cpp::default_obj_placement
774
+ @mxx_obj_placement = MxxRu::Cpp::default_obj_placement
735
775
  end
736
776
 
737
777
  return @mxx_obj_placement
@@ -756,6 +796,11 @@ module Mxx_ru
756
796
  @mxx_target_name = create_full_target_file_name( a_target )
757
797
  end
758
798
 
799
+ # Set a custom extension for target.
800
+ def target_ext( ext )
801
+ @mxx_target_ext = ext
802
+ end
803
+
759
804
  # Change source files path.
760
805
  # If empty string is set, then full file names are required.
761
806
  # If block is defined, then path is changed only during a block
@@ -781,7 +826,7 @@ module Mxx_ru
781
826
  if SCREEN_CONSOLE == a_mode || SCREEN_WINDOW == a_mode
782
827
  @mxx_screen_mode = a_mode
783
828
  else
784
- raise Mxx_ru::Unsupported_mode_ex.new(
829
+ raise MxxRu::UnsupportedModeEx.new(
785
830
  "Unsupported screen mode: #{a_mode}" )
786
831
  end
787
832
  end
@@ -790,12 +835,12 @@ module Mxx_ru
790
835
  #
791
836
  # Note: if a_file_name contains prefix equal to current sources_root
792
837
  # than mxx_ru does not add sources_root to name of file. For example:
793
- # Mxx_ru::Cpp::exe_target( 'some/module/prj.rb' ) {
838
+ # MxxRu::Cpp::exe_target( 'some/module/prj.rb' ) {
794
839
  # ...
795
840
  # c_source 'f1.c' # become 'some/module/f1.c'
796
841
  # c_source 'some/module/impl/f2.c' # remains 'some/module/impl/f2.c
797
842
  # This approach will be useful with Dir.glob:
798
- # Mxx_ru::Cpp::exe_target( 'some/module/prj.rb' ) {
843
+ # MxxRu::Cpp::exe_target( 'some/module/prj.rb' ) {
799
844
  # ...
800
845
  # c_sources Dir.glob( 'some/module/**/*.c' )
801
846
  # }
@@ -805,7 +850,7 @@ module Mxx_ru
805
850
  # When command line would be created, this options would
806
851
  # be concatenated with others.
807
852
  def c_source( a_file_name, a_options = nil )
808
- @mxx_c_files.push( Cpp_source_file.new(
853
+ @mxx_c_files.push( CppSourceFile.new(
809
854
  create_full_src_file_name( a_file_name ), a_options ) )
810
855
  end
811
856
 
@@ -813,12 +858,12 @@ module Mxx_ru
813
858
  #
814
859
  # Note: if a_file_name contains prefix equal to current sources_root
815
860
  # than mxx_ru does not add sources_root to name of file. For example:
816
- # Mxx_ru::Cpp::exe_target( 'some/module/prj.rb' ) {
861
+ # MxxRu::Cpp::exe_target( 'some/module/prj.rb' ) {
817
862
  # ...
818
863
  # cpp_source 'f1.cpp' # become 'some/module/f1.cpp'
819
864
  # cpp_source 'some/module/impl/f2.cpp' # remains 'some/module/impl/f2.cpp
820
865
  # This approach will be useful with Dir.glob:
821
- # Mxx_ru::Cpp::exe_target( 'some/module/prj.rb' ) {
866
+ # MxxRu::Cpp::exe_target( 'some/module/prj.rb' ) {
822
867
  # ...
823
868
  # cpp_sources Dir.glob( 'some/module/**/*.cpp' )
824
869
  # }
@@ -828,7 +873,7 @@ module Mxx_ru
828
873
  # When command line would be created, this options would
829
874
  # be concatenated with others.
830
875
  def cpp_source( a_file_name, a_options = nil )
831
- @mxx_cpp_files.push( Cpp_source_file.new(
876
+ @mxx_cpp_files.push( CppSourceFile.new(
832
877
  create_full_src_file_name( a_file_name ), a_options ) )
833
878
  end
834
879
 
@@ -845,7 +890,7 @@ module Mxx_ru
845
890
  a_rc_file,
846
891
  a_depends =nil )
847
892
 
848
- @mxx_mswin_rc_file = Mswin_rc_file.new( a_rc_file, a_depends )
893
+ @mxx_mswin_rc_file = MswinRcFile.new( a_rc_file, a_depends )
849
894
  end
850
895
 
851
896
  # Set compiled mswin resource file name.
@@ -858,16 +903,6 @@ module Mxx_ru
858
903
  @mxx_obj_files.push( String.new( file_name ) )
859
904
  end
860
905
 
861
- # Add the library required.
862
- # If a_path is other then nil, then it's value is added to the list
863
- # of a folders, the libraries should be searched in.
864
- def lib( a_library, a_path = nil )
865
- mxx_add_required_lib( a_library )
866
- if a_path
867
- mxx_add_required_lib_path( a_path )
868
- end
869
- end
870
-
871
906
  # Set import library location.
872
907
  def implib_path( name )
873
908
  @mxx_implib_path = name.clone
@@ -876,7 +911,7 @@ module Mxx_ru
876
911
  # Set optimization mode required.
877
912
  def optimization( a_mode )
878
913
  if OPTIM_SIZE != a_mode && OPTIM_SPEED != a_mode
879
- raise Mxx_ru::Invalid_value_ex.new(
914
+ raise MxxRu::InvalidValueEx.new(
880
915
  "Unknown optimization mode: '#{a_mode}'" )
881
916
  else
882
917
  @mxx_optimization = a_mode.clone
@@ -887,33 +922,13 @@ module Mxx_ru
887
922
  def build
888
923
  if nil == @mxx_last_build_result
889
924
 
890
- if !@mxx_all_options_defined
891
- # It's necessary, that toolset has defined all the options
892
- # taking all current modes into account.
893
- Mxx_ru::Cpp::toolset.setup_mandatory_options( self )
894
- @mxx_all_options_defined = true
895
- end
896
-
897
- Mxx_ru::Cpp::Mode.instance.before_subprj_processing
898
- # The build of subordinated projects performed automatically
899
- # taking dry-run mode into account.
900
- required_prjs_state = build_required_projects
901
- Mxx_ru::Cpp::Mode.instance.after_subprj_processing
902
-
903
- run_generators
904
- if !Mxx_ru::Cpp::Mode.instance.is_no_depends_analyzer
905
- run_depends_analyzer
906
- end
907
- objs_state = compile_sources
908
-
909
- res_state = compile_resources
910
-
911
- link_state = link_target(
912
- required_prjs_state,
913
- objs_state, res_state )
925
+ check_all_options_definition
914
926
 
915
- # The status of the target is determined by result of target linking.
916
- @mxx_last_build_result = link_state
927
+ builder = self.method( :normal_mode_builder )
928
+ builder = self.method( :option_extraction_mode_builder ) \
929
+ if MxxRu::Cpp::Mode.instance.is_option_extraction
930
+
931
+ @mxx_last_build_result = builder.call
917
932
  end
918
933
 
919
934
  return @mxx_last_build_result
@@ -923,34 +938,32 @@ module Mxx_ru
923
938
  def clean
924
939
  if nil == @mxx_last_build_result
925
940
 
926
- if !@mxx_all_options_defined
927
- # It's necessary, that toolset has defined all the options
928
- # taking all current modes into account.
929
- Mxx_ru::Cpp::toolset.setup_mandatory_options( self )
930
- @mxx_all_options_defined = true
931
- end
941
+ check_all_options_definition
932
942
 
933
- Mxx_ru::Cpp::Mode.instance.before_subprj_processing
934
- # The cleanup of subordinated projects performed automatically
935
- # taking dry-run mode into account.
936
- clean_required_prjs
937
- Mxx_ru::Cpp::Mode.instance.after_subprj_processing
943
+ cleaner = self.method( :normal_mode_cleaner )
944
+ cleaner = self.method( :option_extraction_mode_cleaner ) \
945
+ if MxxRu::Cpp::Mode.instance.is_option_extraction
938
946
 
939
- clean_generators
940
- clean_objs
941
- clean_resources
942
- clean_target
947
+ cleaner.call
943
948
 
944
- @mxx_last_build_result = Mxx_ru::Target_state.new(
945
- Mxx_ru::Target_state::ABSENT )
949
+ @mxx_last_build_result = MxxRu::TargetState.new(
950
+ MxxRu::TargetState::ABSENT )
951
+ end
952
+ end
953
+
954
+ # Reset build status to enable rebuild.
955
+ def reset
956
+ if @mxx_last_build_result
957
+ reset_required_projects
958
+ @mxx_last_build_result = nil
946
959
  end
947
960
  end
948
961
 
949
962
  # Get the target type.
950
963
  # Should be overloaded in child classes.
951
- # Object, inherited from Mxx_ru::Cpp::Target_type is returned.
964
+ # Object, inherited from MxxRu::Cpp::TargetType is returned.
952
965
  def target_type
953
- raise Abstract_method_ex.new( "Mxx_ru::Cpp::Target::target_type" )
966
+ raise AbstractMethodEx.new( "MxxRu::Cpp::Target::target_type" )
954
967
  end
955
968
 
956
969
  # Creation of a complete name of a resulting file
@@ -981,6 +994,90 @@ module Mxx_ru
981
994
  end
982
995
 
983
996
  protected
997
+ # Checks value of @mxx_all_options_defined and initiate
998
+ # options setup if it is nil.
999
+ def check_all_options_definition
1000
+ if !@mxx_all_options_defined
1001
+ # It's necessary, that toolset has defined all the options
1002
+ # taking all current modes into account.
1003
+ MxxRu::Cpp::toolset.setup_mandatory_options( self )
1004
+ @mxx_all_options_defined = true
1005
+ end
1006
+ end
1007
+
1008
+ # Performs 'build' in normal mode.
1009
+ def normal_mode_builder
1010
+ MxxRu::Cpp::Mode.instance.before_subprj_processing
1011
+ # The build of subordinated projects performed automatically
1012
+ # taking dry-run mode into account.
1013
+ required_prjs_state = build_required_projects
1014
+ MxxRu::Cpp::Mode.instance.after_subprj_processing
1015
+
1016
+ run_generators
1017
+ if !MxxRu::Cpp::Mode.instance.is_no_depends_analyzer
1018
+ run_depends_analyzer
1019
+ end
1020
+ objs_state = compile_sources
1021
+
1022
+ res_state = compile_resources
1023
+
1024
+ link_state = link_target(
1025
+ required_prjs_state,
1026
+ objs_state, res_state )
1027
+
1028
+ # The status of the target is determined by result of target linking.
1029
+ link_state
1030
+ end
1031
+
1032
+ # Performs 'clean' in normal mode
1033
+ def normal_mode_cleaner
1034
+ MxxRu::Cpp::Mode.instance.before_subprj_processing
1035
+ # The cleanup of subordinated projects performed automatically
1036
+ # taking dry-run mode into account.
1037
+ clean_required_prjs
1038
+ MxxRu::Cpp::Mode.instance.after_subprj_processing
1039
+
1040
+ clean_generators
1041
+ clean_objs
1042
+ clean_resources
1043
+ clean_target
1044
+ end
1045
+
1046
+ # Performs 'build' in 'option extraction mode'
1047
+ def option_extraction_mode_builder
1048
+ options = {
1049
+ 'Compiler options' => :mxx_all_compiler_options,
1050
+ 'C++ Compiler Options' => :mxx_all_cpp_compiler_options,
1051
+ 'C Compiler Options' => :mxx_all_c_compiler_options,
1052
+ 'Linker Options' => :mxx_all_linker_options,
1053
+ 'Librarian Options' => :mxx_all_librarian_options,
1054
+ 'Defines' => :mxx_all_defines,
1055
+ 'Include Paths' => :mxx_all_include_paths
1056
+ }
1057
+ if 'mswin' == toolset.tag( 'target_os' )
1058
+ options.merge!(
1059
+ 'MSWindows Resource Compiler Options' => :mxx_all_mswin_rc_options,
1060
+ 'MSWindows Resource Compiler Include Paths' =>
1061
+ :mxx_all_mswin_rc_include_paths,
1062
+ 'MSWindows Resource Compiler Defines' => :mxx_all_mswin_rc_defines,
1063
+ 'MSWindows Resource Linker Options' => :mxx_all_mswin_rlink_options
1064
+ )
1065
+ end
1066
+
1067
+ options.keys.sort.each do |k|
1068
+ opts = self.send( options[ k ] )
1069
+
1070
+ puts "#{k}:\n\t#{opts.join("\n\t")}\n"
1071
+ end
1072
+
1073
+ return TargetState.new( TargetState::EXISTS )
1074
+ end
1075
+
1076
+ # Performs 'clean' in 'option extraction mode'
1077
+ def option_extraction_mode_cleaner
1078
+ # Nothing to do!
1079
+ end
1080
+
984
1081
  # Start of all generators of source files.
985
1082
  def run_generators
986
1083
  mxx_generators.each { |g| g.build( self ) }
@@ -988,7 +1085,7 @@ module Mxx_ru
988
1085
 
989
1086
  # Start of C++ dependencies analyzer.
990
1087
  def run_depends_analyzer
991
- analyzer = Analyzer::Cpp_analyzer.instance
1088
+ analyzer = Analyzer::CppAnalyzer.instance
992
1089
 
993
1090
  # We prepare the analyzer to start.
994
1091
  sources = Array.new
@@ -1016,9 +1113,9 @@ module Mxx_ru
1016
1113
  end
1017
1114
 
1018
1115
  # Start of source files compiler.
1019
- # Returns Mxx_ru::Target_state.
1116
+ # Returns MxxRu::TargetState.
1020
1117
  def compile_sources
1021
- return Mxx_ru::Cpp::toolset().make_objs( self )
1118
+ return MxxRu::Cpp::toolset().make_objs( self )
1022
1119
  end
1023
1120
 
1024
1121
  # Start of resource files compiler.
@@ -1027,38 +1124,38 @@ module Mxx_ru
1027
1124
  # We proceed from the assumption, that on one platform
1028
1125
  # some different types of resource files simultaneously can not be used.
1029
1126
  if @mxx_mswin_rc_file
1030
- return Mxx_ru::Cpp::toolset().make_mswin_res( self )
1127
+ return MxxRu::Cpp::toolset().make_mswin_res( self )
1031
1128
  end
1032
1129
 
1033
- return Mxx_ru::Target_state.new( Target_state::EXISTS )
1130
+ return MxxRu::TargetState.new( TargetState::EXISTS )
1034
1131
  end
1035
1132
 
1036
1133
  # Start of target linking.
1037
1134
  #
1038
1135
  # [_required_prjs_state_] Build results of all subprojects required.
1039
- # Object of Mxx_ru::Target_state type.
1136
+ # Object of MxxRu::TargetState type.
1040
1137
  # [_objs_state_] Compilation results of all object files
1041
- # Object of Mxx_ru::Target_state type.
1138
+ # Object of MxxRu::TargetState type.
1042
1139
  # [_res_state_] Compilation results of all resource files.
1043
- # Object of Mxx_ru::Target_state type.
1140
+ # Object of MxxRu::TargetState type.
1044
1141
  def link_target(
1045
1142
  required_prjs_state,
1046
1143
  objs_state,
1047
1144
  res_state )
1048
1145
 
1049
1146
  state = nil
1050
- toolset = Mxx_ru::Cpp::toolset
1147
+ toolset = MxxRu::Cpp::toolset
1051
1148
  if nil == target_type
1052
- raise Mxx_ru::Unsupported_target_type_ex.new(
1149
+ raise MxxRu::UnsupportedTargetTypeEx.new(
1053
1150
  self.class.name, "nil" )
1054
- elsif target_type.name == Lib_target_type::TYPE
1151
+ elsif target_type.name == LibTargetType::TYPE
1055
1152
  state = toolset.make_lib( self )
1056
- elsif target_type.name == Dll_target_type::TYPE
1153
+ elsif target_type.name == DllTargetType::TYPE
1057
1154
  state = toolset.make_dll( self )
1058
- elsif target_type.name == Exe_target_type::TYPE
1155
+ elsif target_type.name == ExeTargetType::TYPE
1059
1156
  state = toolset.make_exe( self )
1060
1157
  else
1061
- raise Mxx_ru::Unsupported_target_type_ex.new(
1158
+ raise MxxRu::UnsupportedTargetTypeEx.new(
1062
1159
  self.class.name, target_type.name )
1063
1160
  end
1064
1161
 
@@ -1070,28 +1167,28 @@ module Mxx_ru
1070
1167
  end
1071
1168
 
1072
1169
  def clean_objs
1073
- Mxx_ru::Cpp::toolset().clean_objs( self )
1170
+ MxxRu::Cpp::toolset().clean_objs( self )
1074
1171
  end
1075
1172
 
1076
1173
  def clean_resources
1077
1174
  if @mxx_mswin_rc_file
1078
- Mxx_ru::Cpp::toolset().clean_mswin_res( self )
1175
+ MxxRu::Cpp::toolset().clean_mswin_res( self )
1079
1176
  end
1080
1177
  end
1081
1178
 
1082
1179
  def clean_target
1083
- toolset = Mxx_ru::Cpp::toolset
1180
+ toolset = MxxRu::Cpp::toolset
1084
1181
  if nil == target_type
1085
- raise Mxx_ru::Unsupported_target_type_ex.new(
1182
+ raise MxxRu::UnsupportedTargetTypeEx.new(
1086
1183
  self.class.name, "nil" )
1087
- elsif target_type.name == Lib_target_type::TYPE
1184
+ elsif target_type.name == LibTargetType::TYPE
1088
1185
  state = toolset.clean_lib( self )
1089
- elsif target_type.name == Dll_target_type::TYPE
1186
+ elsif target_type.name == DllTargetType::TYPE
1090
1187
  state = toolset.clean_dll( self )
1091
- elsif target_type.name == Exe_target_type::TYPE
1188
+ elsif target_type.name == ExeTargetType::TYPE
1092
1189
  state = toolset.clean_exe( self )
1093
1190
  else
1094
- raise Mxx_ru::Unsupported_target_type_ex.new(
1191
+ raise MxxRu::UnsupportedTargetTypeEx.new(
1095
1192
  self.class.name, target_type.name )
1096
1193
  end
1097
1194
  end
@@ -1108,7 +1205,7 @@ module Mxx_ru
1108
1205
  @@mxx_globals[ a_option_desc ] = globals = Array.new
1109
1206
  end
1110
1207
 
1111
- locals = Spreadable_option.new( a_option_desc )
1208
+ locals = SpreadableOption.new( a_option_desc )
1112
1209
  @mxx_locals[ a_option_desc ] = locals
1113
1210
 
1114
1211
  meth_global = "global_#{a_option_desc}"
@@ -1117,14 +1214,14 @@ module Mxx_ru
1117
1214
  meth_upspreads = "mxx_upspread_#{a_option_desc}s"
1118
1215
 
1119
1216
  @mxx_missing_actions[ meth_global ] =
1120
- Global_option_inserter.new( a_option_desc, globals )
1217
+ GlobalOptionInserter.new( a_option_desc, globals )
1121
1218
  @mxx_missing_actions[ meth_local ] =
1122
- Spreadable_option_inserter.new( locals )
1219
+ SpreadableOptionInserter.new( locals )
1123
1220
  @mxx_missing_actions[ meth_all ] =
1124
- Spreadable_option_all_extractor.new( locals,
1221
+ SpreadableOptionAllExtractor.new( locals,
1125
1222
  globals, self, meth_upspreads )
1126
1223
  @mxx_missing_actions[ meth_upspreads ] =
1127
- Spreadable_option_upspread_extractor.new(
1224
+ SpreadableOptionUpspreadExtractor.new(
1128
1225
  locals, self, meth_upspreads )
1129
1226
  end
1130
1227
 
@@ -1147,18 +1244,18 @@ module Mxx_ru
1147
1244
  #
1148
1245
  # For example:
1149
1246
  #
1150
- # class Prj < Mxx_ru::Cpp::Lib_or_dll_target
1247
+ # class Prj < MxxRu::Cpp::LibOrDllTarget
1151
1248
  # TAG = "threads_1/prj.rb"
1152
1249
  # def initialize( a_alias = TAG )
1153
1250
  # super( a_alias, TAG )
1154
1251
  #
1155
1252
  # target( "threads.1.3" )
1156
1253
  #
1157
- # threading_mode( Mxx_ru::Cpp::THREADING_MULTI )
1254
+ # threading_mode( MxxRu::Cpp::THREADING_MULTI )
1158
1255
  #
1159
1256
  # init_dll_block(
1160
1257
  # Proc.new {
1161
- # rtl_mode( Mxx_ru::Cpp::RTL_SHARED )
1258
+ # rtl_mode( MxxRu::Cpp::RTL_SHARED )
1162
1259
  # implib_path( "lib" )
1163
1260
  # define( "THREADS_1__DLL", OPT_UPSPREAD )
1164
1261
  # })
@@ -1182,11 +1279,11 @@ module Mxx_ru
1182
1279
  #
1183
1280
  # == Manual execution of as_lib, as_dll methods
1184
1281
  #
1185
- # If project defines one class only, inherited from Lib_or_dll_target,
1282
+ # If project defines one class only, inherited from LibOrDllTarget,
1186
1283
  # then all clients of that project should explicitly call as_lib or as_dll
1187
1284
  # method during a reference to required_prj:
1188
1285
  #
1189
- # class My_prj < Mxx_ru::Cpp::Exe_target
1286
+ # class MyPrj < MxxRu::Cpp::ExeTarget
1190
1287
  # def initialize( a_alias = "my_prj.rb" )
1191
1288
  # super( a_alias )
1192
1289
  # required_prj( "threads_1/prj.rb" ).as_dll( self )
@@ -1204,7 +1301,7 @@ module Mxx_ru
1204
1301
  # define two auxiliary classes, which would call methods as_lib and as_dll
1205
1302
  # inside their constructors:
1206
1303
  #
1207
- # class Prj < Mxx_ru::Cpp::Lib_or_dll_target
1304
+ # class Prj < MxxRu::Cpp::LibOrDllTarget
1208
1305
  # def initialize( a_alias = "threads_1/prj.rb" )
1209
1306
  # super( a_alias, "threads_1" )
1210
1307
  # ...
@@ -1224,24 +1321,27 @@ module Mxx_ru
1224
1321
  # end
1225
1322
  #
1226
1323
  # Then for using the target it would be enough to do that:
1227
- # class My_prj < Mxx_ru::Cpp::Exe_target
1324
+ # class MyPrj < MxxRu::Cpp::ExeTarget
1228
1325
  # def initialize( a_alias = "my_prj.rb" )
1229
1326
  # super( a_alias )
1230
1327
  # required_prj( "threads_1/dll.rb" )
1231
1328
  # end
1232
1329
  # end
1233
1330
  #
1234
- class Lib_or_dll_target < Target
1331
+ class LibOrDllTarget < Target
1235
1332
  # Exception type, which is thrown if target type is undefined.
1236
- class Type_not_defined_ex < Mxx_ru::Ex
1333
+ class TypeNotDefinedEx < MxxRu::Ex
1237
1334
  # [_a_prj_alias_] Project alias, for which target type should be defined.
1238
1335
  def initialize( a_prj_alias )
1239
1336
  super( "#{a_prj_alias}: type of target not defined yet" )
1240
1337
  end
1241
1338
  end
1242
1339
 
1340
+ # For compatibility with previous versions.
1341
+ Type_not_defined_ex = TypeNotDefinedEx
1342
+
1243
1343
  # Exception type, which is thrown if target type was already defined.
1244
- class Type_already_defined_ex < Mxx_ru::Ex
1344
+ class TypeAlreadyDefinedEx < MxxRu::Ex
1245
1345
  # [_a_prj_tag_] Target identifier, for which type is established.
1246
1346
  # [_a_type_] Already defined target type.
1247
1347
  def initialize( a_prj_alias, a_type )
@@ -1250,9 +1350,12 @@ module Mxx_ru
1250
1350
  end
1251
1351
  end
1252
1352
 
1353
+ # For compatibility with previous versions.
1354
+ Type_already_defined_ex = TypeAlreadyDefinedEx
1355
+
1253
1356
  # Map describing unique target identifiers and their types.
1254
- # Used to avoid conflicts, when the same target is inside composite project
1255
- # as both lib and dll.
1357
+ # Used to avoid conflicts, when the same target is inside composite
1358
+ # project as both lib and dll.
1256
1359
  @@mxx_tags = Hash.new
1257
1360
 
1258
1361
  # Constructor.
@@ -1260,22 +1363,22 @@ module Mxx_ru
1260
1363
  # [_a_prj_alias_] Project alias.
1261
1364
  # [_a_prj_tag_] Unique value, which identifies target given.
1262
1365
  # This value used to avoid conflicts in the next situations:
1263
- # class Prj < Mxx_ru::Cpp::Lib_or_dll_target ... end
1366
+ # class Prj < MxxRu::Cpp::LibOrDllTarget ... end
1264
1367
  # class Lib < Prj ... end
1265
1368
  # class Dll < Prj ... end
1266
- # class My_exe < Mxx_ru::Cpp::Exe_target
1369
+ # class MyExe < MxxRu::Cpp::ExeTarget
1267
1370
  # def initialize( a_alias = "my_exe.rb" )
1268
1371
  # super( a_alias )
1269
1372
  # required_prj( "threads_1/dll.rb" )
1270
1373
  # end
1271
1374
  # end
1272
- # class My_dll < Mxx_ru::Cpp::Dll_target
1375
+ # class MyDll < MxxRu::Cpp::DllTarget
1273
1376
  # def initialize( a_alias = "my_dll.rb" )
1274
1377
  # super( a_alias )
1275
1378
  # required_prj( "threads_1/lib.rb" )
1276
1379
  # end
1277
1380
  # end
1278
- # If both My_exe and My_dll are used in one composite project,
1381
+ # If both MyExe and MyDll are used in one composite project,
1279
1382
  # then it's a conflict of usage of threads_1/dll.rb and threads_1/lib.rb.
1280
1383
  def initialize( a_prj_alias, a_prj_tag )
1281
1384
  super( a_prj_alias )
@@ -1293,8 +1396,8 @@ module Mxx_ru
1293
1396
 
1294
1397
  # Set lib as target type.
1295
1398
  def as_lib
1296
- if ensure_type_not_set_yet( Lib_target_type::TYPE )
1297
- @mxx_target_type = Lib_target_type.new
1399
+ if ensure_type_not_set_yet( LibTargetType::TYPE )
1400
+ @mxx_target_type = LibTargetType.new
1298
1401
  if nil != @mxx_init_lib_block
1299
1402
  @mxx_init_lib_block.call
1300
1403
  end
@@ -1303,8 +1406,8 @@ module Mxx_ru
1303
1406
 
1304
1407
  # Set dll as target type.
1305
1408
  def as_dll
1306
- if ensure_type_not_set_yet( Dll_target_type::TYPE )
1307
- @mxx_target_type = Dll_target_type.new
1409
+ if ensure_type_not_set_yet( DllTargetType::TYPE )
1410
+ @mxx_target_type = DllTargetType.new
1308
1411
  if nil != @mxx_init_dll_block
1309
1412
  @mxx_init_dll_block.call
1310
1413
  end
@@ -1314,7 +1417,7 @@ module Mxx_ru
1314
1417
  # Return current value of mxx_target_type.
1315
1418
  def target_type
1316
1419
  if nil == @mxx_target_type
1317
- raise Type_not_defined_ex.new( prj_alias )
1420
+ raise TypeNotDefinedEx.new( prj_alias )
1318
1421
  end
1319
1422
 
1320
1423
  return @mxx_target_type
@@ -1342,7 +1445,7 @@ module Mxx_ru
1342
1445
  def ensure_type_not_set_yet( a_type_name )
1343
1446
  if @@mxx_tags.key?( @mxx_prj_tag ) &&
1344
1447
  @@mxx_tags[ @mxx_prj_tag ] != a_type_name
1345
- raise Type_already_defined_ex.new(
1448
+ raise TypeAlreadyDefinedEx.new(
1346
1449
  @mxx_prj_tag, a_type_name )
1347
1450
  end
1348
1451
 
@@ -1350,10 +1453,13 @@ module Mxx_ru
1350
1453
 
1351
1454
  return ( nil == @mxx_target_type )
1352
1455
  end
1353
- end # class Lib_or_dll_target
1456
+ end # class LibOrDllTarget
1457
+
1458
+ # For compatibility with previous versions.
1459
+ Lib_or_dll_target = LibOrDllTarget
1354
1460
 
1355
1461
  # Lib is a target type.
1356
- class Lib_target < Lib_or_dll_target
1462
+ class LibTarget < LibOrDllTarget
1357
1463
  def initialize( a_prj_alias, &block )
1358
1464
  super( a_prj_alias, a_prj_alias )
1359
1465
 
@@ -1363,8 +1469,11 @@ module Mxx_ru
1363
1469
  end
1364
1470
  end
1365
1471
 
1472
+ # For compatibility with previous versions.
1473
+ Lib_target = LibTarget
1474
+
1366
1475
  # Dll is a target type.
1367
- class Dll_target < Lib_or_dll_target
1476
+ class DllTarget < LibOrDllTarget
1368
1477
  def initialize( a_prj_alias, &block )
1369
1478
  super( a_prj_alias, a_prj_alias )
1370
1479
 
@@ -1374,8 +1483,11 @@ module Mxx_ru
1374
1483
  end
1375
1484
  end
1376
1485
 
1486
+ # For compatibility with previous versions.
1487
+ Dll_target = DllTarget
1488
+
1377
1489
  # Exe is a target type.
1378
- class Exe_target < Target
1490
+ class ExeTarget < Target
1379
1491
 
1380
1492
  def initialize( a_alias, &block )
1381
1493
  super( a_alias )
@@ -1384,17 +1496,20 @@ module Mxx_ru
1384
1496
  end
1385
1497
 
1386
1498
  def target_type
1387
- return Exe_target_type.new
1499
+ return ExeTargetType.new
1388
1500
  end
1389
1501
  end
1390
1502
 
1503
+ # For compatibility with previous versions.
1504
+ Exe_target = ExeTarget
1505
+
1391
1506
  # Generator for generating method for simple way of describing targets.
1392
1507
  def Cpp.generate_simple_target_method( target_type )
1393
1508
  target_class_name = target_type.to_s.capitalize
1394
1509
  class_eval %Q{
1395
1510
  def Cpp.#{target_type}( prj_alias = nil, &block )
1396
- prj_alias = Mxx_ru::Util::prj_alias_form_caller( caller ) unless prj_alias
1397
- Mxx_ru::setup_target #{target_class_name}.new( prj_alias, &block )
1511
+ prj_alias = MxxRu::Util::prj_alias_form_caller( caller ) unless prj_alias
1512
+ MxxRu::setup_target #{target_class_name}.new( prj_alias, &block )
1398
1513
  end
1399
1514
  }
1400
1515
  end
@@ -1404,5 +1519,5 @@ module Mxx_ru
1404
1519
  generate_simple_target_method :exe_target
1405
1520
 
1406
1521
  end # module Cpp
1407
- end # module Mxx_ru
1522
+ end # module MxxRu
1408
1523