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
@@ -32,18 +32,18 @@ require 'set'
32
32
  require 'mxx_ru/cpp/target'
33
33
  require 'mxx_ru/cpp/toolsets/vc_family'
34
34
 
35
- module Mxx_ru
35
+ module MxxRu
36
36
  module Cpp
37
37
 
38
38
  # Expand class Target to store source and actual manifest descriptions.
39
- class Target < Mxx_ru::Binary_target
39
+ class Target < MxxRu::BinaryTarget
40
40
  # Get source manifest description. If target has no manifest
41
41
  # then default manifest will be returned.
42
42
  def vc8_source_manifest
43
43
  if nil != @vc8_source_manifest
44
44
  @vc8_source_manifest
45
45
  else
46
- Mxx_ru::Cpp::Toolsets::Vc8::default_manifest
46
+ MxxRu::Cpp::Toolsets::Vc8::default_manifest
47
47
  end
48
48
  end
49
49
 
@@ -63,10 +63,10 @@ module Mxx_ru
63
63
  # Setups following tags:
64
64
  # [_ver_hi_] high version number. Value: 8.
65
65
  # [_ver_lo_] low version number. Value: 0.
66
- class Vc8 < Mxx_ru::Cpp::Toolsets::Vc_family
66
+ class Vc8 < MxxRu::Cpp::Toolsets::VcFamily
67
67
 
68
68
  # Actual manifest description.
69
- class Actual_manifest
69
+ class ActualManifest
70
70
  attr_reader :manifest_file
71
71
  attr_reader :digital_resource_id
72
72
 
@@ -95,7 +95,10 @@ module Mxx_ru
95
95
  def keep_manifest_file?
96
96
  ( mt? and autogen? ) ? @source_manifest.keep_manifest_file : true
97
97
  end
98
- end # class Actual_manifest
98
+ end # class ActualManifest
99
+
100
+ # For compatibility with previous versions.
101
+ Actual_manifest = ActualManifest
99
102
 
100
103
  @@default_manifest = OpenStruct.new(
101
104
  :autogen => true,
@@ -126,7 +129,7 @@ module Mxx_ru
126
129
  # VC8.0 does not support Single-Thread Run-Time.
127
130
  def setup_mandatory_options( target )
128
131
  if THREADING_SINGLE == target.mxx_threading_mode
129
- raise Mxx_ru::Unsupported_mode_ex.new(
132
+ raise MxxRu::UnsupportedModeEx.new(
130
133
  "Visual C++ 2005 not supports " +
131
134
  "single-threaded static RTL" )
132
135
  elsif THREADING_DEFAULT == target.mxx_threading_mode
@@ -185,65 +188,65 @@ module Mxx_ru
185
188
  # Examples:
186
189
  # # Autogenerate manifest for target. Do not embed into executable.
187
190
  # # Manifest stored in <target>.manifest file.
188
- # Mxx_ru::Cpp::Toolsets::Vc8::manifest(
191
+ # MxxRu::Cpp::Toolsets::Vc8::manifest(
189
192
  # :target => self,
190
193
  # :autogen => :to_default_file )
191
194
  #
192
195
  # # Autogenerate manifest for target. Embed into executable.
193
196
  # # Autogenerated manifest will be deleted after embeding.
194
- # Mxx_ru::Cpp::Toolsets::Vc8::manifest(
197
+ # MxxRu::Cpp::Toolsets::Vc8::manifest(
195
198
  # :target => self,
196
199
  # :autogen => :to_default_file,
197
200
  # :mt => {} )
198
201
  #
199
202
  # # Autogenerate manifest for target. Embed into executable.
200
203
  # # Autogenerated manifest will be kept after embeding.
201
- # Mxx_ru::Cpp::Toolsets::Vc8::manifest(
204
+ # MxxRu::Cpp::Toolsets::Vc8::manifest(
202
205
  # :target => self,
203
206
  # :autogen => :to_default_file,
204
207
  # :mt => { :keep_manifest_file => true } )
205
208
  #
206
209
  # # Autogenerate manifest for target. Embed into executable as
207
210
  # # resource with id CREATEPROCESS_MANIFEST_RESOURCE_ID id.
208
- # Mxx_ru::Cpp::Toolsets::Vc8::manifest(
211
+ # MxxRu::Cpp::Toolsets::Vc8::manifest(
209
212
  # :target => self,
210
213
  # :autogen => :to_default_file,
211
214
  # :mt => { :resource_id => :process_manifest } )
212
215
  #
213
216
  # # Autogenerate manifest for target. Store manifest into
214
217
  # # file 'hello_world.exe.manifest'. Embed info executable.
215
- # Mxx_ru::Cpp::Toolsets::Vc8::manifest(
218
+ # MxxRu::Cpp::Toolsets::Vc8::manifest(
216
219
  # :target => self,
217
220
  # :autogen => 'hello_world.exe.manifest',
218
221
  # :mt => {} )
219
222
  #
220
223
  # # Embed manifest from file 'hello_world.exe.manifest' into
221
224
  # # target executable.
222
- # Mxx_ru::Cpp::Toolsets::Vc8::manifest(
225
+ # MxxRu::Cpp::Toolsets::Vc8::manifest(
223
226
  # :target => self,
224
227
  # :mt => { :manifest => 'hello_world.exe.manifest' } )
225
228
  # # Embed manifest from file 'hello_world.dll.manifest' into
226
229
  # # target executable as resource with
227
230
  # # ISOLATIONAWARE_NOSTATICIMPORT_MANIFEST_RESOURCE_ID id.
228
- # Mxx_ru::Cpp::Toolsets::Vc8::manifest(
231
+ # MxxRu::Cpp::Toolsets::Vc8::manifest(
229
232
  # :target => self,
230
233
  # :mt => { :manifest => 'hello_world.exe.manifest',
231
234
  # :resource_id => :isolationaware_nonstaticimport } )
232
235
  #
233
236
  # # Autogenerate manifest for all targets in build. Store manifest
234
237
  # # in default files. Do not embed manifest into executable.
235
- # Mxx_ru::Cpp::Toolsets::Vc8::manifest(
238
+ # MxxRu::Cpp::Toolsets::Vc8::manifest(
236
239
  # :autogen => :to_default_file )
237
240
  #
238
241
  # # Autogenerate manifest for all targets in build. Store manifest
239
242
  # # in default files. Embed manifest into executable.
240
- # Mxx_ru::Cpp::Toolsets::Vc8::manifest(
243
+ # MxxRu::Cpp::Toolsets::Vc8::manifest(
241
244
  # :autogen => :to_default_file,
242
245
  # :mt => {} )
243
246
  #
244
247
  # # Drop default manifest for build. Only explicitly specified
245
248
  # # manifest will be generated.
246
- # Mxx_ru::Cpp::Toolsets::Vc8::manifest( nil )
249
+ # MxxRu::Cpp::Toolsets::Vc8::manifest( nil )
247
250
  #
248
251
  def self.manifest( params )
249
252
  if nil == params
@@ -299,8 +302,8 @@ module Mxx_ru
299
302
  # (or default manifest exists).
300
303
  def setup_manifest( target )
301
304
  # 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
305
+ if ExeTargetType::TYPE == target.target_type.name or
306
+ DllTargetType::TYPE == target.target_type.name
304
307
  desc = target.vc8_source_manifest
305
308
 
306
309
  if nil != desc
@@ -308,7 +311,7 @@ module Mxx_ru
308
311
  manifest_file =
309
312
  if :default == desc.manifest_file
310
313
  # We must create name for manifest.
311
- if Exe_target_type::TYPE == target.target_type.name
314
+ if ExeTargetType::TYPE == target.target_type.name
312
315
  make_exe_name(
313
316
  target.mxx_target_name,
314
317
  target ).full_name
@@ -330,7 +333,7 @@ module Mxx_ru
330
333
  when :default:
331
334
  # Resource ID must be caclulated based on
332
335
  # target type.
333
- Exe_target_type::TYPE == target.target_type.name ? 1 : 2
336
+ ExeTargetType::TYPE == target.target_type.name ? 1 : 2
334
337
  when :process_manifest: 1
335
338
  when :isolationaware_manifest: 2
336
339
  else
@@ -341,7 +344,7 @@ module Mxx_ru
341
344
  nil
342
345
  end
343
346
 
344
- target.vc8_actual_manifest = Actual_manifest.new(
347
+ target.vc8_actual_manifest = ActualManifest.new(
345
348
  desc,
346
349
  manifest_file,
347
350
  digital_resource_id )
@@ -365,7 +368,7 @@ module Mxx_ru
365
368
  # Remove autogenerated manifest file if any.
366
369
  def clean_autogenerated_manifest( target )
367
370
  m = target.vc8_actual_manifest
368
- Mxx_ru::Util::delete_file( m.manifest_file ) if
371
+ MxxRu::Util::delete_file( m.manifest_file ) if
369
372
  m != nil and m.autogen?
370
373
  end
371
374
 
@@ -385,7 +388,7 @@ module Mxx_ru
385
388
 
386
389
  if !m.keep_manifest_file?
387
390
  # del utility doesn't work with unix slashes
388
- cmd_lines << "del \"#{Mxx_ru::Util::native_pathname(m.manifest_file)}\""
391
+ cmd_lines << "del \"#{MxxRu::Util::native_pathname(m.manifest_file)}\""
389
392
  end
390
393
  end
391
394
 
@@ -406,7 +409,7 @@ module Mxx_ru
406
409
  # :resource_id must have one of avaliable values.
407
410
  if mt_hash.key?( :resource_id ) and
408
411
  !@@resource_id_names.member?( mt_hash[ :resource_id ] )
409
- raise Invalid_value_ex.new(
412
+ raise InvalidValueEx.new(
410
413
  "invalid value for :resource_id key: " +
411
414
  "'#{mt_hash[:resource_id]}'" )
412
415
  end
@@ -414,7 +417,7 @@ module Mxx_ru
414
417
  if !mt_hash.key?( :manifest ) and
415
418
  !params.key?( :autogen )
416
419
 
417
- raise Invalid_value_ex.new(
420
+ raise InvalidValueEx.new(
418
421
  "no manifest file name specified" )
419
422
  end
420
423
 
@@ -422,7 +425,7 @@ module Mxx_ru
422
425
  if mt_hash.key?( :keep_manifest_file ) and
423
426
  true != mt_hash[ :keep_manifest_file ] and
424
427
  false != mt_hash[ :keep_manifest_file ]
425
- raise Invalid_value_ex.new(
428
+ raise InvalidValueEx.new(
426
429
  "value for :keep_manifest_file should be 'true' " +
427
430
  "or 'false'" )
428
431
  end
@@ -432,7 +435,7 @@ module Mxx_ru
432
435
  v = params[ :autogen ]
433
436
  if !( v == :to_default_file or
434
437
  v.kind_of?( String ) )
435
- raise Invalid_value_ex.new(
438
+ raise InvalidValueEx.new(
436
439
  "invalid value for :autogen (must be " +
437
440
  ":to_default_file or String instance)" )
438
441
  end
@@ -446,7 +449,7 @@ module Mxx_ru
446
449
 
447
450
  end # module Cpp
448
451
 
449
- end # module Mxx_ru
452
+ end # module MxxRu
450
453
 
451
- Mxx_ru::Cpp::setup_toolset( Mxx_ru::Cpp::Toolsets::Vc8.new )
454
+ MxxRu::Cpp::setup_toolset( MxxRu::Cpp::Toolsets::Vc8.new )
452
455
 
@@ -28,12 +28,12 @@
28
28
 
29
29
  require 'mxx_ru/cpp/toolset'
30
30
 
31
- module Mxx_ru
31
+ module MxxRu
32
32
  module Cpp
33
33
  module Toolsets
34
34
 
35
35
  # Toolset implemetation for Visual C++
36
- class Vc_family < Mxx_ru::Cpp::Toolset
36
+ class VcFamily < MxxRu::Cpp::Toolset
37
37
  public
38
38
  def initialize( a_name )
39
39
  super( a_name )
@@ -62,7 +62,7 @@ module Mxx_ru
62
62
  return "rc"
63
63
  end
64
64
 
65
- # See description at Mxx_ru::Cpp::Toolset#setup_mandatory_options.
65
+ # See description at MxxRu::Cpp::Toolset#setup_mandatory_options.
66
66
  def setup_mandatory_options( target )
67
67
 
68
68
  target.compiler_option( "-nologo" )
@@ -89,7 +89,7 @@ module Mxx_ru
89
89
 
90
90
  if RTL_SHARED == target.mxx_rtl_mode
91
91
  if THREADING_SINGLE == target.mxx_threading_mode
92
- raise Mxx_ru::Unsupported_mode_ex.new(
92
+ raise MxxRu::UnsupportedModeEx.new(
93
93
  "Visual C++ not support single-threaded shared RTL" )
94
94
  else
95
95
  if RUNTIME_DEBUG == target.mxx_runtime_mode
@@ -114,7 +114,7 @@ module Mxx_ru
114
114
  end
115
115
  end
116
116
 
117
- if target.target_type.name == Dll_target_type::TYPE
117
+ if target.target_type.name == DllTargetType::TYPE
118
118
  target.compiler_option( "-LD" )
119
119
  end
120
120
 
@@ -146,7 +146,7 @@ module Mxx_ru
146
146
 
147
147
  end
148
148
 
149
- # Common description see Mxx_ru::Cpp::Toolset#clean_lib_specific_files.
149
+ # Common description see MxxRu::Cpp::Toolset#clean_lib_specific_files.
150
150
  #
151
151
  # Removes VC specific garbage files.
152
152
  def clean_lib_specific_files(
@@ -157,7 +157,7 @@ module Mxx_ru
157
157
  clean_vc_specific_garbage( a_lib_file )
158
158
  end
159
159
 
160
- # See description at Mxx_ru::Cpp::Toolset#clean_dll_specific_files.
160
+ # See description at MxxRu::Cpp::Toolset#clean_dll_specific_files.
161
161
  #
162
162
  # Removes import library if exists.
163
163
  #
@@ -169,19 +169,20 @@ module Mxx_ru
169
169
 
170
170
  # Remove import library if exists.
171
171
  if nil != a_dll_info.link_name
172
- implib_name = File.join( [ a_dll_info.link_path, a_dll_info.link_name ] )
173
- Mxx_ru::Util::delete_file( implib_name )
172
+ implib_name = File.join(
173
+ [ a_dll_info.link_path, a_dll_info.link_name ] )
174
+ MxxRu::Util::delete_file( implib_name )
174
175
 
175
176
  # *.exp files are also created by Visual C++.
176
177
  explib_name =
177
- Mxx_ru::Util::change_file_ext( implib_name, ".exp" )
178
- Mxx_ru::Util::delete_file( explib_name )
178
+ MxxRu::Util::change_file_ext( implib_name, ".exp" )
179
+ MxxRu::Util::delete_file( explib_name )
179
180
  end
180
181
 
181
182
  clean_vc_specific_garbage( a_dll_file )
182
183
  end
183
184
 
184
- # See description at Mxx_ru::Cpp::Toolset#clean_exe_specific_files.
185
+ # See description at MxxRu::Cpp::Toolset#clean_exe_specific_files.
185
186
  #
186
187
  # Removing *.ilk, *.pdb files.
187
188
  def clean_exe_specific_files(
@@ -192,45 +193,45 @@ module Mxx_ru
192
193
  clean_vc_specific_garbage( a_exe_file )
193
194
  end
194
195
 
195
- # See description at Mxx_ru::Cpp::Toolset#obj_file_ext.
196
+ # See description at MxxRu::Cpp::Toolset#obj_file_ext.
196
197
  def obj_file_ext
197
198
  return ".obj"
198
199
  end
199
200
 
200
- # See description at Mxx_ru::Cpp::Toolset#make_c_obj_command_lines.
201
+ # See description at MxxRu::Cpp::Toolset#make_c_obj_command_lines.
201
202
  def make_c_obj_command_lines(
202
203
  obj_name,
203
204
  source_name,
204
205
  compiler_options,
205
206
  target )
206
207
 
207
- tmpfile = Mxx_ru::Util::Tmp_files.instance.create(
208
+ tmpfile = MxxRu::Util::TmpFiles.instance.create(
208
209
  "-c -TC -Fo#{obj_name} " +
209
210
  "#{compiler_options.join(' ')} #{source_name}" )
210
211
 
211
212
  return [ "#{compiler_name} @#{tmpfile}" ]
212
213
  end
213
214
 
214
- # See description at Mxx_ru::Cpp::Toolset#make_c_obj_command_lines.
215
+ # See description at MxxRu::Cpp::Toolset#make_c_obj_command_lines.
215
216
  def make_cpp_obj_command_lines(
216
217
  obj_name,
217
218
  source_name,
218
219
  compiler_options,
219
220
  target )
220
221
 
221
- tmpfile = Mxx_ru::Util::Tmp_files.instance.create(
222
+ tmpfile = MxxRu::Util::TmpFiles.instance.create(
222
223
  "-c -TP -Fo#{obj_name} " +
223
224
  "#{compiler_options.join(' ')} #{source_name}" )
224
225
 
225
226
  return [ "#{compiler_name} @#{tmpfile}" ]
226
227
  end
227
228
 
228
- # See description at Mxx_ru::Cpp::Toolset#mswin_res_file_name.
229
+ # See description at MxxRu::Cpp::Toolset#mswin_res_file_name.
229
230
  def mswin_res_file_name( source_name )
230
231
  return source_name + ".res"
231
232
  end
232
233
 
233
- # See description at Mxx_ru::Cpp::Toolset#make_mswin_res_command_lines.
234
+ # See description at MxxRu::Cpp::Toolset#make_mswin_res_command_lines.
234
235
  def make_mswin_res_command_lines(
235
236
  res_name,
236
237
  rc_file,
@@ -242,36 +243,36 @@ module Mxx_ru
242
243
  "/fo#{res_name} #{rc_file}" ]
243
244
  end
244
245
 
245
- # See description at Mxx_ru::Cpp::Toolset#lib_file_name.
246
+ # See description at MxxRu::Cpp::Toolset#lib_file_name.
246
247
  def lib_file_name( source_name )
247
248
  return source_name + ".lib"
248
249
  end
249
250
 
250
- # See description at Mxx_ru::Cpp::Toolset#lib_link_name.
251
+ # See description at MxxRu::Cpp::Toolset#lib_link_name.
251
252
  def lib_link_name( source_name )
252
253
  return lib_file_name( source_name )
253
254
  end
254
255
 
255
- # See description at Mxx_ru::Cpp::Toolset#make_lib_command_lines.
256
+ # See description at MxxRu::Cpp::Toolset#make_lib_command_lines.
256
257
  def make_lib_command_lines(
257
258
  lib_name,
258
259
  obj_files,
259
260
  librarian_options,
260
261
  target )
261
262
 
262
- tmpfile = Mxx_ru::Util::Tmp_files.instance.create(
263
+ tmpfile = MxxRu::Util::TmpFiles.instance.create(
263
264
  "#{librarian_options.join(' ')} " +
264
265
  "/OUT:#{lib_name} #{obj_files.join(' ')}" )
265
266
 
266
267
  return [ "#{librarian_name} @#{tmpfile}" ]
267
268
  end
268
269
 
269
- # See description at Mxx_ru::Cpp::Toolset#dll_file_name.
270
+ # See description at MxxRu::Cpp::Toolset#dll_file_name.
270
271
  def dll_file_name( source_name )
271
272
  return source_name + ".dll"
272
273
  end
273
274
 
274
- # See description at Mxx_ru::Cpp::Toolset#implib_link_name.
275
+ # See description at MxxRu::Cpp::Toolset#implib_link_name.
275
276
  def implib_link_name(
276
277
  dll_real_name,
277
278
  target )
@@ -284,10 +285,10 @@ module Mxx_ru
284
285
  return nil
285
286
  end
286
287
 
287
- # See description at Mxx_ru::Cpp::Toolset#implib_link_path.
288
+ # See description at MxxRu::Cpp::Toolset#implib_link_path.
288
289
  #
289
290
  # Returns a value, based on
290
- # Mxx_ru::Cpp::Target#mxx_implib_path.
291
+ # MxxRu::Cpp::Target#mxx_implib_path.
291
292
  def implib_link_path(
292
293
  dll_real_name,
293
294
  dll_real_path,
@@ -296,7 +297,7 @@ module Mxx_ru
296
297
  target.mxx_implib_path, self, target )
297
298
  end
298
299
 
299
- # See description at Mxx_ru::Cpp::Toolset#make_dll_command_lines.
300
+ # See description at MxxRu::Cpp::Toolset#make_dll_command_lines.
300
301
  def make_dll_command_lines(
301
302
  a_dll_name,
302
303
  a_dll_info,
@@ -320,22 +321,22 @@ module Mxx_ru
320
321
  a_linker_lists.lib_paths.each { |p| result << "/LIBPATH:#{p} " }
321
322
 
322
323
  result << "#{a_linker_lists.objs.join(' ')} "
323
- result << "#{a_linker_lists.libs.join(' ')} "
324
+ result << "#{make_libraries_list_for_linker(a_linker_lists.libs)} "
324
325
  result << "#{a_linker_lists.resources.join(' ')} "
325
326
 
326
- tmpfile = Mxx_ru::Util::Tmp_files.instance.create( result )
327
+ tmpfile = MxxRu::Util::TmpFiles.instance.create( result )
327
328
 
328
329
  return [ "#{linker_name} @#{tmpfile}" ]
329
330
  end
330
331
 
331
- # See description at Mxx_ru::Cpp::Toolset#make_dll_requirements.
332
+ # See description at MxxRu::Cpp::Toolset#make_dll_requirements.
332
333
  def make_dll_requirements(
333
334
  a_dll_name,
334
335
  a_dll_info,
335
336
  a_linker_lists,
336
337
  a_target )
337
338
 
338
- result = Dll_requirements.new
339
+ result = DllRequirements.new
339
340
 
340
341
  # Dependencies are exists only if import library is present.
341
342
  if nil != a_dll_info.link_name
@@ -346,12 +347,12 @@ module Mxx_ru
346
347
  return result
347
348
  end
348
349
 
349
- # See description at Mxx_ru::Cpp::Toolset#exe_file_name.
350
+ # See description at MxxRu::Cpp::Toolset#exe_file_name.
350
351
  def exe_file_name( source_name )
351
352
  return source_name + ".exe"
352
353
  end
353
354
 
354
- # See description at Mxx_ru::Cpp::Toolset#make_exe_command_lines.
355
+ # See description at MxxRu::Cpp::Toolset#make_exe_command_lines.
355
356
  def make_exe_command_lines(
356
357
  a_exe_name,
357
358
  a_exe_info,
@@ -368,10 +369,10 @@ module Mxx_ru
368
369
  a_linker_lists.lib_paths.each { |p| result << "/LIBPATH:#{p} " }
369
370
 
370
371
  result << "#{a_linker_lists.objs.join(' ')} "
371
- result << "#{a_linker_lists.libs.join(' ')} "
372
+ result << "#{make_libraries_list_for_linker(a_linker_lists.libs)} "
372
373
  result << "#{a_linker_lists.resources.join(' ')} "
373
374
 
374
- tmpfile = Mxx_ru::Util::Tmp_files.instance.create( result )
375
+ tmpfile = MxxRu::Util::TmpFiles.instance.create( result )
375
376
 
376
377
  return [ "#{linker_name} @#{tmpfile}" ]
377
378
  end
@@ -384,16 +385,16 @@ module Mxx_ru
384
385
  def setup_vc_specific_debug_options( target )
385
386
  full_name =
386
387
  case target.target_type.name
387
- when Exe_target_type::TYPE:
388
+ when ExeTargetType::TYPE:
388
389
  make_exe_name( target.mxx_target_name, target ).full_name
389
- when Dll_target_type::TYPE:
390
+ when DllTargetType::TYPE:
390
391
  make_dll_name( target.mxx_target_name, target ).full_name
391
- when Lib_target_type::TYPE:
392
+ when LibTargetType::TYPE:
392
393
  make_lib_name( target.mxx_target_name, target ).full_name
393
394
  else nil
394
395
  end
395
396
  if full_name
396
- pdb_file = Mxx_ru::Util::change_file_ext( full_name, ".pdb" )
397
+ pdb_file = MxxRu::Util::change_file_ext( full_name, ".pdb" )
397
398
  target.compiler_option( "/Fd#{pdb_file}" )
398
399
  target.linker_option( "/PDB:#{pdb_file}" )
399
400
  end
@@ -405,24 +406,43 @@ module Mxx_ru
405
406
  # If something exported from executable: *.exp, *.lib (only if
406
407
  # *.exp file exists).
407
408
  def clean_vc_specific_garbage( full_name )
408
- Mxx_ru::Util::delete_file(
409
- Mxx_ru::Util::change_file_ext( full_name, ".ilk" ) )
410
- Mxx_ru::Util::delete_file(
411
- Mxx_ru::Util::change_file_ext( full_name, ".pdb" ) )
409
+ MxxRu::Util::delete_file(
410
+ MxxRu::Util::change_file_ext( full_name, ".ilk" ) )
411
+ MxxRu::Util::delete_file(
412
+ MxxRu::Util::change_file_ext( full_name, ".pdb" ) )
412
413
 
413
- exp_file_name = Mxx_ru::Util::change_file_ext( full_name, ".exp" )
414
+ exp_file_name = MxxRu::Util::change_file_ext( full_name, ".exp" )
414
415
  if File.exists?( exp_file_name )
415
- Mxx_ru::Util::delete_file( exp_file_name )
416
+ MxxRu::Util::delete_file( exp_file_name )
416
417
  # Import library for this export-file must be removed too.
417
- Mxx_ru::Util::delete_file(
418
- Mxx_ru::Util::change_file_ext( full_name, ".lib" ) )
418
+ MxxRu::Util::delete_file(
419
+ MxxRu::Util::change_file_ext( full_name, ".lib" ) )
419
420
  end
420
421
  end
421
422
 
422
- end # class Vc_family
423
+ protected
424
+ # Checks and correct name of library. For Visual C++ library
425
+ # name must always contain extension '.lib'. If this extension
426
+ # is ommitted in project files than extension must be added.
427
+ def check_library_name( name )
428
+ return name if /.lib$/i =~ name
429
+ return name + '.lib'
430
+ end
431
+
432
+ # Checks, correct and concatenate names of libraries for linker.
433
+ def make_libraries_list_for_linker( libraries )
434
+ libraries.inject( '' ) { |r, l|
435
+ r << check_library_name( l.name ) << ' '
436
+ }
437
+ end
438
+
439
+ end # class VcFamily
423
440
 
441
+ # For compatibility with previous versions.
442
+ Vc_family = VcFamily
424
443
  end # module Toolsets
425
444
 
426
445
  end # module Cpp
427
446
 
428
- end # module Mxx_ru
447
+ end # module MxxRu
448
+
data/lib/mxx_ru/cpp.rb CHANGED
@@ -32,5 +32,7 @@ require 'mxx_ru/cpp/detect_toolset'
32
32
  require 'mxx_ru/cpp/target'
33
33
  require 'mxx_ru/cpp/composite'
34
34
 
35
+ require 'mxx_ru/cpp/obj_placements/custom_subdir'
36
+
35
37
  # Determining which toolset should be used.
36
- Mxx_ru::Cpp::detect_toolset
38
+ MxxRu::Cpp::detect_toolset