class MxxRu::Cpp::CustomSubdirObjPlacement

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/

Public Class Methods

new( final_results_path, intermediate_path ) click to toggle source

Constructor

final_results_path

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

intermediate_path

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

# 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

Public Instance Methods

get_dll( source_path_name, toolset, target ) click to toggle source

Returns final_results_path

# 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 ) click to toggle source

Returns final_results_path

# 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 ) click to toggle source

Returns final_results_path

# 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 ) click to toggle source

Returns result of get_obj method.

# 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 ) click to toggle source

Make name for obj file.

# 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

Protected Instance Methods

final_result_path_component( target_root ) click to toggle source

Make final_results_path if needed and return name of it

# File lib/mxx_ru/cpp/obj_placements/custom_subdir.rb, line 139
def final_result_path_component( target_root )
  r = @final_results_path
  r = File.join( @final_results_path, target_root ) if
      target_root and target_root.size
  MxxRu::Util::ensure_path_exists( r )
  r
end