Class: MxxRu::Cpp::RuntimeSubdirObjPlacement
- Inherits:
-
ObjPlacement
- Object
- ObjPlacement
- MxxRu::Cpp::RuntimeSubdirObjPlacement
- 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 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: release/src/lib/l.obj, release/src/main/m.obj, release/lib/l.lib and release/m.exe. Thus the presence of subfolders required will be supervised (for example, release/src/lib, release/src/main,…). If some subfolder doesn’t exist, it will be created.
An example of usage:
class Build < MxxRu::Cpp::Composite_target
def initialize( a_alias = MxxRu::BUILD_ROOT )
global_obj_placement(
MxxRu::Cpp::RuntimeSubdirObjPlacement.new(
"output" ) )
required_prj( "src/lib/prj.rb" )
required_prj( "src/main/prj.rb" )
end
end
Instance Attribute Summary collapse
-
#debug_subdir ⇒ Object
readonly
A name of subfolder, which will ve created in a root_dir for MxxRu::Cpp::RUNTIME_DEBUG mode.
-
#default_subdir ⇒ Object
readonly
A name of subfolder, which will ve created in a root_dir for MxxRu::Cpp::RUNTIME_DEFAULT mode.
-
#release_subdir ⇒ Object
readonly
A name of subfolder, which will ve created in a root_dir for MxxRu::Cpp::RUNTIME_RELEASE mode.
-
#root_dir ⇒ Object
readonly
Folder name, where subfolders for exact runtime-modes will be created.
Instance Method Summary collapse
-
#get_dll(source_path_name, toolset, target) ⇒ Object
Returns result of get_obj method.
-
#get_exe(source_path_name, toolset, target) ⇒ Object
Returns result of get_obj method.
-
#get_lib(source_path_name, toolset, target) ⇒ Object
Returns result of get_obj method.
-
#get_mswin_res(source_path_name, toolset, target) ⇒ Object
Returns result of get_obj method.
-
#get_obj(source_path_name, toolset, target) ⇒ Object
It’s the only method running something.
-
#initialize(a_root_dir = nil, a_debug_subdir = "debug", a_default_subdir = "default", a_release_subdir = "release") ⇒ RuntimeSubdirObjPlacement
constructor
a_root_dir A folder, where subfolders for exact runtime-modes will be created.
Constructor Details
#initialize(a_root_dir = nil, a_debug_subdir = "debug", a_default_subdir = "default", a_release_subdir = "release") ⇒ RuntimeSubdirObjPlacement
a_root_dir A folder, where subfolders for exact 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.
227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 |
# File 'lib/mxx_ru/cpp/obj_placement.rb', line 227 def initialize( a_root_dir = nil, a_debug_subdir = "debug", a_default_subdir = "default", a_release_subdir = "release" ) if a_root_dir @root_dir = a_root_dir else @root_dir = "./" end @debug_subdir = a_debug_subdir @default_subdir = a_default_subdir @release_subdir = a_release_subdir end |
Instance Attribute Details
#debug_subdir ⇒ Object (readonly)
A name of subfolder, which will ve created in a root_dir for MxxRu::Cpp::RUNTIME_DEBUG mode.
212 213 214 |
# File 'lib/mxx_ru/cpp/obj_placement.rb', line 212 def debug_subdir @debug_subdir end |
#default_subdir ⇒ Object (readonly)
A name of subfolder, which will ve created in a root_dir for MxxRu::Cpp::RUNTIME_DEFAULT mode.
215 216 217 |
# File 'lib/mxx_ru/cpp/obj_placement.rb', line 215 def default_subdir @default_subdir end |
#release_subdir ⇒ Object (readonly)
A name of subfolder, which will ve created in a root_dir for MxxRu::Cpp::RUNTIME_RELEASE mode.
218 219 220 |
# File 'lib/mxx_ru/cpp/obj_placement.rb', line 218 def release_subdir @release_subdir end |
#root_dir ⇒ Object (readonly)
Folder name, where subfolders for exact runtime-modes will be created.
209 210 211 |
# File 'lib/mxx_ru/cpp/obj_placement.rb', line 209 def root_dir @root_dir end |
Instance Method Details
#get_dll(source_path_name, toolset, target) ⇒ Object
Returns result of get_obj method.
283 284 285 286 287 288 289 |
# File 'lib/mxx_ru/cpp/obj_placement.rb', line 283 def get_dll( source_path_name, toolset, target ) return get_obj( source_path_name, toolset, target ) end |
#get_exe(source_path_name, toolset, target) ⇒ Object
Returns result of get_obj method.
292 293 294 295 296 297 298 |
# File 'lib/mxx_ru/cpp/obj_placement.rb', line 292 def get_exe( source_path_name, toolset, target ) return get_obj( source_path_name, toolset, target ) end |
#get_lib(source_path_name, toolset, target) ⇒ Object
Returns result of get_obj method.
274 275 276 277 278 279 280 |
# File 'lib/mxx_ru/cpp/obj_placement.rb', line 274 def get_lib( source_path_name, toolset, target ) return get_obj( source_path_name, toolset, target ) end |
#get_mswin_res(source_path_name, toolset, target) ⇒ Object
Returns result of get_obj method.
265 266 267 268 269 270 271 |
# File 'lib/mxx_ru/cpp/obj_placement.rb', line 265 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
It’s the only method running something.
245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 |
# File 'lib/mxx_ru/cpp/obj_placement.rb', line 245 def get_obj( source_path_name, toolset, target ) if source_path_name && "" != source_path_name && "." != source_path_name result = File.join( @root_dir, runtime_mode_path( target ), source_path_name ) else result = File.join( @root_dir, runtime_mode_path( target ) ) end MxxRu::Util.ensure_path_exists( result ) return result end |