Class: MxxRu::Cpp::PrjAwareRuntimeSubdirObjPlacement
- Inherits:
-
ObjPlacement
- Object
- ObjPlacement
- MxxRu::Cpp::PrjAwareRuntimeSubdirObjPlacement
- Defined in:
- lib/mxx_ru/cpp/obj_placements/prj_aware_runtime_subdir.rb
Overview
Since v.1.6.12
This class is similar to RuntimeSubdirObjPlacement and ToolsetRuntimeSubdirObjPlacement but stores intermediate files (like object files, compiled resources and so on) in special subfolders.
These subfoldes use special naming in forms:
<final_path>/_objs/<runtime>/<prj_alias>/<subdir>
<final_path>/_objs/<toolset>/<runtime>/<prj_alias>/<subdir>
where subdir is created from a path to source file. A path is transformed (all separators like / or :) is changed to _. It means that so_5/rt/impl will be transformed to so_5_rt_impl. If the result is too long it is transformed another time: part of result name will be changed to SHA1 digest. For example a name so_5/disp/prio_one_thread/quoted_round_robin will be transformed to so_5_disp_prio_one_thread_quoted_round_robin and then to so_5__robin-8f160349ec35.
Usage example:
MxxRu::Cpp::composite_target {
global_obj_placement MxxRu::Cpp::PrjAwareRuntimeSubdirObjPlacement.new(
# Final resuls going here.
'bin32' )
required_prj 'so_5/prj.rb'
required_prj 'so_5/prj_s.rb'
...
}
The directory structure could looks like:
bin32/
`- _objs/
`- release/
`- so_5_prj_rb/
`- ...
`- so_5_prj_s_rb/
`- ...
`- release/
This ObjPlacement also allows to use toolset id in directory structure:
MxxRu::Cpp::composite_target {
global_obj_placement MxxRu::Cpp::PrjAwareRuntimeSubdirObjPlacement.new(
# Final resuls going here.
'bin32',
# Enable toolset identification
MxxRu::Cpp::PrjAwareRuntimeSubdirObjPlacement::USE_COMPILER_ID )
required_prj 'so_5/prj.rb'
required_prj 'so_5/prj_s.rb'
...
}
The directory structure could looks like:
bin32/
`- _objs/
`- gcc_4_8_2__x86_64_w64_mingw32/
`- release/
`- so_5_prj_rb/
`- ...
`- so_5_prj_s_rb/
`- ...
`- gcc_4_8_2__x86_64_w64_mingw32/
`- release/
Constant Summary collapse
- USE_COMPILER_ID =
true
- DO_NOT_USE_COMPILER_ID =
false
Instance Method Summary collapse
-
#get_dll(source_path_name, toolset, target) ⇒ Object
Returns final_results_path.
-
#get_exe(source_path_name, toolset, target) ⇒ Object
Returns final_results_path.
-
#get_lib(source_path_name, toolset, target) ⇒ Object
Returns final_results_path.
-
#get_mswin_res(source_path_name, toolset, target) ⇒ Object
Returns result of get_obj method.
-
#get_obj(source_path_name, toolset, target) ⇒ Object
Make name for obj file.
-
#initialize(final_results_path, use_compiler_id = DO_NOT_USE_COMPILER_ID) ⇒ PrjAwareRuntimeSubdirObjPlacement
constructor
Constructor.
Constructor Details
#initialize(final_results_path, use_compiler_id = DO_NOT_USE_COMPILER_ID) ⇒ PrjAwareRuntimeSubdirObjPlacement
Constructor
114 115 116 117 118 |
# File 'lib/mxx_ru/cpp/obj_placements/prj_aware_runtime_subdir.rb', line 114 def initialize( final_results_path, use_compiler_id = DO_NOT_USE_COMPILER_ID ) @final_results_path = final_results_path @intermediate_path = File.join( @final_results_path, '_objs' ) @use_compiler_id = use_compiler_id end |
Instance Method Details
#get_dll(source_path_name, toolset, target) ⇒ Object
Returns final_results_path
152 153 154 |
# File 'lib/mxx_ru/cpp/obj_placements/prj_aware_runtime_subdir.rb', line 152 def get_dll( source_path_name, toolset, target ) final_result_path_component( source_path_name, toolset, target ) end |
#get_exe(source_path_name, toolset, target) ⇒ Object
Returns final_results_path
157 158 159 |
# File 'lib/mxx_ru/cpp/obj_placements/prj_aware_runtime_subdir.rb', line 157 def get_exe( source_path_name, toolset, target ) final_result_path_component( source_path_name, toolset, target ) end |
#get_lib(source_path_name, toolset, target) ⇒ Object
Returns final_results_path
147 148 149 |
# File 'lib/mxx_ru/cpp/obj_placements/prj_aware_runtime_subdir.rb', line 147 def get_lib( source_path_name, toolset, target ) final_result_path_component( source_path_name, toolset, target ) end |
#get_mswin_res(source_path_name, toolset, target) ⇒ Object
Returns result of get_obj method.
142 143 144 |
# File 'lib/mxx_ru/cpp/obj_placements/prj_aware_runtime_subdir.rb', line 142 def get_mswin_res( source_path_name, toolset, target ) get_obj( source_path_name, toolset, target ) end |
#get_obj(source_path_name, toolset, target) ⇒ Object
Make name for obj file.
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 |
# File 'lib/mxx_ru/cpp/obj_placements/prj_aware_runtime_subdir.rb', line 121 def get_obj( source_path_name, toolset, target ) root_path = USE_COMPILER_ID == @use_compiler_id ? File.join( @intermediate_path, toolset.make_identification_string ) : @intermediate_path target_tmps = create_target_tmps_name( target ) result = if source_path_name && "" != source_path_name && "." != source_path_name File.join( root_path, runtime_mode_path( target ), target_tmps, transform_path( source_path_name ) ) else File.join( root_path, target_tmps, runtime_mode_path( target ) ) end MxxRu::Util.ensure_path_exists( result ) result end |