Class: MxxRu::Cpp::ToolsetRuntimeSubdirObjPlacement

Inherits:
RuntimeSubdirObjPlacement show all
Defined in:
lib/mxx_ru/cpp/obj_placement.rb

Overview

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

Instance Attribute Summary

Attributes inherited from RuntimeSubdirObjPlacement

#debug_subdir, #default_subdir, #release_subdir, #root_dir

Instance Method Summary collapse

Methods inherited from RuntimeSubdirObjPlacement

#get_dll, #get_exe, #get_lib, #get_mswin_res

Methods inherited from ObjPlacement

#get_dll, #get_exe, #get_lib, #get_mswin_res

Constructor Details

#initialize(a_root_dir = nil, a_debug_subdir = "debug", a_default_subdir = "default", a_release_subdir = "release") ⇒ ToolsetRuntimeSubdirObjPlacement

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.



357
358
359
360
361
362
363
364
# 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

Instance Method Details

#get_obj(source_path_name, toolset, target) ⇒ Object



366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
# 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