Class: MxxRu::Cpp::Toolsets::ClangFamily
- Inherits:
-
GccFamily
- Object
- MxxRu::Cpp::Toolset
- GccFamily
- MxxRu::Cpp::Toolsets::ClangFamily
- Defined in:
- lib/mxx_ru/cpp/toolsets/clang_family.rb
Overview
Toolset implemetation for Clang compiler.
Direct Known Subclasses
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
Instance Method Summary collapse
-
#c_compiler_name ⇒ Object
Returns C compiler name.
-
#cpp_compiler_name ⇒ Object
Returns C++ compiler name.
-
#default_lib_linking_mode ⇒ Object
Return default library linking mode for current platform.
-
#initialize(name) ⇒ ClangFamily
constructor
A new instance of ClangFamily.
-
#lib_linking_mode_switch(linking_mode) ⇒ Object
Return command line switch for forcing specified library type.
-
#librarian_name ⇒ Object
Returns librarian name.
-
#linker_name ⇒ Object
Returns linker name.
-
#make_linker_include_lib_options(target, libs) ⇒ Object
Special implementation for support explicit library type linker option.
-
#setup_mandatory_options(target) ⇒ Object
See description at MxxRu::Cpp::Toolset#setup_mandatory_options.
-
#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
#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, #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, #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, #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_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) ⇒ ClangFamily
Returns a new instance of ClangFamily.
40 41 42 |
# File 'lib/mxx_ru/cpp/toolsets/clang_family.rb', line 40 def initialize( name ) super( name ) end |
Instance Method Details
#c_compiler_name ⇒ Object
Returns C compiler name.
87 88 89 |
# File 'lib/mxx_ru/cpp/toolsets/clang_family.rb', line 87 def c_compiler_name tag( [ C_COMPILER_NAME_TAG, COMPILER_NAME_TAG ], "clang" ) end |
#cpp_compiler_name ⇒ Object
Returns C++ compiler name.
92 93 94 |
# File 'lib/mxx_ru/cpp/toolsets/clang_family.rb', line 92 def cpp_compiler_name tag( [ CPP_COMPILER_NAME_TAG, COMPILER_NAME_TAG ], "clang++" ) end |
#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’.
132 133 134 135 136 137 138 139 |
# File 'lib/mxx_ru/cpp/toolsets/clang_family.rb', line 132 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.
142 143 144 |
# File 'lib/mxx_ru/cpp/toolsets/clang_family.rb', line 142 def lib_linking_mode_switch( linking_mode ) "-Wl,#{linking_mode == BinaryLibrary::SHARED ? '-Bdynamic' : '-Bstatic'} " end |
#librarian_name ⇒ Object
Returns librarian name.
102 103 104 |
# File 'lib/mxx_ru/cpp/toolsets/clang_family.rb', line 102 def librarian_name tag( LIBRARIAN_NAME_TAG, "ar" ) end |
#linker_name ⇒ Object
Returns linker name.
97 98 99 |
# File 'lib/mxx_ru/cpp/toolsets/clang_family.rb', line 97 def linker_name tag( LINKER_NAME_TAG, "clang++" ) end |
#make_linker_include_lib_options(target, libs) ⇒ Object
Special implementation for support explicit library type linker option.
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
# File 'lib/mxx_ru/cpp/toolsets/clang_family.rb', line 107 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
See description at MxxRu::Cpp::Toolset#setup_mandatory_options.
45 46 47 48 49 50 51 52 53 54 55 56 57 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 |
# File 'lib/mxx_ru/cpp/toolsets/clang_family.rb', line 45 def ( target ) if RUNTIME_DEBUG == target.mxx_runtime_mode target.compiler_option( "-g" ) target.linker_option( "-g" ) elsif RUNTIME_RELEASE == target.mxx_runtime_mode target.define( "NDEBUG" ) target.linker_option( "-s" ) if OPTIM_SIZE == target.mxx_optimization target.compiler_option( "-Os" ) else target.compiler_option( "-O2" ) end end if RTTI_DISABLED == target.mxx_rtti_mode target.cpp_compiler_option( "-fno-rtti" ) end target.compiler_option( "-fPIC" ) target.mxx_all_defines.each { |d| target.compiler_option( "-D" + d ) } target.mxx_all_include_paths.each { |p| target.compiler_option( "-I" + p ) } if CPP_STD14 == cpp_std target.cpp_compiler_option( '-std=c++14' ) elsif CPP_STD11 == cpp_std target.cpp_compiler_option( "-std=c++11" ) end if CPP_STD11 <= cpp_std and THREADING_MULTI == target.mxx_threading_mode target.linker_option( '-pthread' ) end 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.
149 150 151 152 153 154 155 156 157 |
# File 'lib/mxx_ru/cpp/toolsets/clang_family.rb', line 149 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 |