Class: MxxRu::Cpp::Toolset
- Inherits:
-
Object
- Object
- MxxRu::Cpp::Toolset
- Defined in:
- lib/mxx_ru/cpp/toolset.rb
Overview
Base toolset class. Toolset is a compiler and tool set for compiling an application.
Direct Known Subclasses
MxxRu::Cpp::Toolsets::BccWin32Family, MxxRu::Cpp::Toolsets::C89NskFamily, MxxRu::Cpp::Toolsets::GccFamily, MxxRu::Cpp::Toolsets::VcFamily
Defined Under Namespace
Classes: UnknownTagEx
Constant Summary collapse
- Unknown_tag_ex =
For compatibility with previous versions.
UnknownTagEx
- COMPILER_NAME_TAG =
Tag name for a custom compiler name.
Must be used in cases where there isn’t difference beetwen C and C++ compilers (VC++, Borland C++ for example). If the difference exists (GNU Compiler Collection with gcc and g++ for example) C_COMPILER_NAME_TAG and CPP_COMPILER_NAME_TAG must be used.
Since v.1.4.0
'compiler_name'
- C_COMPILER_NAME_TAG =
Tag name for a custom C compiler name.
Since v.1.4.0
'c_compiler_name'
- CPP_COMPILER_NAME_TAG =
Tag name for a custom C++ compiler name.
Since v.1.4.0
'cpp_compiler_name'
- LINKER_NAME_TAG =
Tag name for a custom linker name.
Since v.1.4.0
'linker_name'
- LIBRARIAN_NAME_TAG =
Tag name for a custom librarian name.
Since v.1.4.0
'librarian_name'
- IMPORT_LIBRARIAN_NAME_TAG =
Tag name for a custom import librarian name.
Since v.1.4.0
'import_librarian_name'
- RC_NAME_TAG =
Tag name for a custom resource compiler name.
Since v.1.4.0
'rc_name'
Instance Attribute Summary collapse
-
#cpp_std ⇒ Object
readonly
Get the C++ standard version.
Class Method Summary collapse
-
.has_linkable_dependecies?(target) ⇒ Boolean
Has a target any linkable libraries as dependecies?.
Instance Method Summary collapse
-
#clean_dll(target) ⇒ Object
Perform dynamic library cleanup.
-
#clean_dll_specific_files(a_dll_file, a_dll_info, a_target) ⇒ Object
Perform a cleanup of auxiliary files, specific for static library on given platform.
-
#clean_exe(target) ⇒ Object
Perform executable file cleanup.
-
#clean_exe_specific_files(a_exe_file, a_exe_info, a_target) ⇒ Object
Perform a cleanup of auxiliary files, specific for static library on given platform.
-
#clean_lib(target) ⇒ Object
Perform cleanup of static library.
-
#clean_lib_specific_files(a_lib_file, a_lib_info, a_target) ⇒ Object
Perform a cleanup of auxiliary files, specific for static library on given platform.
-
#clean_mswin_res(target) ⇒ Object
Remove resource files compilation results.
-
#clean_mswin_res_specific_files(a_res_file, a_res_info, a_target) ⇒ Object
Perform cleanup of files specific for mswin-res.
-
#clean_objs(target) ⇒ Object
Remove object files.
-
#dll_file_name(source_name, target) ⇒ Object
Get shared library file name.
-
#exe_file_name(source_name, target) ⇒ Object
Get executable file name.
-
#force_cpp03 ⇒ Object
Set C++03 standard version.
-
#force_cpp0x_std ⇒ Object
Sets a flag includes “-std=c++0x” compiler option.
-
#force_cpp11 ⇒ Object
Set C++11 standard version.
-
#force_cpp14 ⇒ Object
Set C++14 standard version.
-
#full_dll_name(target) ⇒ Object
Create full dll file name.
-
#full_exe_name(target) ⇒ Object
Create full exe file name.
-
#full_lib_name(target) ⇒ Object
Create full lib file name.
-
#implib_link_name(dll_real_name, target) ⇒ Object
Get shared library name, which should be passed to the linker.
-
#implib_link_path(dll_real_name, dll_real_path, target) ⇒ Object
Get folder name containing import library, which should be passed to the linker.
-
#initialize(a_name) ⇒ Toolset
constructor
Constructor.
-
#lib_file_name(source_name, target) ⇒ Object
Get static library file name.
-
#lib_link_name(source_name, target) ⇒ Object
Get static library name, which should be passed to the linker.
-
#make_c_obj_command_lines(obj_name, source_name, compiler_options, target) ⇒ Object
Create command line for C file compilation.
-
#make_cpp_obj_command_lines(obj_name, source_name, compiler_options, target) ⇒ Object
Create command line for C++ file compilation.
-
#make_dll(target, force_rebuilding = false) ⇒ Object
Perform dynamic library build.
-
#make_dll_command_lines(a_dll_name, a_dll_info, a_linker_lists, a_target) ⇒ Object
Create command line for DLL build.
-
#make_dll_requirements(a_dll_name, a_dll_info, a_linker_lists, a_target) ⇒ Object
Create dependencies list from DLL given.
-
#make_exe(target, force_rebuilding = false) ⇒ Object
Perform executable file build.
-
#make_exe_command_lines(a_exe_name, a_exe_info, a_linker_lists, a_target) ⇒ Object
Create command line for EXE build.
-
#make_lib(target, force_rebuilding = false) ⇒ Object
Perform static library build.
-
#make_lib_command_lines(lib_name, obj_files, librarian_options, target) ⇒ Object
Create command line for static library build.
-
#make_mswin_res(target) ⇒ Object
Perform resource files compilation.
-
#make_mswin_res_command_lines(res_name, rc_file, rc_options, target) ⇒ Object
Create command line for resource file compilation.
-
#make_objs(target) ⇒ Object
Perform C++ files compilation.
-
#name ⇒ Object
toolset name accessor.
-
#obj_file_ext ⇒ Object
Get file extension for an object file.
-
#setup_mandatory_options(target) ⇒ Object
Set all compiler, linker, archiver, etc options required, taking all current modes, such as runtime_mode, rtl_mode, rtti_mode, threading_mode etc into account.
-
#setup_tag(a_name, a_value) ⇒ Object
Set tag value.
-
#tag(a_name, a_default = nil) ⇒ Object
Get tag value.
Constructor Details
#initialize(a_name) ⇒ Toolset
Constructor.
- a_name
-
Toolset name.
351 352 353 354 355 356 357 |
# File 'lib/mxx_ru/cpp/toolset.rb', line 351 def initialize( a_name ) @name = a_name @tags = Hash.new # C++ standard version @cpp_std = CPP_STD_DEFAULT end |
Instance Attribute Details
#cpp_std ⇒ Object (readonly)
Get the C++ standard version
1035 1036 1037 |
# File 'lib/mxx_ru/cpp/toolset.rb', line 1035 def cpp_std @cpp_std end |
Class Method Details
.has_linkable_dependecies?(target) ⇒ Boolean
Has a target any linkable libraries as dependecies?
Returns true if target is derived from MxxRu::BinaryTarget.
Since v.1.4.0
364 365 366 |
# File 'lib/mxx_ru/cpp/toolset.rb', line 364 def Toolset.has_linkable_dependecies?( target ) target.kind_of?( MxxRu::BinaryTarget ) end |
Instance Method Details
#clean_dll(target) ⇒ Object
Perform dynamic library cleanup. Target parameter should be an object of a class, inherited from MxxRu::Cpp::Target.
664 665 666 667 668 669 670 671 672 673 |
# File 'lib/mxx_ru/cpp/toolset.rb', line 664 def clean_dll( target ) # Creating result file name. dll_info = make_dll_name( target.mxx_target_name, target ) dll_file = dll_info.full_name MxxRu::Util::delete_file( dll_file ) clean_dll_specific_files( dll_file, dll_info, target ) end |
#clean_dll_specific_files(a_dll_file, a_dll_info, a_target) ⇒ Object
Perform a cleanup of auxiliary files, specific for static library on given platform. Does nothing in a base class, but may be redefined by a child class if import library may be created on given platform.
- a_dll_file
-
Full library file name.
- a_dll_info
-
DllInfo, created for the file.
- a_target
-
Target, the library is created for.
682 683 684 685 686 |
# File 'lib/mxx_ru/cpp/toolset.rb', line 682 def clean_dll_specific_files( a_dll_file, a_dll_info, a_target ) end |
#clean_exe(target) ⇒ Object
Perform executable file cleanup. Target parameter should be an object of a class, inherited from MxxRu::Cpp::Target.
733 734 735 736 737 738 739 740 741 742 |
# File 'lib/mxx_ru/cpp/toolset.rb', line 733 def clean_exe( target ) # Creating result file name. exe_info = make_exe_name( target.mxx_target_name, target ) exe_file = exe_info.full_name MxxRu::Util::delete_file( exe_file ) clean_exe_specific_files( exe_file, exe_info, target ) end |
#clean_exe_specific_files(a_exe_file, a_exe_info, a_target) ⇒ Object
Perform a cleanup of auxiliary files, specific for static library on given platform. Does nothing in a base class, but may be redefined by a child class.
- a_exe_file
-
Full file name.
- a_exe_info
-
ExeInfo, created for the file.
- a_target
-
Target, the file is created for.
751 752 753 754 755 |
# File 'lib/mxx_ru/cpp/toolset.rb', line 751 def clean_exe_specific_files( a_exe_file, a_exe_info, a_target ) end |
#clean_lib(target) ⇒ Object
Perform cleanup of static library. Target parameter should be an object of a class, inherited from MxxRu::Cpp::Target.
588 589 590 591 592 593 594 595 596 597 598 |
# File 'lib/mxx_ru/cpp/toolset.rb', line 588 def clean_lib( target ) # Creating result file name. Also determining in which folder # lib should be. lib_info = make_lib_name( target.mxx_target_name, target ) lib_file = lib_info.full_name MxxRu::Util::delete_file( lib_file ) clean_lib_specific_files( lib_file, lib_info, target ) end |
#clean_lib_specific_files(a_lib_file, a_lib_info, a_target) ⇒ Object
Perform a cleanup of auxiliary files, specific for static library on given platform. Does nothing in a base class, but may be redefined by a child class.
- a_lib_file
-
Full name of library file.
- a_lib_info
-
LibInfo, created for the file.
- a_target
-
Target, library is created for.
607 608 609 610 611 |
# File 'lib/mxx_ru/cpp/toolset.rb', line 607 def clean_lib_specific_files( a_lib_file, a_lib_info, a_target ) end |
#clean_mswin_res(target) ⇒ Object
Remove resource files compilation results.
508 509 510 511 512 513 514 515 516 517 518 |
# File 'lib/mxx_ru/cpp/toolset.rb', line 508 def clean_mswin_res( target ) # Creating the name of res file. res_info = make_mswin_res_name( target.mxx_mswin_rc_file.name, target ) full_name = res_info.full_name MxxRu::Util::delete_file( full_name ) clean_mswin_res_specific_files( full_name, res_info, target ) end |
#clean_mswin_res_specific_files(a_res_file, a_res_info, a_target) ⇒ Object
Perform cleanup of files specific for mswin-res. Does nothing in a base class.
- a_res_file
-
Full name of mswin-res-file.
- a_res_info
-
Formatted information for res-file.
- a_target
-
Target, for which mswin-res-file is defined.
526 527 528 529 530 |
# File 'lib/mxx_ru/cpp/toolset.rb', line 526 def clean_mswin_res_specific_files( a_res_file, a_res_info, a_target ) end |
#clean_objs(target) ⇒ Object
Remove object files.
466 467 468 469 470 471 472 473 |
# File 'lib/mxx_ru/cpp/toolset.rb', line 466 def clean_objs( target ) # Creating all object file names. c_objs = make_obj_names( target.mxx_c_files, target ) cpp_objs = make_obj_names( target.mxx_cpp_files, target ) c_objs.each { |o| MxxRu::Util::delete_file( o.name ) } cpp_objs.each { |o| MxxRu::Util::delete_file( o.name ) } end |
#dll_file_name(source_name, target) ⇒ Object
Get shared library file name.
AbstractMethodEx exception is thrown in a base class.
868 869 870 871 |
# File 'lib/mxx_ru/cpp/toolset.rb', line 868 def dll_file_name( source_name, target ) raise AbstractMethodEx.new( "MxxRu::Cpp::Toolset::dll_file_name" ) end |
#exe_file_name(source_name, target) ⇒ Object
Get executable file name.
AbstractMethodEx exception is thrown in a base class.
951 952 953 954 |
# File 'lib/mxx_ru/cpp/toolset.rb', line 951 def exe_file_name( source_name, target ) raise AbstractMethodEx.new( "MxxRu::Cpp::Toolset::exe_file_name" ) end |
#force_cpp03 ⇒ Object
Set C++03 standard version.
Since v.1.6.3.
1016 1017 1018 |
# File 'lib/mxx_ru/cpp/toolset.rb', line 1016 def force_cpp03 set_cpp_std CPP_STD03 end |
#force_cpp0x_std ⇒ Object
Sets a flag includes “-std=c++0x” compiler option. Using at gnu-compilers.
Kept for compatibility with previous versions.
1009 1010 1011 |
# File 'lib/mxx_ru/cpp/toolset.rb', line 1009 def force_cpp0x_std set_cpp_std CPP_STD11 end |
#force_cpp11 ⇒ Object
Set C++11 standard version.
Since v.1.6.3
1023 1024 1025 |
# File 'lib/mxx_ru/cpp/toolset.rb', line 1023 def force_cpp11 set_cpp_std CPP_STD11 end |
#force_cpp14 ⇒ Object
Set C++14 standard version.
Since v.1.6.3
1030 1031 1032 |
# File 'lib/mxx_ru/cpp/toolset.rb', line 1030 def force_cpp14 set_cpp_std CPP_STD14 end |
#full_dll_name(target) ⇒ Object
Create full dll file name.
Since v.1.4.7
993 994 995 |
# File 'lib/mxx_ru/cpp/toolset.rb', line 993 def full_dll_name( target ) make_dll_name( target.mxx_target_name, target ).full_name end |
#full_exe_name(target) ⇒ Object
Create full exe file name.
Since v.1.4.7
985 986 987 |
# File 'lib/mxx_ru/cpp/toolset.rb', line 985 def full_exe_name( target ) make_exe_name( target.mxx_target_name, target ).full_name end |
#full_lib_name(target) ⇒ Object
Create full lib file name
Since v.1.4.7
1001 1002 1003 |
# File 'lib/mxx_ru/cpp/toolset.rb', line 1001 def full_lib_name( target ) make_lib_name( target.mxx_target_name, target ).full_name end |
#implib_link_name(dll_real_name, target) ⇒ Object
Get shared library name, which should be passed to the linker. May return nil if no import library defined.
AbstractMethodEx exception is thrown in a base class.
- dll_real_name
-
The name, returned on previous reference to dll_file_name.
- target
-
Target, the library is created for.
881 882 883 884 885 886 |
# File 'lib/mxx_ru/cpp/toolset.rb', line 881 def implib_link_name( dll_real_name, target ) raise AbstractMethodEx.new( "MxxRu::Cpp::Toolset::implib_link_name" ) end |
#implib_link_path(dll_real_name, dll_real_path, target) ⇒ Object
Get folder name containing import library, which should be passed to the linker. Executed only if previous implib_link_name returned other then nil value. May return nil, if no import library defined. Should be redefined in a child class.
AbstractMethodEx exception is thrown in a base class.
- dll_real_name
-
The name, returned on previous reference to dll_file_name.
- dll_real_path
-
Folder name, DLL will be in.
- target
-
Target, the library is created for.
900 901 902 903 904 905 906 |
# File 'lib/mxx_ru/cpp/toolset.rb', line 900 def implib_link_path( dll_real_name, dll_real_path, target ) raise AbstractMethodEx.new( "MxxRu::Cpp::Toolset::implib_link_path" ) end |
#lib_file_name(source_name, target) ⇒ Object
Get static library file name.
AbstractMethodEx exception is thrown in a base class.
830 831 832 833 |
# File 'lib/mxx_ru/cpp/toolset.rb', line 830 def lib_file_name( source_name, target ) raise AbstractMethodEx.new( "MxxRu::Cpp::Toolset::lib_file_name" ) end |
#lib_link_name(source_name, target) ⇒ Object
Get static library name, which should be passed to the linker.
AbstractMethodEx exception is thrown in a base class.
839 840 841 842 |
# File 'lib/mxx_ru/cpp/toolset.rb', line 839 def lib_link_name( source_name, target ) raise AbstractMethodEx.new( "MxxRu::Cpp::Toolset::lib_link_name" ) end |
#make_c_obj_command_lines(obj_name, source_name, compiler_options, target) ⇒ Object
Create command line for C file compilation. Returns Array of String with command lines. Should be redefined in a child class.
AbstractMethodEx exception is thrown in a base class.
- obj_name
-
Object file name.
- source_name
-
Source file name.
- compiler_options
-
Compiler options list. Array of String.
- target
-
Target, which contains object file given.
776 777 778 779 780 781 782 783 784 |
# File 'lib/mxx_ru/cpp/toolset.rb', line 776 def make_c_obj_command_lines( obj_name, source_name, , target ) raise AbstractMethodEx.new( "MxxRu::Cpp::Toolset::make_c_obj_command_lines" ) end |
#make_cpp_obj_command_lines(obj_name, source_name, compiler_options, target) ⇒ Object
Create command line for C++ file compilation. Returns Array of String with command lines. Should be redefined in a child class.
AbstractMethodEx exception is thrown in a base class.
- obj_name
-
Object file name.
- source_name
-
Source file name.
- compiler_options
-
Compiler options list. Array of String.
- target
-
Target, which contains object file given.
796 797 798 799 800 801 802 803 804 |
# File 'lib/mxx_ru/cpp/toolset.rb', line 796 def make_cpp_obj_command_lines( obj_name, source_name, , target ) raise AbstractMethodEx.new( "MxxRu::Cpp::Toolset::make_c_obj_command_lines" ) end |
#make_dll(target, force_rebuilding = false) ⇒ Object
Perform dynamic library build. Target parameter should be an object of a class, inherited from MxxRu::Cpp::Target.
If force_rebuilding is true then DLL will be rebuilt whitout checking its dependecies.
620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 |
# File 'lib/mxx_ru/cpp/toolset.rb', line 620 def make_dll( target, force_rebuilding = false ) # Creating result file name. dll_info = make_dll_name( target.mxx_target_name, target ) dll_file = dll_info.full_name dll_state = if force_rebuilding MxxRu::TargetState.make_absent else MxxRu::TargetState::detect( dll_file, create_executable_depend_list( target ) ) end if MxxRu::TargetState::EXISTS != dll_state.state # Target should be rebuilt. link_lists = prepare_linker_lists( target ) cmd_lines = make_dll_command_lines( dll_file, dll_info, link_lists, target ) MxxRu::AbstractTarget::run( cmd_lines, [ dll_file ], "building #{dll_file}" ) dll_state = MxxRu::TargetState.new( MxxRu::TargetState::REBUILT ) end # Full library file name should be included in files list, created by # given target. target.mxx_add_full_target_name( dll_file ) # Determining dependencies list for all who will link this DLL. dll_requirements = make_dll_requirements( dll_file, dll_info, link_lists, target ) target.mxx_add_required_libs( dll_requirements.libs ) target.mxx_add_required_lib_paths( dll_requirements.lib_paths ) return dll_state end |
#make_dll_command_lines(a_dll_name, a_dll_info, a_linker_lists, a_target) ⇒ Object
Create command line for DLL build. Returns Array of String with command lines. Should be redefined in a child class.
AbstractMethodEx exception is thrown in a base class.
- a_dll_name
-
DLL result file name.
- a_dll_info
-
DLL description.
- a_linker_lists
-
Lists required for linker.
- a_target
-
Target, the library is created for.
918 919 920 921 922 923 924 925 926 |
# File 'lib/mxx_ru/cpp/toolset.rb', line 918 def make_dll_command_lines( a_dll_name, a_dll_info, a_linker_lists, a_target ) raise AbstractMethodEx.new( "MxxRu::Cpp::Toolset::make_dll_command_lines" ) end |
#make_dll_requirements(a_dll_name, a_dll_info, a_linker_lists, a_target) ⇒ Object
Create dependencies list from DLL given. Returns DllRequirements object.
AbstractMethodEx exception is thrown in a base class.
- a_dll_name
-
DLL result file name.
- a_dll_info
-
DLL description.
- a_linker_lists
-
Lists required for linker.
- a_target
-
Target, the library is created for.
937 938 939 940 941 942 943 944 945 |
# File 'lib/mxx_ru/cpp/toolset.rb', line 937 def make_dll_requirements( a_dll_name, a_dll_info, a_linker_lists, a_target ) raise AbstractMethodEx.new( "MxxRu::Cpp::Toolset::make_dll_requirements" ) end |
#make_exe(target, force_rebuilding = false) ⇒ Object
Perform executable file build. Target parameter should be an object of a class, inherited from MxxRu::Cpp::Target.
If force_rebuilding is true then EXE will be rebuilt whitout checking its dependecies.
695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 |
# File 'lib/mxx_ru/cpp/toolset.rb', line 695 def make_exe( target, force_rebuilding = false ) # Creating result file name. exe_info = make_exe_name( target.mxx_target_name, target ) exe_file = exe_info.full_name exe_state = if force_rebuilding MxxRu::TargetState.make_absent else MxxRu::TargetState::detect( exe_file, create_executable_depend_list( target ) ) end if MxxRu::TargetState::EXISTS != exe_state.state # Target should be rebuilt. link_lists = prepare_linker_lists( target ) cmd_lines = make_exe_command_lines( exe_file, exe_info, link_lists, target ) MxxRu::AbstractTarget::run( cmd_lines, [ exe_file ], "building #{exe_file}" ) exe_state = MxxRu::TargetState.new( MxxRu::TargetState::REBUILT ) end # Full library file name should be included in files list, created by # given target. target.mxx_add_full_target_name( exe_file ) return exe_state end |
#make_exe_command_lines(a_exe_name, a_exe_info, a_linker_lists, a_target) ⇒ Object
Create command line for EXE build. Returns Array of String with command lines. Should be redefined in a child class.
AbstractMethodEx exception is thrown in a base class.
- a_exe_name
-
EXE result file name.
- a_exe_info
-
EXE description.
- a_linker_lists
-
Lists required for linker.
- a_target
-
Target, the executable is created for.
966 967 968 969 970 971 972 973 974 |
# File 'lib/mxx_ru/cpp/toolset.rb', line 966 def make_exe_command_lines( a_exe_name, a_exe_info, a_linker_lists, a_target ) raise AbstractMethodEx.new( "MxxRu::Cpp::Toolset::make_exe_command_lines" ) end |
#make_lib(target, force_rebuilding = false) ⇒ Object
Perform static library build. Target parameter should be an object of a class, inherited from MxxRu::Cpp::Target.
If force_rebuilding is true then library will be rebuilt whitout checking its dependecies.
539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 |
# File 'lib/mxx_ru/cpp/toolset.rb', line 539 def make_lib( target, force_rebuilding = false ) # Creating result file name. Also determining in which folder # lib should be. The name of that folder should be included in # libraries search paths of given target. lib_info = make_lib_name( target.mxx_target_name, target ) # Determining target status. lib_file = lib_info.full_name lib_state = force_rebuilding ? MxxRu::TargetState.make_absent : MxxRu::TargetState::detect( lib_file, target.mxx_obj_files ) if MxxRu::TargetState::EXISTS != lib_state.state # File should be rebuilt. cmd_lines = make_lib_command_lines( lib_file, target.mxx_obj_files, target., target ) MxxRu::AbstractTarget::run( cmd_lines, [ lib_file ], "building #{lib_file}" ) lib_state = MxxRu::TargetState.new( MxxRu::TargetState::REBUILT ) end # Full library file name should be included in files list, created by # given target. target.mxx_add_full_target_name( lib_file ) # For a library, in a dependency list the library itself may be # included. target.mxx_add_required_lib( BinaryLibrary.new( lib_info.link_name, BinaryLibrary::STATIC ) ) target.mxx_add_required_lib_path( lib_info.path ) # And all libraries and folders from all subordinated projects. target.mxx_required_prjs.each { |d| if Toolset::has_linkable_dependecies?( d ) target.mxx_add_required_libs( d.mxx_required_libs ) target.mxx_add_required_lib_paths( d.mxx_required_lib_paths ) end } return lib_state end |
#make_lib_command_lines(lib_name, obj_files, librarian_options, target) ⇒ Object
Create command line for static library build. Returns Array of String with command lines. Should be redefined in a child class.
AbstractMethodEx exception is thrown in a base class.
- lib_name
-
Result library file name.
- obj_files
-
Object file names, which should be included in the library.
- librarian_options
-
Archiver options list. Array of String.
- target
-
Target, the library is created for.
854 855 856 857 858 859 860 861 862 |
# File 'lib/mxx_ru/cpp/toolset.rb', line 854 def make_lib_command_lines( lib_name, obj_files, , target ) raise AbstractMethodEx.new( "MxxRu::Cpp::Toolset::make_lib_command_lines" ) end |
#make_mswin_res(target) ⇒ Object
Perform resource files compilation. Target parameter should be an object of a class, inherited from MxxRu::Cpp::Target.
478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 |
# File 'lib/mxx_ru/cpp/toolset.rb', line 478 def make_mswin_res( target ) # Creating the name of res file and storing it in the target. res_info = make_mswin_res_name( target.mxx_mswin_rc_file.name, target ) full_name = res_info.full_name target.mswin_res_file( full_name ) # Determining it's status. state = TargetState::detect( full_name, [ target.mxx_mswin_rc_file.name ] + target.mxx_mswin_rc_file.depends ) if state.state != TargetState::EXISTS cmd_lines = make_mswin_res_command_lines( full_name, target.mxx_mswin_rc_file.name, target., target ) MxxRu::AbstractTarget::run( cmd_lines, [ full_name ], "compilling #{full_name}" ) state = MxxRu::TargetState.new( MxxRu::TargetState::REBUILT ) end return state end |
#make_mswin_res_command_lines(res_name, rc_file, rc_options, target) ⇒ Object
Create command line for resource file compilation. Returns Array of String with command lines. Should be redefined in a child class.
AbstractMethodEx exception is thrown in a base class.
- res_name
-
Full file name of resulting res file.
- rc_file
-
Source resource file.
- rc_options
-
Resource compiler options.
- target
-
Target, resources are required for.
816 817 818 819 820 821 822 823 824 |
# File 'lib/mxx_ru/cpp/toolset.rb', line 816 def make_mswin_res_command_lines( res_name, rc_file, , target ) raise AbstractMethodEx.new( "MxxRu::Cpp::Toolset::make_mswin_res_command_lines" ) end |
#make_objs(target) ⇒ Object
Perform C++ files compilation. Target parameter should be an object of a class, inherited from MxxRu::Cpp::Target.
432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 |
# File 'lib/mxx_ru/cpp/toolset.rb', line 432 def make_objs( target ) # Creating all object file names. c_objs = make_obj_names( target.mxx_c_files, target ) cpp_objs = make_obj_names( target.mxx_cpp_files, target ) # Defining object files, which is necessary to build or rebuild. c_objs_to_build = detect_objs_to_rebuild( c_objs ) cpp_objs_to_build = detect_objs_to_rebuild( cpp_objs ) # Performing a compilation, if it's required. if c_objs_to_build.size build_objs( c_objs_to_build, target, target., :make_c_obj_command_lines ) end if cpp_objs_to_build.size build_objs( cpp_objs_to_build, target, target., :make_cpp_obj_command_lines ) end # It's required to store all object file names back to the target, # because they are required for linking. c_objs.each { |o| target.obj_file( o.name ) } cpp_objs.each { |o| target.obj_file( o.name ) } # Also informing if some object files were rebuilt. state = (c_objs_to_build.empty? && cpp_objs_to_build.empty?) ? TargetState::EXISTS : TargetState::REBUILT return TargetState.new( state ) end |
#name ⇒ Object
toolset name accessor.
977 978 979 |
# File 'lib/mxx_ru/cpp/toolset.rb', line 977 def name return @name end |
#obj_file_ext ⇒ Object
Get file extension for an object file. Should be redefined in a child class.
AbstractMethodEx exception is thrown in a base class.
762 763 764 |
# File 'lib/mxx_ru/cpp/toolset.rb', line 762 def obj_file_ext() raise AbstractMethodEx.new( "MxxRu::Cpp::Toolset::obj_file_ext" ) end |
#setup_mandatory_options(target) ⇒ Object
Set all compiler, linker, archiver, etc options required, taking all current modes, such as runtime_mode, rtl_mode, rtti_mode, threading_mode etc into account. Target parameter should be an object of a class, inherited from MxxRu::Cpp::Target.
Throws AbstractMethodEx exception in a base class.
425 426 427 |
# File 'lib/mxx_ru/cpp/toolset.rb', line 425 def ( target ) raise AbstractMethodEx.new( "MxxRu::Cpp::Toolset::setup_mandatory_options" ) end |
#setup_tag(a_name, a_value) ⇒ Object
Set tag value. Previous value is changed to the new one.
- a_name
-
Tag name.
- a_value
-
Value. Should be a string.
373 374 375 |
# File 'lib/mxx_ru/cpp/toolset.rb', line 373 def setup_tag( a_name, a_value ) @tags[ a_name ] = a_value end |
#tag(a_name, a_default = nil) ⇒ Object
Get tag value. If tag wasn’t found in a tag map, a_default value is returned. If a_default == nil, then exception is thrown in a case of missing tag.
Since v.1.4.0
a_name can be Enumerable. In this case each value from a_name searched in defined tag names. The first occurence (if found) returned. For example:
tag( [ CPP_COMPILER_NAME_TAG, COMPILER_NAME_TAG ], 'g++' )
returns:
-
value of CPP_COMPILER_NAME_TAG if defined,
-
value of COMPILER_NAME_TAG if CPP_COMPILER_NAME_TAG not defined, but COMPILER_NAME_TAG defined,
-
‘g++’ if neither CPP_COMPILER_NAME_TAG nor COMPILER_NAME_TAG is defined.
395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 |
# File 'lib/mxx_ru/cpp/toolset.rb', line 395 def tag( a_name, a_default = nil ) r = if a_name.kind_of?( String ) @tags.key?( a_name ) ? @tags[ a_name ] : nil elsif a_name.respond_to?( :each ) catch( :found ) do a_name.each do |name| throw( :found, @tags[ name ] ) if @tags.key?( name ) end nil end else raise InvalidValueEx.new( 'String or object with :each expected, received: ' + a_name.class.name ) end raise UnknownTagEx.new( a_name ) if ( nil == r && nil == a_default ) r = a_default unless r r end |