Class: MxxRu::Cpp::CustomSubdirObjPlacement

Inherits:
ObjPlacement show all
Defined in:
lib/mxx_ru/cpp/obj_placements/custom_subdir.rb

Overview

Analog of RuntimeSubdirObjPlacement, but allow to specify paths for final results (EXE, LIB, DLL) and intermediate files (OBJ, RES). Unlike RuntimeSubdirObjPlacement these paths are independent of runtime_mode.

Example:

MxxRu::Cpp::composite_target {
  global_obj_placement MxxRu::Cpp::CustomSubdirObjPlacement.new(
    # Final resuls going here.
    'bin32',
    # All intermediate files going here.
    'tmp/output32' )

  required_prj ...
}

If this composite project will be applied for project structure:

prj_1/
`- src/
prj_2/
`- module_1/
`- module_2/

Then after build project structructure will be:

prj_1/
`- src/
prj_2/
`- module_1/
`- module_2/
bin32/
tmp/
`- output32/
   `- prj_1/
   |  `- src/
   `- prj_2/
      `- module_1/
      `- module_2/

Instance Method Summary collapse

Constructor Details

#initialize(final_results_path, intermediate_path) ⇒ CustomSubdirObjPlacement

Constructor

final_results_path

path for storing final results (EXE, LIB/A, DLL/SO).

intermediate_path

path for storing intermediate files (OBJ/O, RES).



77
78
79
80
# File 'lib/mxx_ru/cpp/obj_placements/custom_subdir.rb', line 77

def initialize( final_results_path, intermediate_path )
  @final_results_path = final_results_path
  @intermediate_path = intermediate_path
end

Instance Method Details

#get_dll(source_path_name, toolset, target) ⇒ Object

Returns final_results_path



120
121
122
123
124
125
126
# File 'lib/mxx_ru/cpp/obj_placements/custom_subdir.rb', line 120

def get_dll(
  source_path_name,
  toolset,
  target )

  final_result_path_component( source_path_name )
end

#get_exe(source_path_name, toolset, target) ⇒ Object

Returns final_results_path



129
130
131
132
133
134
135
# File 'lib/mxx_ru/cpp/obj_placements/custom_subdir.rb', line 129

def get_exe(
  source_path_name,
  toolset,
  target )

  final_result_path_component( source_path_name )
end

#get_lib(source_path_name, toolset, target) ⇒ Object

Returns final_results_path



111
112
113
114
115
116
117
# File 'lib/mxx_ru/cpp/obj_placements/custom_subdir.rb', line 111

def get_lib(
  source_path_name,
  toolset,
  target )

  final_result_path_component( source_path_name )
end

#get_mswin_res(source_path_name, toolset, target) ⇒ Object

Returns result of get_obj method.



102
103
104
105
106
107
108
# File 'lib/mxx_ru/cpp/obj_placements/custom_subdir.rb', line 102

def get_mswin_res(
  source_path_name,
  toolset,
  target )

  return get_obj( source_path_name, toolset, target )
end

#get_obj(source_path_name, toolset, target) ⇒ Object

Make name for obj file.



83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/mxx_ru/cpp/obj_placements/custom_subdir.rb', line 83

def get_obj(
  source_path_name,
  toolset,
  target )

  if source_path_name &&
    "" != source_path_name &&
    "." != source_path_name
    result = File.join( @intermediate_path, source_path_name )
  else
    result = @intermediate_path
  end

  MxxRu::Util.ensure_path_exists( result )

  return result
end