Class: MxxRu::Cpp::Toolsets::GccMingw

Inherits:
GccMswinFamily show all
Defined in:
lib/mxx_ru/cpp/toolsets/gcc_mingw.rb

Overview

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

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

Instance Method Summary collapse

Methods inherited from GccMswinFamily

#clean_dll_specific_files, #exe_file_name, #implib_link_name, #implib_link_path, #make_dll_requirements, #port_specific_lib_name_checker

Methods inherited from GccFamily

#c_compiler_name, #cpp_compiler_name, #dll_file_name, #enclose_linker_include_lib_options_into_brackes, #exe_file_name, #implib_link_name, #implib_link_path, #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_dll_requirements, #make_exe_command_lines, #make_lib_command_lines, #make_linker_include_lib_options, #obj_file_ext, #port_specific_lib_name_checker

Constructor Details

#initialize(a_name = "gcc") ⇒ GccMingw

Returns a new instance of GccMingw.



40
41
42
43
44
45
46
# File 'lib/mxx_ru/cpp/toolsets/gcc_mingw.rb', line 40

def initialize( a_name = "gcc" )
  super( a_name )

  setup_tag( GCC_PORT_TAG, GCC_PORT_MINGW )
  setup_tag( "host_os", "mswin" )
  setup_tag( "target_os", "mswin" )
end

Instance Method Details

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

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



96
97
98
99
100
101
102
103
104
105
# File 'lib/mxx_ru/cpp/toolsets/gcc_mingw.rb', line 96

def make_mswin_res_command_lines(
  res_name,
  rc_file,
  rc_options,
  target )

  return [ "#{rc_name} " +
    "#{rc_options.join(' ')} " +
    "-o #{res_name} #{rc_file}" ]
end

#mswin_res_file_name(source_name) ⇒ Object

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



91
92
93
# File 'lib/mxx_ru/cpp/toolsets/gcc_mingw.rb', line 91

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

See description at MxxRu::Cpp::Toolsets::GccFamily#port_specific_dll_link_options.

If mswin-res file exists than it added to linker options.



111
112
113
114
115
116
117
118
119
120
# File 'lib/mxx_ru/cpp/toolsets/gcc_mingw.rb', line 111

def port_specific_dll_link_options(
  a_dll_name, a_dll_info, a_linker_lists, a_target )

  r = super( a_dll_name, a_dll_info, a_linker_lists, a_target )
  if a_linker_lists.resources.size
    r = a_linker_lists.resources.join( " " ) + " " + r
  end

  return r
end

See description at MxxRu::Cpp::Toolsets::GccFamily#port_specific_exe_link_options.

If mswin-res file exists than it added to linker options.



126
127
128
129
130
131
132
133
134
135
# File 'lib/mxx_ru/cpp/toolsets/gcc_mingw.rb', line 126

def port_specific_exe_link_options(
  a_exe_name, a_exe_info, a_linker_lists, a_target )

  r = super( a_exe_name, a_exe_info, a_linker_lists, a_target )
  if a_linker_lists.resources.size
    r = a_linker_lists.resources.join( " " ) + " " + r
  end

  return r
end

#rc_nameObject

Returns resource compiler name.



49
50
51
# File 'lib/mxx_ru/cpp/toolsets/gcc_mingw.rb', line 49

def rc_name
  tag( RC_NAME_TAG, "windres" )
end

#setup_mandatory_options(target) ⇒ Object

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

Setups resource compiler parameters.

Required options are set up based on screen_mode.



58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/mxx_ru/cpp/toolsets/gcc_mingw.rb', line 58

def setup_mandatory_options( target )
  super( target )

  if SCREEN_WINDOW == target.mxx_screen_mode
    target.linker_option( "-mwindows" )
  else
    target.linker_option( "-mconsole" )
  end

  if THREADING_MULTI == target.mxx_threading_mode
    target.compiler_option( "-mthreads" )
  end

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

  target.mxx_all_include_paths.each { |p|
    target.mswin_rc_option( "--include-dir=" + p )
  }

  # Personal resource compiler 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( "--include-dir=" + p )
  }

end