Class: MxxRu::Cpp::Toolsets::ClangMswinFamily

Inherits:
ClangFamily show all
Defined in:
lib/mxx_ru/cpp/toolsets/clang_family.rb

Overview

Toolset implemetation for Clang compiler for Win32.

Direct Known Subclasses

ClangMsVC

Constant Summary

Constants inherited from GccFamily

GccFamily::GCC_PORT_CYGWIN, GccFamily::GCC_PORT_MINGW, GccFamily::GCC_PORT_TAG, GccFamily::GCC_PORT_UNIX

Constants inherited from MxxRu::Cpp::Toolset

MxxRu::Cpp::Toolset::COMPILER_NAME_TAG, MxxRu::Cpp::Toolset::CPP_COMPILER_NAME_TAG, MxxRu::Cpp::Toolset::C_COMPILER_NAME_TAG, MxxRu::Cpp::Toolset::IMPORT_LIBRARIAN_NAME_TAG, MxxRu::Cpp::Toolset::LIBRARIAN_NAME_TAG, MxxRu::Cpp::Toolset::LINKER_NAME_TAG, MxxRu::Cpp::Toolset::RC_NAME_TAG, MxxRu::Cpp::Toolset::Unknown_tag_ex

Instance Attribute Summary

Attributes inherited from MxxRu::Cpp::Toolset

#cpp_std

Instance Method Summary collapse

Methods inherited from ClangFamily

#c_compiler_name, #cpp_compiler_name, #default_lib_linking_mode, #initialize, #linker_name, #make_linker_include_lib_options, #switch_to_default_lib_mode_if_needed

Methods inherited from GccFamily

#c_compiler_name, #cpp_compiler_name, #initialize, #lib_link_name, #linker_name, #make_c_obj_command_lines, #make_cpp_obj_command_lines, #make_dll_command_lines, #make_exe_command_lines, #make_linker_include_lib_options, #make_toolset_id_string, #obj_file_ext, #port_specific_exe_link_options

Methods inherited from MxxRu::Cpp::Toolset

#clean_dll, #clean_exe, #clean_exe_specific_files, #clean_lib, #clean_lib_specific_files, #clean_mswin_res, #clean_mswin_res_specific_files, #clean_objs, #force_cpp03, #force_cpp0x_std, #force_cpp11, #force_cpp14, #force_cpp17, #full_dll_name, #full_exe_name, #full_lib_name, has_linkable_dependecies?, #initialize, #lib_link_name, #make_c_obj_command_lines, #make_cpp_obj_command_lines, #make_dll, #make_dll_command_lines, #make_exe, #make_exe_command_lines, #make_identification_string, #make_lib, #make_mswin_res, #make_objs, #name, #obj_file_ext, #setup_tag, #tag

Constructor Details

This class inherits a constructor from MxxRu::Cpp::Toolsets::ClangFamily

Instance Method Details

#clean_dll_specific_files(a_dll_file, a_dll_info, a_target) ⇒ Object

See description at MxxRu::Cpp::Toolset#clean_dll_specific_files.

Delete import library if exists.



257
258
259
260
261
262
263
264
265
266
267
268
# File 'lib/mxx_ru/cpp/toolsets/clang_family.rb', line 257

def clean_dll_specific_files(
  a_dll_file,
  a_dll_info,
  a_target )

  # Delete import library if exists.
  if nil != a_dll_info.link_name
    implib_name = File.join( [ a_dll_info.link_path,
      lib_file_name( a_dll_info.link_name, a_target ) ] )
    MxxRu::Util::delete_file( implib_name )
  end
end

#dll_file_name(source_name, target) ⇒ Object

See description at MxxRu::Cpp::Toolset#dll_file_name.



237
238
239
# File 'lib/mxx_ru/cpp/toolsets/clang_family.rb', line 237

def dll_file_name( source_name, target )
  return construct_target_name( source_name, NO_PREFIX, '.dll', target )
end

#enclose_linker_include_lib_options_into_brackes(options) ⇒ Object



343
344
345
# File 'lib/mxx_ru/cpp/toolsets/clang_family.rb', line 343

def enclose_linker_include_lib_options_into_brackes( options )
  " #{options} "
end

#exe_file_name(source_name, target) ⇒ Object

See description at MxxRu::Cpp::Toolset#exe_file_name.



227
228
229
# File 'lib/mxx_ru/cpp/toolsets/clang_family.rb', line 227

def exe_file_name( source_name, target )
  return construct_target_name( source_name, NO_PREFIX, ".exe", target )
end

See description at MxxRu::Cpp::Toolset#implib_link_name.



271
272
273
274
275
276
277
278
279
280
281
# File 'lib/mxx_ru/cpp/toolsets/clang_family.rb', line 271

def implib_link_name(
  dll_real_name,
  target )

  # It's required to pass import library name to linker on mswin platform
  if nil != target.mxx_implib_path
    return lib_link_name( target.mxx_target_name, target )
  end

  return nil
end

See description at MxxRu::Cpp::Toolset#implib_link_path.



284
285
286
287
288
289
290
# File 'lib/mxx_ru/cpp/toolsets/clang_family.rb', line 284

def implib_link_path(
  dll_real_name,
  dll_real_path,
  target )
  return target.mxx_obj_placement.get_lib(
    target.mxx_implib_path, self, target )
end

#lib_file_name(source_name, target) ⇒ Object

See description at MxxRu::Cpp::Toolset#lib_file_name.



232
233
234
# File 'lib/mxx_ru/cpp/toolsets/clang_family.rb', line 232

def lib_file_name( source_name, target )
  return construct_target_name( source_name, NO_PREFIX, '.lib', target )
end

#lib_linking_mode_switch(linking_mode) ⇒ Object

Return command line switch for forcing specified library type.



339
340
341
# File 'lib/mxx_ru/cpp/toolsets/clang_family.rb', line 339

def lib_linking_mode_switch( linking_mode )
  ""
end

#librarian_nameObject

Returns librarian name.



217
218
219
# File 'lib/mxx_ru/cpp/toolsets/clang_family.rb', line 217

def librarian_name
  tag( LIBRARIAN_NAME_TAG, "llvm-ar" )
end

#make_dll_requirements(a_dll_name, a_dll_info, a_linker_lists, a_target) ⇒ Object

See description at MxxRu::Cpp::Toolset#make_dll_requirements.



293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
# File 'lib/mxx_ru/cpp/toolsets/clang_family.rb', line 293

def make_dll_requirements(
  a_dll_name,
  a_dll_info,
  a_linker_lists,
  a_target )

  result = DllRequirements.new

  # Dependencies are exists only if import library is present.
  if nil != a_dll_info.link_name
    result.add_libs( [ a_dll_info.link_name ] )
    result.add_lib_paths( [ a_dll_info.link_path ] )
  end

  return result
end

#make_lib_command_lines(lib_name, obj_files, librarian_options, target) ⇒ Object

See description at MxxRu::Cpp::Toolset#make_lib_command_lines.



242
243
244
245
246
247
248
249
250
251
252
# File 'lib/mxx_ru/cpp/toolsets/clang_family.rb', line 242

def make_lib_command_lines(
  lib_name,
  obj_files,
  librarian_options,
  target )

  result = "r #{librarian_options.join(' ')} " +
    "#{lib_name} #{obj_files.join(' ')}"

  return [ "#{librarian_name} #{result}" ]
end

#make_mswin_res_command_lines(res_name, rc_file, rc_options, target) ⇒ Object

See description at MxxRu::Cpp::Toolset#make_mswin_res_command_lines.



353
354
355
356
357
358
359
360
361
362
# File 'lib/mxx_ru/cpp/toolsets/clang_family.rb', line 353

def make_mswin_res_command_lines(
  res_name,
  rc_file,
  rc_options,
  target )

  return [ "#{rc_name} " +
    "#{rc_options.join(' ')} /r " +
    "/fo#{res_name} #{rc_file}" ]
end

#mswin_res_file_name(source_name) ⇒ Object

See description at MxxRu::Cpp::Toolset#mswin_res_file_name.



348
349
350
# File 'lib/mxx_ru/cpp/toolsets/clang_family.rb', line 348

def mswin_res_file_name( source_name )
  return source_name + ".res"
end

Return string containing port-specific linker option for DLL linking.

All parameters are similar to make_dll_command_lines parameters.

Return empty string in a base class.



315
316
317
318
319
320
321
322
323
324
325
326
# File 'lib/mxx_ru/cpp/toolsets/clang_family.rb', line 315

def port_specific_dll_link_options(
  a_dll_name, a_dll_info, a_linker_lists, a_target )
  # Build import library if it's required.
  if nil != a_dll_info.link_name
    full_lib_name = File.join( [ a_dll_info.link_path,
      lib_file_name( a_dll_info.link_name, a_target ) ] )

    return "-Wl,/IMPLIB:#{full_lib_name}"
  end

  return ""
end

#port_specific_lib_name_checker(library_name) ⇒ Object

Checks library name for suffix ‘.lib’ and return name without that suffix.



330
331
332
333
334
335
336
# File 'lib/mxx_ru/cpp/toolsets/clang_family.rb', line 330

def port_specific_lib_name_checker(library_name)
  if /\.lib$/i =~ library_name
    MxxRu::Util::remove_file_ext(library_name)            
  else
    library_name
  end
end

#rc_nameObject

Returns resource compiler name.



222
223
224
# File 'lib/mxx_ru/cpp/toolsets/clang_family.rb', line 222

def rc_name
  return tag( RC_NAME_TAG, "rc" )
end

#setup_mandatory_options(target) ⇒ Object

See description at MxxRu::Cpp::Toolset#setup_mandatory_options.



191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
# File 'lib/mxx_ru/cpp/toolsets/clang_family.rb', line 191

def setup_mandatory_options( target )

  super( target )

  # All defines and all include_path should be applied
  # to resource compiler too.
  target.mxx_all_defines.each { |d|
    target.compiler_option( "-D" + d )
    target.mswin_rc_option( "/d" + d )
  }

  target.mxx_all_include_paths.each { |p|
    target.compiler_option( "-I" + p )
    target.mswin_rc_option( "/i" + p )
  }

  # Resource compiler specific options.
  target.mxx_all_mswin_rc_defines.each { |d|
    target.mswin_rc_option( "/d" + d )
  }
  target.mxx_all_mswin_rc_include_paths.each { |p|
    target.mswin_rc_option( "/i" + p )
  }
end