class MxxRu::Cpp::ToolsetRuntimeSubdirObjPlacement

The generator of folder name for compilation results, building a hierarchy of subfolders in a special folder, which name is choosen based on toolset and runtime mode.

For example, let src/lib/l.cpp and src/main/m.cpp files would be the sources of lib/l.lib library and m.exe application. If project is compiled in RELEASE mode, then following files would be created: toolset-id/release/src/lib/l.obj, toolset-id/release/src/main/m.obj, toolset-id/release/lib/l.lib and toolset-id/release/m.exe. Thus the presence of subfolders required will be supervised (for example, toolset-id/release/src/lib, toolset-id/release/src/main,…). If some subfolder doesn't exist, it will be created.

An example of usage:

MxxRu::Cpp::composite_target( MxxRu::BUILD_ROOT )
    global_obj_placement(
      MxxRu::Cpp::ToolsetRuntimeSubdirObjPlacement.new(
        "output" ) )

    required_prj( "src/lib/prj.rb" )
    required_prj( "src/main/prj.rb" )
  end
end

Public Class Methods

new( a_root_dir = nil, a_debug_subdir = "debug", a_default_subdir = "default", a_release_subdir = "release" ) click to toggle source

a_root_dir A folder, where subfolders for exact toolset and runtime-modes will be created. If contains nil, subfolders are created in current folder.

a_debug_subdir

Subfolder name for MxxRu::Cpp::RUNTIME_DEBUG mode.

a_default_subdir

Subfolder name for MxxRu::Cpp::RUNTIME_DEFAULT mode.

a_release_subdir

Subfolder name for MxxRu::Cpp::RUNTIME_RELEASE mode.

# File lib/mxx_ru/cpp/obj_placement.rb, line 357
def initialize(
  a_root_dir = nil,
  a_debug_subdir = "debug",
  a_default_subdir = "default",
  a_release_subdir = "release" )

  super( a_root_dir, a_debug_subdir, a_debug_subdir, a_release_subdir )
end

Public Instance Methods

get_obj( source_path_name, toolset, target ) click to toggle source
# File lib/mxx_ru/cpp/obj_placement.rb, line 366
def get_obj(
  source_path_name,
  toolset,
  target )

  if source_path_name &&
    "" != source_path_name &&
    "." != source_path_name
    result = File.join( @root_dir,
      toolset.make_identification_string,
      runtime_mode_path( target ),
      source_path_name )
  else
    result = File.join( @root_dir,
      toolset.make_identification_string,
      runtime_mode_path( target ) )
  end

  MxxRu::Util.ensure_path_exists( result )

  return result
end