Class: MxxRu::Cpp::Toolsets::GccMswinFamily

Inherits:
GccFamily show all
Defined in:
lib/mxx_ru/cpp/toolsets/gcc_family.rb

Overview

Toolset implemetation for GCC compiler for Win32. This class is a base class for both MinGW and Cygwin

Direct Known Subclasses

GccCygwin, GccMingw

Constant Summary

Constants inherited from GccFamily

MxxRu::Cpp::Toolsets::GccFamily::GCC_PORT_CYGWIN, MxxRu::Cpp::Toolsets::GccFamily::GCC_PORT_MINGW, MxxRu::Cpp::Toolsets::GccFamily::GCC_PORT_TAG, MxxRu::Cpp::Toolsets::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 GccFamily

#c_compiler_name, #cpp_compiler_name, #dll_file_name, #enclose_linker_include_lib_options_into_brackes, #initialize, #lib_file_name, #lib_link_name, #librarian_name, #linker_name, #make_c_obj_command_lines, #make_cpp_obj_command_lines, #make_dll_command_lines, #make_exe_command_lines, #make_lib_command_lines, #make_linker_include_lib_options, #obj_file_ext, #port_specific_exe_link_options, #setup_mandatory_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, #dll_file_name, #force_cpp03, #force_cpp0x_std, #force_cpp11, #force_cpp14, #full_dll_name, #full_exe_name, #full_lib_name, has_linkable_dependecies?, #initialize, #lib_file_name, #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_lib, #make_lib_command_lines, #make_mswin_res, #make_mswin_res_command_lines, #make_objs, #name, #obj_file_ext, #setup_mandatory_options, #setup_tag, #tag

Constructor Details

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

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.



337
338
339
340
341
342
343
344
345
346
347
348
# File 'lib/mxx_ru/cpp/toolsets/gcc_family.rb', line 337

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

#exe_file_name(source_name, target) ⇒ Object

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



330
331
332
# File 'lib/mxx_ru/cpp/toolsets/gcc_family.rb', line 330

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.



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

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.



364
365
366
367
368
369
370
# File 'lib/mxx_ru/cpp/toolsets/gcc_family.rb', line 364

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

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

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



373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
# File 'lib/mxx_ru/cpp/toolsets/gcc_family.rb', line 373

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

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.



395
396
397
398
399
400
401
402
403
404
405
406
407
# File 'lib/mxx_ru/cpp/toolsets/gcc_family.rb', line 395

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,--out-implib=#{full_lib_name}" +
      ",--export-all-symbols"
  end

  return ""
end

#port_specific_lib_name_checker(library_name) ⇒ Object

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



411
412
413
414
415
416
417
# File 'lib/mxx_ru/cpp/toolsets/gcc_family.rb', line 411

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