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
@@ -29,11 +29,11 @@
29
29
  require 'mxx_ru/ex'
30
30
  require 'mxx_ru/util'
31
31
 
32
- module Mxx_ru
32
+ module MxxRu
33
33
  module Cpp
34
34
 
35
35
  # Class, describing object file.
36
- class Obj_info
36
+ class ObjInfo
37
37
  # The name of object file.
38
38
  attr_reader :name
39
39
  # The name of source file.
@@ -47,10 +47,13 @@ module Mxx_ru
47
47
  @source = a_source
48
48
  @options = a_options
49
49
  end
50
- end # class Obj_info
50
+ end # class ObjInfo
51
+
52
+ # For compatibility with previous versions.
53
+ Obj_info = ObjInfo
51
54
 
52
55
  # Base class for any target for which full path must be calculated.
53
- class Target_with_full_path
56
+ class TargetWithFullPath
54
57
  def initialize( name, path )
55
58
  @target_path = path
56
59
  @target_name = name
@@ -62,8 +65,11 @@ module Mxx_ru
62
65
  end
63
66
  end
64
67
 
68
+ # For compatibility with previous versions.
69
+ Target_with_full_path = TargetWithFullPath
70
+
65
71
  # Class, describing mswin-res-����.
66
- class Mswin_res_info < Target_with_full_path
72
+ class MswinResInfo < TargetWithFullPath
67
73
  attr_reader :file_name
68
74
  attr_reader :path
69
75
 
@@ -75,10 +81,13 @@ module Mxx_ru
75
81
  # Folder where mswin-res-file should be.
76
82
  @path = a_path
77
83
  end
78
- end # class Mswin_res_info
84
+ end # class MswinResInfo
85
+
86
+ # For compatibility with previous versions.
87
+ Mswin_res_info = MswinResInfo
79
88
 
80
89
  # Class, describing a library.
81
- class Lib_info < Target_with_full_path
90
+ class LibInfo < TargetWithFullPath
82
91
  attr_reader :file_name
83
92
  attr_reader :path
84
93
  attr_reader :link_name
@@ -93,10 +102,13 @@ module Mxx_ru
93
102
  # The name should be passed to the linker.
94
103
  @link_name = a_link_name
95
104
  end
96
- end # class Lib_info
105
+ end # class LibInfo
106
+
107
+ # For compatibility with previous versions.
108
+ Lib_info = LibInfo
97
109
 
98
110
  # Class, describing EXE-file.
99
- class Exe_info < Target_with_full_path
111
+ class ExeInfo < TargetWithFullPath
100
112
  attr_reader :file_name
101
113
  attr_reader :path
102
114
 
@@ -108,10 +120,13 @@ module Mxx_ru
108
120
  # Folder where exe file should be.
109
121
  @path = a_path
110
122
  end
111
- end # class Exe_info
123
+ end # class ExeInfo
124
+
125
+ # For compatibility with previous versions.
126
+ Exe_info = ExeInfo
112
127
 
113
128
  # Class, describing a shared library.
114
- class Dll_info < Target_with_full_path
129
+ class DllInfo < TargetWithFullPath
115
130
  # File name of dll file without a folder.
116
131
  attr_reader :dll_file_name
117
132
  # Folder where dll file should be.
@@ -136,11 +151,13 @@ module Mxx_ru
136
151
  @link_name = a_link_name
137
152
  @link_path = a_link_path
138
153
  end
139
- end # class Dll_info
154
+ end # class DllInfo
140
155
 
156
+ # For compatibility with previous versions.
157
+ Dll_info = DllInfo
141
158
 
142
159
  # Class, incapsulating all lists required for linker.
143
- class Linker_lists
160
+ class LinkerLists
144
161
  # Object files.
145
162
  attr_reader :objs
146
163
  # Compiled resources.
@@ -186,7 +203,10 @@ module Mxx_ru
186
203
  to.flatten!
187
204
  to.uniq!
188
205
  end
189
- end # class Linker_lists
206
+ end # class LinkerLists
207
+
208
+ # For compatibility with previous versions.
209
+ Linker_lists = LinkerLists
190
210
 
191
211
  # Class, incapsulating DLL dependencies.
192
212
  #
@@ -197,8 +217,8 @@ module Mxx_ru
197
217
  # Exact details knows concrete toolset implementation only.
198
218
  # Therefore, after DLL building base toolset class addresses to it's
199
219
  # derivative with requirement to build all dependencies lists.
200
- # These lists are returned as an object of Dll_requirements type.
201
- class Dll_requirements
220
+ # These lists are returned as an object of DllRequirements type.
221
+ class DllRequirements
202
222
  # Required libraries list.
203
223
  attr_reader :libs
204
224
  # Libraries search paths.
@@ -221,20 +241,26 @@ module Mxx_ru
221
241
  def push_to( to, what )
222
242
  to << what
223
243
  to.flatten!
224
- end # Dll_requirements
225
- end
244
+ end
245
+ end # class DllRequirements
246
+
247
+ # For compatibility with previous versions.
248
+ Dll_requirements = DllRequirements
226
249
 
227
250
  # Base toolset class.
228
251
  # Toolset is a compiler and tool set for compiling an application.
229
252
  class Toolset
230
253
 
231
254
  # Exception, thrown in case of unknown toolset tag value.
232
- class Unknown_tag_ex < Mxx_ru::Ex
255
+ class UnknownTagEx < MxxRu::Ex
233
256
  def initialize( a_tag_name )
234
257
  super( "Unknown or missing toolset tag: '#{a_tag_name}" )
235
258
  end
236
259
  end
237
260
 
261
+ # For compatibility with previous versions.
262
+ Unknown_tag_ex = UnknownTagEx
263
+
238
264
  private
239
265
  # Toolset name.
240
266
  @name = nil
@@ -265,7 +291,7 @@ module Mxx_ru
265
291
  def tag( a_name, a_default = nil )
266
292
  if !@tags.key?( a_name )
267
293
  if nil == a_default
268
- raise Unknown_tag_ex.new( a_name )
294
+ raise UnknownTagEx.new( a_name )
269
295
  end
270
296
 
271
297
  return a_default
@@ -277,17 +303,17 @@ module Mxx_ru
277
303
  # taking all current modes, such as runtime_mode, rtl_mode,
278
304
  # rtti_mode, threading_mode etc into account.
279
305
  # Target parameter should be an object of a class, inherited from
280
- # Mxx_ru::Cpp::Target.
306
+ # MxxRu::Cpp::Target.
281
307
  #
282
- # Throws Abstract_method_ex exception in a base class.
308
+ # Throws AbstractMethodEx exception in a base class.
283
309
  #
284
310
  def setup_mandatory_options( target )
285
- raise Abstract_method_ex.new( "Mxx_ru::Cpp::Toolset::setup_mandatory_options" )
311
+ raise AbstractMethodEx.new( "MxxRu::Cpp::Toolset::setup_mandatory_options" )
286
312
  end
287
313
 
288
314
  # Perform C++ files compilation.
289
315
  # Target parameter should be an object of a class, inherited from
290
- # Mxx_ru::Cpp::Target.
316
+ # MxxRu::Cpp::Target.
291
317
  def make_objs( target )
292
318
  # Creating all object file names.
293
319
  c_objs = make_obj_names( target.mxx_c_files, target )
@@ -315,11 +341,11 @@ module Mxx_ru
315
341
  cpp_objs.each { |o| target.obj_file( o.name ) }
316
342
 
317
343
  # Also informing if some object files were rebuilt.
318
- state = Target_state::EXISTS
319
- state = Target_state::REBUILT if ( c_objs_to_build.size() ||
344
+ state = TargetState::EXISTS
345
+ state = TargetState::REBUILT if ( c_objs_to_build.size() ||
320
346
  cpp_objs_to_build.size() )
321
347
 
322
- return Target_state.new( state )
348
+ return TargetState.new( state )
323
349
  end
324
350
 
325
351
  # Remove object files.
@@ -328,13 +354,13 @@ module Mxx_ru
328
354
  c_objs = make_obj_names( target.mxx_c_files, target )
329
355
  cpp_objs = make_obj_names( target.mxx_cpp_files, target )
330
356
 
331
- c_objs.each { |o| Mxx_ru::Util::delete_file( o.name ) }
332
- cpp_objs.each { |o| Mxx_ru::Util::delete_file( o.name ) }
357
+ c_objs.each { |o| MxxRu::Util::delete_file( o.name ) }
358
+ cpp_objs.each { |o| MxxRu::Util::delete_file( o.name ) }
333
359
  end
334
360
 
335
361
  # Perform resource files compilation.
336
362
  # Target parameter should be an object of a class, inherited from
337
- # Mxx_ru::Cpp::Target.
363
+ # MxxRu::Cpp::Target.
338
364
  def make_mswin_res( target )
339
365
  # Creating the name of res file and storing it in the target.
340
366
  res_info = make_mswin_res_name(
@@ -345,20 +371,20 @@ module Mxx_ru
345
371
  target.mswin_res_file( full_name )
346
372
 
347
373
  # Determining it's status.
348
- state = Target_state::detect( full_name,
374
+ state = TargetState::detect( full_name,
349
375
  [ target.mxx_mswin_rc_file.name ] +
350
376
  target.mxx_mswin_rc_file.depends )
351
- if state.state != Target_state::EXISTS
377
+ if state.state != TargetState::EXISTS
352
378
  cmd_lines = make_mswin_res_command_lines(
353
379
  full_name, target.mxx_mswin_rc_file.name,
354
380
  target.mxx_all_mswin_rc_options, target )
355
381
 
356
- Mxx_ru::Abstract_target::run(
382
+ MxxRu::AbstractTarget::run(
357
383
  cmd_lines,
358
384
  [ full_name ],
359
385
  "compilling #{full_name}" )
360
386
 
361
- state = Mxx_ru::Target_state.new( Mxx_ru::Target_state::REBUILT )
387
+ state = MxxRu::TargetState.new( MxxRu::TargetState::REBUILT )
362
388
  end
363
389
 
364
390
  return state
@@ -372,7 +398,7 @@ module Mxx_ru
372
398
 
373
399
  full_name = res_info.full_name
374
400
 
375
- Mxx_ru::Util::delete_file( full_name )
401
+ MxxRu::Util::delete_file( full_name )
376
402
 
377
403
  clean_mswin_res_specific_files( full_name, res_info, target )
378
404
  end
@@ -391,7 +417,7 @@ module Mxx_ru
391
417
 
392
418
  # Perform static library build.
393
419
  # Target parameter should be an object of a class, inherited from
394
- # Mxx_ru::Cpp::Target.
420
+ # MxxRu::Cpp::Target.
395
421
  def make_lib( target )
396
422
  # Creating result file name. Also determining in which folder
397
423
  # lib should be. The name of that folder should be included in
@@ -401,39 +427,37 @@ module Mxx_ru
401
427
  # Determining target status.
402
428
  lib_file = lib_info.full_name
403
429
 
404
- lib_state = Mxx_ru::Target_state::detect(
430
+ lib_state = MxxRu::TargetState::detect(
405
431
  lib_file, target.mxx_obj_files )
406
- if Mxx_ru::Target_state::EXISTS != lib_state.state
432
+ if MxxRu::TargetState::EXISTS != lib_state.state
407
433
  # File should be rebuilt.
408
434
  cmd_lines = make_lib_command_lines(
409
435
  lib_file, target.mxx_obj_files,
410
436
  target.mxx_all_librarian_options, target )
411
437
 
412
- Mxx_ru::Abstract_target::run(
438
+ MxxRu::AbstractTarget::run(
413
439
  cmd_lines,
414
440
  [ lib_file ],
415
441
  "building #{lib_file}" )
416
442
 
417
- lib_state = Mxx_ru::Target_state.new( Mxx_ru::Target_state::REBUILT )
443
+ lib_state = MxxRu::TargetState.new( MxxRu::TargetState::REBUILT )
418
444
  end
419
445
 
420
446
  # Full library file name should be included in files list, created by
421
447
  # given target.
422
448
  target.mxx_add_full_target_name( lib_file )
423
449
 
424
- # For a library, in a dependency list the library itself may be included.
425
- target.mxx_add_required_lib( lib_info.link_name )
450
+ # For a library, in a dependency list the library itself may be
451
+ # included.
452
+ target.mxx_add_required_lib(
453
+ BinaryLibrary.new( lib_info.link_name, BinaryLibrary::STATIC ) )
426
454
  target.mxx_add_required_lib_path( lib_info.path )
427
455
 
428
456
  # And all libraries and folders from all subordinated projects.
429
457
  target.mxx_required_prjs.each { |d|
430
- if d.kind_of?( Mxx_ru::Binary_target )
431
- d.mxx_required_libs.each { |l|
432
- target.mxx_add_required_lib( l )
433
- }
434
- d.mxx_required_lib_paths.each { |p|
435
- target.mxx_add_required_lib_path( p )
436
- }
458
+ if d.kind_of?( MxxRu::BinaryTarget )
459
+ target.mxx_add_required_libs( d.mxx_required_libs )
460
+ target.mxx_add_required_lib_paths( d.mxx_required_lib_paths )
437
461
  end
438
462
  }
439
463
 
@@ -442,7 +466,7 @@ module Mxx_ru
442
466
 
443
467
  # Perform cleanup of static library.
444
468
  # Target parameter should be an object of a class, inherited from
445
- # Mxx_ru::Cpp::Target.
469
+ # MxxRu::Cpp::Target.
446
470
  def clean_lib( target )
447
471
  # Creating result file name. Also determining in which folder
448
472
  # lib should be.
@@ -450,7 +474,7 @@ module Mxx_ru
450
474
 
451
475
  lib_file = lib_info.full_name
452
476
 
453
- Mxx_ru::Util::delete_file( lib_file )
477
+ MxxRu::Util::delete_file( lib_file )
454
478
 
455
479
  clean_lib_specific_files( lib_file, lib_info, target )
456
480
  end
@@ -460,7 +484,7 @@ module Mxx_ru
460
484
  # by a child class.
461
485
  #
462
486
  # [_a_lib_file_] Full name of library file.
463
- # [_a_lib_info_] Lib_info, created for the file.
487
+ # [_a_lib_info_] LibInfo, created for the file.
464
488
  # [_a_target_] Target, library is created for.
465
489
  def clean_lib_specific_files(
466
490
  a_lib_file,
@@ -470,7 +494,7 @@ module Mxx_ru
470
494
 
471
495
  # Perform dynamic library build.
472
496
  # Target parameter should be an object of a class, inherited from
473
- # Mxx_ru::Cpp::Target.
497
+ # MxxRu::Cpp::Target.
474
498
  def make_dll( target )
475
499
  # Creating result file name.
476
500
  dll_info = make_dll_name( target.mxx_target_name, target )
@@ -484,20 +508,20 @@ module Mxx_ru
484
508
 
485
509
  dll_file = dll_info.full_name
486
510
 
487
- dll_state = Mxx_ru::Target_state::detect(
511
+ dll_state = MxxRu::TargetState::detect(
488
512
  dll_file, all_depend_files )
489
- if Mxx_ru::Target_state::EXISTS != dll_state.state
513
+ if MxxRu::TargetState::EXISTS != dll_state.state
490
514
  # Target should be rebuilt.
491
515
 
492
516
  cmd_lines = make_dll_command_lines(
493
517
  dll_file, dll_info, link_lists, target )
494
518
 
495
- Mxx_ru::Abstract_target::run(
519
+ MxxRu::AbstractTarget::run(
496
520
  cmd_lines,
497
521
  [ dll_file ],
498
522
  "building #{dll_file}" )
499
523
 
500
- dll_state = Mxx_ru::Target_state.new( Mxx_ru::Target_state::REBUILT )
524
+ dll_state = MxxRu::TargetState.new( MxxRu::TargetState::REBUILT )
501
525
  end
502
526
 
503
527
  # Full library file name should be included in files list, created by
@@ -508,24 +532,22 @@ module Mxx_ru
508
532
  dll_requirements = make_dll_requirements(
509
533
  dll_file, dll_info, link_lists, target )
510
534
 
511
- dll_requirements.libs.each { |l|
512
- target.mxx_add_required_lib( l ) }
513
- dll_requirements.lib_paths.each { |p|
514
- target.mxx_add_required_lib_path( p ) }
535
+ target.mxx_add_required_libs( dll_requirements.libs )
536
+ target.mxx_add_required_lib_paths( dll_requirements.lib_paths )
515
537
 
516
538
  return dll_state
517
539
  end
518
540
 
519
541
  # Perform dynamic library cleanup.
520
542
  # Target parameter should be an object of a class, inherited from
521
- # Mxx_ru::Cpp::Target.
543
+ # MxxRu::Cpp::Target.
522
544
  def clean_dll( target )
523
545
  # Creating result file name.
524
546
  dll_info = make_dll_name( target.mxx_target_name, target )
525
547
 
526
548
  dll_file = dll_info.full_name
527
549
 
528
- Mxx_ru::Util::delete_file( dll_file )
550
+ MxxRu::Util::delete_file( dll_file )
529
551
 
530
552
  clean_dll_specific_files( dll_file, dll_info, target )
531
553
  end
@@ -535,7 +557,7 @@ module Mxx_ru
535
557
  # by a child class if import library may be created on given platform.
536
558
  #
537
559
  # [_a_dll_file_] Full library file name.
538
- # [_a_dll_info_] Dll_info, created for the file.
560
+ # [_a_dll_info_] DllInfo, created for the file.
539
561
  # [_a_target_] Target, the library is created for.
540
562
  def clean_dll_specific_files(
541
563
  a_dll_file,
@@ -545,7 +567,7 @@ module Mxx_ru
545
567
 
546
568
  # Perform executable file build.
547
569
  # Target parameter should be an object of a class, inherited from
548
- # Mxx_ru::Cpp::Target.
570
+ # MxxRu::Cpp::Target.
549
571
  def make_exe( target )
550
572
  # Creating result file name.
551
573
  exe_info = make_exe_name( target.mxx_target_name, target )
@@ -555,21 +577,21 @@ module Mxx_ru
555
577
 
556
578
  exe_file = exe_info.full_name
557
579
 
558
- exe_state = Mxx_ru::Target_state::detect(
580
+ exe_state = MxxRu::TargetState::detect(
559
581
  exe_file, all_depend_files )
560
- if Mxx_ru::Target_state::EXISTS != exe_state.state
582
+ if MxxRu::TargetState::EXISTS != exe_state.state
561
583
  # Target should be rebuilt.
562
584
 
563
585
  link_lists = prepare_linker_lists( target )
564
586
  cmd_lines = make_exe_command_lines(
565
587
  exe_file, exe_info, link_lists, target )
566
588
 
567
- Mxx_ru::Abstract_target::run(
589
+ MxxRu::AbstractTarget::run(
568
590
  cmd_lines,
569
591
  [ exe_file ],
570
592
  "building #{exe_file}" )
571
593
 
572
- exe_state = Mxx_ru::Target_state.new( Mxx_ru::Target_state::REBUILT )
594
+ exe_state = MxxRu::TargetState.new( MxxRu::TargetState::REBUILT )
573
595
  end
574
596
 
575
597
  # Full library file name should be included in files list, created by
@@ -581,14 +603,14 @@ module Mxx_ru
581
603
 
582
604
  # Perform executable file cleanup.
583
605
  # Target parameter should be an object of a class, inherited from
584
- # Mxx_ru::Cpp::Target.
606
+ # MxxRu::Cpp::Target.
585
607
  def clean_exe( target )
586
608
  # Creating result file name.
587
609
  exe_info = make_exe_name( target.mxx_target_name, target )
588
610
 
589
611
  exe_file = exe_info.full_name
590
612
 
591
- Mxx_ru::Util::delete_file( exe_file )
613
+ MxxRu::Util::delete_file( exe_file )
592
614
 
593
615
  clean_exe_specific_files( exe_file, exe_info, target )
594
616
  end
@@ -598,7 +620,7 @@ module Mxx_ru
598
620
  # by a child class.
599
621
  #
600
622
  # [_a_exe_file_] Full file name.
601
- # [_a_exe_info_] Exe_info, created for the file.
623
+ # [_a_exe_info_] ExeInfo, created for the file.
602
624
  # [_a_target_] Target, the file is created for.
603
625
  def clean_exe_specific_files(
604
626
  a_exe_file,
@@ -609,17 +631,17 @@ module Mxx_ru
609
631
  # Get file extension for an object file.
610
632
  # Should be redefined in a child class.
611
633
  #
612
- # Abstract_method_ex exception is thrown in a base class.
634
+ # AbstractMethodEx exception is thrown in a base class.
613
635
  #
614
636
  def obj_file_ext()
615
- raise Abstract_method_ex.new( "Mxx_ru::Cpp::Toolset::obj_file_ext" )
637
+ raise AbstractMethodEx.new( "MxxRu::Cpp::Toolset::obj_file_ext" )
616
638
  end
617
639
 
618
640
  # Create command line for C file compilation.
619
641
  # Returns Array of String with command lines.
620
642
  # Should be redefined in a child class.
621
643
  #
622
- # Abstract_method_ex exception is thrown in a base class.
644
+ # AbstractMethodEx exception is thrown in a base class.
623
645
  #
624
646
  # [_obj_name_] Object file name.
625
647
  # [_source_name_] Source file name.
@@ -631,15 +653,15 @@ module Mxx_ru
631
653
  compiler_options,
632
654
  target )
633
655
 
634
- raise Abstract_method_ex.new(
635
- "Mxx_ru::Cpp::Toolset::make_c_obj_command_lines" )
656
+ raise AbstractMethodEx.new(
657
+ "MxxRu::Cpp::Toolset::make_c_obj_command_lines" )
636
658
  end
637
659
 
638
660
  # Create command line for C++ file compilation.
639
661
  # Returns Array of String with command lines.
640
662
  # Should be redefined in a child class.
641
663
  #
642
- # Abstract_method_ex exception is thrown in a base class.
664
+ # AbstractMethodEx exception is thrown in a base class.
643
665
  #
644
666
  # [_obj_name_] Object file name.
645
667
  # [_source_name_] Source file name.
@@ -651,15 +673,15 @@ module Mxx_ru
651
673
  compiler_options,
652
674
  target )
653
675
 
654
- raise Abstract_method_ex.new(
655
- "Mxx_ru::Cpp::Toolset::make_c_obj_command_lines" )
676
+ raise AbstractMethodEx.new(
677
+ "MxxRu::Cpp::Toolset::make_c_obj_command_lines" )
656
678
  end
657
679
 
658
680
  # Create command line for resource file compilation.
659
681
  # Returns Array of String with command lines.
660
682
  # Should be redefined in a child class.
661
683
  #
662
- # Abstract_method_ex exception is thrown in a base class.
684
+ # AbstractMethodEx exception is thrown in a base class.
663
685
  #
664
686
  # [_res_name_] Full file name of resulting res file.
665
687
  # [_rc_file_] Source resource file.
@@ -671,33 +693,33 @@ module Mxx_ru
671
693
  rc_options,
672
694
  target )
673
695
 
674
- raise Abstract_method_ex.new(
675
- "Mxx_ru::Cpp::Toolset::make_mswin_res_command_lines" )
696
+ raise AbstractMethodEx.new(
697
+ "MxxRu::Cpp::Toolset::make_mswin_res_command_lines" )
676
698
  end
677
699
 
678
700
  # Get static library file name.
679
701
  #
680
- # Abstract_method_ex exception is thrown in a base class.
702
+ # AbstractMethodEx exception is thrown in a base class.
681
703
  #
682
704
  def lib_file_name( source_name )
683
- raise Abstract_method_ex.new(
684
- "Mxx_ru::Cpp::Toolset::lib_file_name" )
705
+ raise AbstractMethodEx.new(
706
+ "MxxRu::Cpp::Toolset::lib_file_name" )
685
707
  end
686
708
 
687
709
  # Get static library name, which should be passed to the linker.
688
710
  #
689
- # Abstract_method_ex exception is thrown in a base class.
711
+ # AbstractMethodEx exception is thrown in a base class.
690
712
  #
691
713
  def lib_link_name( source_name )
692
- raise Abstract_method_ex.new(
693
- "Mxx_ru::Cpp::Toolset::lib_link_name" )
714
+ raise AbstractMethodEx.new(
715
+ "MxxRu::Cpp::Toolset::lib_link_name" )
694
716
  end
695
717
 
696
718
  # Create command line for static library build.
697
719
  # Returns Array of String with command lines.
698
720
  # Should be redefined in a child class.
699
721
  #
700
- # Abstract_method_ex exception is thrown in a base class.
722
+ # AbstractMethodEx exception is thrown in a base class.
701
723
  #
702
724
  # [_lib_name_] Result library file name.
703
725
  # [_obj_files_] Object file names, which should be included in the library.
@@ -709,23 +731,23 @@ module Mxx_ru
709
731
  librarian_options,
710
732
  target )
711
733
 
712
- raise Abstract_method_ex.new(
713
- "Mxx_ru::Cpp::Toolset::make_lib_command_lines" )
734
+ raise AbstractMethodEx.new(
735
+ "MxxRu::Cpp::Toolset::make_lib_command_lines" )
714
736
  end
715
737
 
716
738
  # Get shared library file name.
717
739
  #
718
- # Abstract_method_ex exception is thrown in a base class.
740
+ # AbstractMethodEx exception is thrown in a base class.
719
741
  #
720
742
  def dll_file_name( source_name )
721
- raise Abstract_method_ex.new(
722
- "Mxx_ru::Cpp::Toolset::dll_file_name" )
743
+ raise AbstractMethodEx.new(
744
+ "MxxRu::Cpp::Toolset::dll_file_name" )
723
745
  end
724
746
 
725
747
  # Get shared library name, which should be passed to the linker.
726
748
  # May return nil if no import library defined.
727
749
  #
728
- # Abstract_method_ex exception is thrown in a base class.
750
+ # AbstractMethodEx exception is thrown in a base class.
729
751
  #
730
752
  # [_dll_real_name_] The name, returned on previous reference to
731
753
  # dll_file_name.
@@ -733,8 +755,8 @@ module Mxx_ru
733
755
  def implib_link_name(
734
756
  dll_real_name,
735
757
  target )
736
- raise Abstract_method_ex.new(
737
- "Mxx_ru::Cpp::Toolset::implib_link_name" )
758
+ raise AbstractMethodEx.new(
759
+ "MxxRu::Cpp::Toolset::implib_link_name" )
738
760
  end
739
761
 
740
762
  # Get folder name containing import library, which should be passed
@@ -743,7 +765,7 @@ module Mxx_ru
743
765
  # May return nil, if no import library defined.
744
766
  # Should be redefined in a child class.
745
767
  #
746
- # Abstract_method_ex exception is thrown in a base class.
768
+ # AbstractMethodEx exception is thrown in a base class.
747
769
  #
748
770
  # [_dll_real_name_] The name, returned on previous reference to
749
771
  # dll_file_name.
@@ -753,15 +775,15 @@ module Mxx_ru
753
775
  dll_real_name,
754
776
  dll_real_path,
755
777
  target )
756
- raise Abstract_method_ex.new(
757
- "Mxx_ru::Cpp::Toolset::implib_link_path" )
778
+ raise AbstractMethodEx.new(
779
+ "MxxRu::Cpp::Toolset::implib_link_path" )
758
780
  end
759
781
 
760
782
  # Create command line for DLL build.
761
783
  # Returns Array of String with command lines.
762
784
  # Should be redefined in a child class.
763
785
  #
764
- # Abstract_method_ex exception is thrown in a base class.
786
+ # AbstractMethodEx exception is thrown in a base class.
765
787
  #
766
788
  # [_a_dll_name_] DLL result file name.
767
789
  # [_a_dll_info_] DLL description.
@@ -773,14 +795,14 @@ module Mxx_ru
773
795
  a_linker_lists,
774
796
  a_target )
775
797
 
776
- raise Abstract_method_ex.new(
777
- "Mxx_ru::Cpp::Toolset::make_dll_command_lines" )
798
+ raise AbstractMethodEx.new(
799
+ "MxxRu::Cpp::Toolset::make_dll_command_lines" )
778
800
  end
779
801
 
780
802
  # Create dependencies list from DLL given.
781
- # Returns Dll_requirements object.
803
+ # Returns DllRequirements object.
782
804
  #
783
- # Abstract_method_ex exception is thrown in a base class.
805
+ # AbstractMethodEx exception is thrown in a base class.
784
806
  #
785
807
  # [_a_dll_name_] DLL result file name.
786
808
  # [_a_dll_info_] DLL description.
@@ -792,24 +814,24 @@ module Mxx_ru
792
814
  a_linker_lists,
793
815
  a_target )
794
816
 
795
- raise Abstract_method_ex.new(
796
- "Mxx_ru::Cpp::Toolset::make_dll_requirements" )
817
+ raise AbstractMethodEx.new(
818
+ "MxxRu::Cpp::Toolset::make_dll_requirements" )
797
819
  end
798
820
 
799
821
  # Get executable file name.
800
822
  #
801
- # Abstract_method_ex exception is thrown in a base class.
823
+ # AbstractMethodEx exception is thrown in a base class.
802
824
  #
803
825
  def exe_file_name( source_name )
804
- raise Abstract_method_ex.new(
805
- "Mxx_ru::Cpp::Toolset::exe_file_name" )
826
+ raise AbstractMethodEx.new(
827
+ "MxxRu::Cpp::Toolset::exe_file_name" )
806
828
  end
807
829
 
808
830
  # Create command line for EXE build.
809
831
  # Returns Array of String with command lines.
810
832
  # Should be redefined in a child class.
811
833
  #
812
- # Abstract_method_ex exception is thrown in a base class.
834
+ # AbstractMethodEx exception is thrown in a base class.
813
835
  #
814
836
  # [_a_exe_name_] EXE result file name.
815
837
  # [_a_exe_info_] EXE description.
@@ -821,8 +843,8 @@ module Mxx_ru
821
843
  a_linker_lists,
822
844
  a_target )
823
845
 
824
- raise Abstract_method_ex.new(
825
- "Mxx_ru::Cpp::Toolset::make_exe_command_lines" )
846
+ raise AbstractMethodEx.new(
847
+ "MxxRu::Cpp::Toolset::make_exe_command_lines" )
826
848
  end
827
849
 
828
850
  # toolset name accessor.
@@ -832,14 +854,14 @@ module Mxx_ru
832
854
 
833
855
  protected
834
856
  # Creating object file names.
835
- # Returns array of Obj_info objects.
857
+ # Returns array of ObjInfo objects.
836
858
  def make_obj_names( sources, target )
837
859
  obj_names = Array.new
838
860
  sources.each { |s|
839
861
  # Get file name with extension.
840
862
  only_name = File::basename( s.name )
841
863
  # Get file name without extension.
842
- only_name = Mxx_ru::Util::remove_file_ext( only_name )
864
+ only_name = MxxRu::Util::remove_file_ext( only_name )
843
865
 
844
866
  # Get source folder name.
845
867
  source_path = File::dirname( s.name )
@@ -847,7 +869,7 @@ module Mxx_ru
847
869
  dest_path = target.mxx_obj_placement.get_obj(
848
870
  source_path, self, target )
849
871
  # Object file name creation.
850
- obj_names.push( Obj_info.new(
872
+ obj_names.push( ObjInfo.new(
851
873
  File::join( dest_path, only_name + obj_file_ext() ),
852
874
  s,
853
875
  s.compiler_options ) )
@@ -857,16 +879,16 @@ module Mxx_ru
857
879
 
858
880
  # Definition of object files, required to build (if absent)
859
881
  # or rebuild (if outdated).
860
- # Returns array of Obj_info objects.
882
+ # Returns array of ObjInfo objects.
861
883
  #
862
- # [_objs_] Array of Obj_info
884
+ # [_objs_] Array of ObjInfo
863
885
  def detect_objs_to_rebuild( objs )
864
886
 
865
887
  obj_names = Array.new
866
888
  objs.each { |o|
867
- obj_state = Mxx_ru::Target_state::detect(
889
+ obj_state = MxxRu::TargetState::detect(
868
890
  o.name, [ o.source.name ] + o.source.depends )
869
- if Mxx_ru::Target_state::EXISTS != obj_state.state
891
+ if MxxRu::TargetState::EXISTS != obj_state.state
870
892
  # File should be rebuilt.
871
893
  obj_names << o
872
894
  end
@@ -877,11 +899,12 @@ module Mxx_ru
877
899
 
878
900
  # Compilation of object files given.
879
901
  #
880
- # [_objs_to_build_] Array of Obj_info.
902
+ # [_objs_to_build_] Array of ObjInfo.
881
903
  # [_target_] Target object, contatining these object files.
882
- # [_lang_specific_options_] C or C++ specific compiler options. Array of String.
883
- # [_a_method_name_] Method name, which should be executed for command line build
884
- # of source file compilation.
904
+ # [_lang_specific_options_] C or C++ specific compiler options. Array of
905
+ # String.
906
+ # [_a_method_name_] Method name, which should be executed for command
907
+ # line build of source file compilation.
885
908
  def build_objs(
886
909
  objs_to_build,
887
910
  target,
@@ -905,7 +928,7 @@ module Mxx_ru
905
928
  target )
906
929
 
907
930
  # Executing.
908
- Mxx_ru::Abstract_target::run(
931
+ MxxRu::AbstractTarget::run(
909
932
  cmd_lines,
910
933
  [ o.name ],
911
934
  "compiling #{o.source.name}" )
@@ -914,9 +937,9 @@ module Mxx_ru
914
937
  end
915
938
 
916
939
  # Creating file name for compiled resources.
917
- # Returns Mswin_res_info object.
940
+ # Returns MswinResInfo object.
918
941
  def make_mswin_res_name( rc_file, target )
919
- source_name = Mxx_ru::Util::remove_file_ext(
942
+ source_name = MxxRu::Util::remove_file_ext(
920
943
  File::basename( rc_file ) )
921
944
  source_path = File::dirname( rc_file )
922
945
 
@@ -924,31 +947,35 @@ module Mxx_ru
924
947
  dest_path = target.mxx_obj_placement.get_mswin_res(
925
948
  source_path, self, target )
926
949
 
927
- return Mswin_res_info.new( real_name, dest_path )
950
+ return MswinResInfo.new( real_name, dest_path )
928
951
  end
929
952
 
930
953
  # Creating static library file name.
931
- # Returns Lib_info object.
954
+ # Returns LibInfo object.
932
955
  def make_lib_name( lib_name, target )
933
956
  source_name = File::basename( lib_name )
934
957
  source_path = File::dirname( lib_name )
935
958
 
936
- real_name = lib_file_name( source_name )
959
+ real_name = setup_custom_target_ext(
960
+ lib_file_name( source_name ),
961
+ target )
937
962
  link_name = lib_link_name( source_name )
938
963
  dest_path = target.mxx_obj_placement.get_lib(
939
964
  source_path, self, target )
940
965
 
941
- return Lib_info.new(
966
+ return LibInfo.new(
942
967
  real_name, dest_path, link_name )
943
968
  end
944
969
 
945
970
  # Creating shared library file name.
946
- # Returns Dll_info object.
971
+ # Returns DllInfo object.
947
972
  def make_dll_name( dll_name, target )
948
973
  source_name = File::basename( dll_name )
949
974
  source_path = File::dirname( dll_name )
950
975
 
951
- dll_real_name = dll_file_name( source_name )
976
+ dll_real_name = setup_custom_target_ext(
977
+ dll_file_name( source_name ),
978
+ target )
952
979
  dll_dest_path = target.mxx_obj_placement.get_dll(
953
980
  source_path, self, target )
954
981
 
@@ -959,21 +986,23 @@ module Mxx_ru
959
986
  dll_real_name, dll_dest_path, target )
960
987
  end
961
988
 
962
- return Dll_info.new(
989
+ return DllInfo.new(
963
990
  dll_real_name, dll_dest_path, link_name, link_path )
964
991
  end
965
992
 
966
993
  # Creating executable file name.
967
- # Returns Exe_info object.
994
+ # Returns ExeInfo object.
968
995
  def make_exe_name( exe_name, target )
969
996
  source_name = File::basename( exe_name )
970
997
  source_path = File::dirname( exe_name )
971
998
 
972
- real_name = exe_file_name( source_name )
999
+ real_name = setup_custom_target_ext(
1000
+ exe_file_name( source_name ),
1001
+ target )
973
1002
  dest_path = target.mxx_obj_placement.get_exe(
974
1003
  source_path, self, target )
975
1004
 
976
- return Exe_info.new(
1005
+ return ExeInfo.new(
977
1006
  real_name, dest_path )
978
1007
  end
979
1008
 
@@ -998,9 +1027,9 @@ module Mxx_ru
998
1027
  end
999
1028
 
1000
1029
  # Creating all lists required for linker.
1001
- # Returns Linker_lists object.
1030
+ # Returns LinkerLists object.
1002
1031
  def prepare_linker_lists( target )
1003
- result = Linker_lists.new
1032
+ result = LinkerLists.new
1004
1033
 
1005
1034
  result.add_objs( target.mxx_obj_files )
1006
1035
  result.add_resources( target.mxx_mswin_res_file )
@@ -1008,17 +1037,31 @@ module Mxx_ru
1008
1037
  result.add_lib_paths( target.mxx_required_lib_paths )
1009
1038
 
1010
1039
  target.mxx_required_prjs.each { |d|
1011
- if d.kind_of?( Mxx_ru::Binary_target )
1040
+ if d.kind_of?( MxxRu::BinaryTarget )
1012
1041
  result.add_libs( d.mxx_required_libs )
1013
1042
  result.add_lib_paths( d.mxx_required_lib_paths )
1014
1043
  end
1015
1044
  }
1016
1045
 
1046
+ # At now libraries conflicts must be checked.
1047
+ BinaryTarget.check_libraries_types( target.prj_alias, result.libs )
1048
+
1017
1049
  result.add_linker_options( target.mxx_all_linker_options )
1018
1050
 
1019
1051
  return result
1020
1052
  end
1021
1053
 
1054
+ protected
1055
+ # Setup custom target extension if that extension defined.
1056
+ def setup_custom_target_ext( target_file_name, target )
1057
+ if target.mxx_target_ext
1058
+ return Util::remove_file_ext( target_file_name ) +
1059
+ target.mxx_target_ext
1060
+ end
1061
+
1062
+ target_file_name
1063
+ end
1064
+
1022
1065
  end # class Toolset
1023
1066
 
1024
1067
  # Current toolset.
@@ -1026,9 +1069,9 @@ module Mxx_ru
1026
1069
 
1027
1070
  # Set current toolset.
1028
1071
  def Cpp.setup_toolset( toolset )
1029
- raise Mxx_ru.Invalid_cast_ex.new(
1030
- 'Expected Mxx_ru::Cpp::Toolset' ) if
1031
- !( toolset.kind_of?( Mxx_ru::Cpp::Toolset ) )
1072
+ raise MxxRu::InvalidCastEx.new(
1073
+ 'Expected MxxRu::Cpp::Toolset' ) if
1074
+ !( toolset.kind_of?( MxxRu::Cpp::Toolset ) )
1032
1075
 
1033
1076
  @@current_toolset = toolset
1034
1077
  end
@@ -1040,5 +1083,5 @@ module Mxx_ru
1040
1083
 
1041
1084
  end # module Cpp
1042
1085
 
1043
- end # module Mxx_ru
1086
+ end # module MxxRu
1044
1087