Class: MxxRu::Cpp::Toolsets::GccUnixFamily
- Inherits:
-
GccFamily
- Object
- MxxRu::Cpp::Toolset
- GccFamily
- MxxRu::Cpp::Toolsets::GccUnixFamily
- Defined in:
- lib/mxx_ru/cpp/toolsets/gcc_unix_family.rb
Overview
Base class for Unix GCC ports.
Under Unix library name in ‘-l’ linker option can be either static or shared. Therefore on Unix MxxRu must do special action to handle Target#lib_static and Target#lib_shared descriptions. This action implemented in this class.
Direct Known Subclasses
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
Instance Method Summary collapse
-
#default_lib_linking_mode ⇒ Object
Return default library linking mode for current platform.
-
#initialize(name) ⇒ GccUnixFamily
constructor
A new instance of GccUnixFamily.
-
#lib_linking_mode_switch(linking_mode) ⇒ Object
Return command line switch for forcing specified library type.
-
#make_linker_include_lib_options(target, libs) ⇒ Object
Special implementation for support explicit library type linker option.
-
#setup_mandatory_options(target) ⇒ Object
This implementation adds -fPIC option for GccUnix compilers.
-
#switch_to_default_lib_mode_if_needed(current_lib_type) ⇒ Object
Return command line switch for closing group of libraries with same type.
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_toolset_id_string, #obj_file_ext, #port_specific_dll_link_options, #port_specific_exe_link_options, #port_specific_lib_name_checker
Methods inherited from MxxRu::Cpp::Toolset
#clean_dll, #clean_dll_specific_files, #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, #exe_file_name, #force_cpp03, #force_cpp0x_std, #force_cpp11, #force_cpp14, #force_cpp17, #full_dll_name, #full_exe_name, #full_lib_name, has_linkable_dependecies?, #implib_link_name, #implib_link_path, #lib_file_name, #lib_link_name, #make_c_obj_command_lines, #make_cpp_obj_command_lines, #make_dll, #make_dll_command_lines, #make_dll_requirements, #make_exe, #make_exe_command_lines, #make_identification_string, #make_lib, #make_lib_command_lines, #make_mswin_res, #make_mswin_res_command_lines, #make_objs, #name, #obj_file_ext, #setup_tag, #tag
Constructor Details
#initialize(name) ⇒ GccUnixFamily
Returns a new instance of GccUnixFamily.
42 43 44 |
# File 'lib/mxx_ru/cpp/toolsets/gcc_unix_family.rb', line 42 def initialize( name ) super( name ) end |
Instance Method Details
#default_lib_linking_mode ⇒ Object
Return default library linking mode for current platform.
Default mode BinaryLibrary::SHARED for Unix with GCC assumed. But default mode can be specified in toolset tag ‘lib_linking_mode’.
79 80 81 82 83 84 85 86 |
# File 'lib/mxx_ru/cpp/toolsets/gcc_unix_family.rb', line 79 def default_lib_linking_mode t = tag( 'lib_linking_mode', 'unknown' ) if 'unknown' != t 'static' == t ? BinaryLibrary::STATIC : BinaryLibrary::SHARED else BinaryLibrary::SHARED end end |
#lib_linking_mode_switch(linking_mode) ⇒ Object
Return command line switch for forcing specified library type.
89 90 91 |
# File 'lib/mxx_ru/cpp/toolsets/gcc_unix_family.rb', line 89 def lib_linking_mode_switch( linking_mode ) "-Wl,#{linking_mode == BinaryLibrary::SHARED ? '-Bdynamic' : '-Bstatic'} " end |
#make_linker_include_lib_options(target, libs) ⇒ Object
Special implementation for support explicit library type linker option.
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/mxx_ru/cpp/toolsets/gcc_unix_family.rb', line 55 def ( target, libs ) current_lib_type = nil all_libs = libs.inject( '' ) { |r, l| # Insert new lib mode switch only if next library has different # type than current type. if nil == current_lib_type || current_lib_type != l.type r << switch_to_default_lib_mode_if_needed( current_lib_type ) current_lib_type = l.type if BinaryLibrary::ANY != l.type && default_lib_linking_mode != l.type r << lib_linking_mode_switch( l.type ) end end r << '-l' << port_specific_lib_name_checker( l.name ) << ' ' } all_libs << switch_to_default_lib_mode_if_needed( current_lib_type ) ( all_libs ) end |
#setup_mandatory_options(target) ⇒ Object
This implementation adds -fPIC option for GccUnix compilers. In 1.5.6 version -fPIC existed in GccFamily toolset’s method but MinGW doesn’t support that option.
49 50 51 52 |
# File 'lib/mxx_ru/cpp/toolsets/gcc_unix_family.rb', line 49 def ( target ) super( target ) target.compiler_option( "-fPIC" ) end |
#switch_to_default_lib_mode_if_needed(current_lib_type) ⇒ Object
Return command line switch for closing group of libraries with same type. Empty string returned if current_lib_type is nil of is current_lib_type is default lib linking mode on this platform.
96 97 98 99 100 101 102 103 104 |
# File 'lib/mxx_ru/cpp/toolsets/gcc_unix_family.rb', line 96 def switch_to_default_lib_mode_if_needed( current_lib_type ) if nil != current_lib_type && BinaryLibrary::ANY != current_lib_type && default_lib_linking_mode != current_lib_type lib_linking_mode_switch( default_lib_linking_mode ) else '' end end |