class MxxRu::Cpp::Toolsets::GccUnixFamily
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.
Public Class Methods
MxxRu::Cpp::Toolsets::GccFamily::new
# File lib/mxx_ru/cpp/toolsets/gcc_unix_family.rb, line 42 def initialize( name ) super( name ) end
Public Instance Methods
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'.
# 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
Return command line switch for forcing specified library type.
# 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
Special implementation for support explicit library type linker option.
# File lib/mxx_ru/cpp/toolsets/gcc_unix_family.rb, line 55 def make_linker_include_lib_options( 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 ) enclose_linker_include_lib_options_into_brackes( all_libs ) end
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.
MxxRu::Cpp::Toolsets::GccFamily#setup_mandatory_options
# File lib/mxx_ru/cpp/toolsets/gcc_unix_family.rb, line 49 def setup_mandatory_options( target ) super( target ) target.compiler_option( "-fPIC" ) end
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.
# 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