Class: MTBuild::Toolchain
- Inherits:
-
Object
- Object
- MTBuild::Toolchain
- Includes:
- Rake::DSL
- Defined in:
- lib/mtbuild/toolchain.rb
Overview
This is the base class for all toolchain types.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#output_decorator ⇒ Object
Text to append to the name of output files.
-
#output_folder ⇒ Object
The toolchain’s output folder.
-
#parent_configuration ⇒ Object
parent configuration.
-
#project_folder ⇒ Object
The project’s folder.
Instance Method Summary collapse
-
#add_include_objects(include_objects) ⇒ Object
Add an additional object to the list of additional objects to link with.
-
#add_include_paths(include_paths) ⇒ Object
Add an include path to the list of include paths to compile with.
-
#add_library_paths(library_paths) ⇒ Object
Add a library path to the list of library paths to link with.
-
#create_application_tasks(objects, executable_name) ⇒ Object
Create Rake tasks for linking.
-
#create_compile_tasks(source_files) ⇒ Object
Create Rake tasks for compilation.
-
#create_static_library_tasks(objects, library_name) ⇒ Object
Create Rake tasks for archival.
-
#get_include_objects ⇒ Object
Retrieve a list of additional objects to link with.
-
#get_include_paths ⇒ Object
Retrieve a list of include paths to compile with.
-
#get_library_paths ⇒ Object
Retrieve a list of library paths to link with.
-
#initialize(parent_configuration, toolchain_configuration) ⇒ Toolchain
constructor
A new instance of Toolchain.
-
#scan_sources(source_files) ⇒ Object
Scan source files for any special processing needs.
Methods included from Rake::DSL
#application_task, #framework_task, #static_library_task, #test_application_task
Constructor Details
#initialize(parent_configuration, toolchain_configuration) ⇒ Toolchain
Returns a new instance of Toolchain.
21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/mtbuild/toolchain.rb', line 21 def initialize(parent_configuration, toolchain_configuration) @output_folder = '' @project_folder = '' @output_decorator = '' @include_objects = [] @include_paths = [] @library_paths = [] @parent_configuration = parent_configuration add_include_paths((toolchain_configuration.fetch(:include_paths, []))) add_include_objects((toolchain_configuration.fetch(:include_objects, []))) add_library_paths((toolchain_configuration.fetch(:library_paths, []))) end |
Instance Attribute Details
#output_decorator ⇒ Object
Text to append to the name of output files
16 17 18 |
# File 'lib/mtbuild/toolchain.rb', line 16 def output_decorator @output_decorator end |
#output_folder ⇒ Object
The toolchain’s output folder
9 10 11 |
# File 'lib/mtbuild/toolchain.rb', line 9 def output_folder @output_folder end |
#parent_configuration ⇒ Object
parent configuration
19 20 21 |
# File 'lib/mtbuild/toolchain.rb', line 19 def parent_configuration @parent_configuration end |
#project_folder ⇒ Object
The project’s folder. Relative path references are interpreted as relative to this folder.
13 14 15 |
# File 'lib/mtbuild/toolchain.rb', line 13 def project_folder @project_folder end |
Instance Method Details
#add_include_objects(include_objects) ⇒ Object
Add an additional object to the list of additional objects to link with
51 52 53 54 |
# File 'lib/mtbuild/toolchain.rb', line 51 def add_include_objects(include_objects) include_objects = Utils.ensure_array(include_objects).to_a.flatten @include_objects |= include_objects end |
#add_include_paths(include_paths) ⇒ Object
Add an include path to the list of include paths to compile with
57 58 59 60 |
# File 'lib/mtbuild/toolchain.rb', line 57 def add_include_paths(include_paths) include_paths = Utils.ensure_array(include_paths).to_a.flatten @include_paths |= include_paths end |
#add_library_paths(library_paths) ⇒ Object
Add a library path to the list of library paths to link with
63 64 65 66 |
# File 'lib/mtbuild/toolchain.rb', line 63 def add_library_paths(library_paths) library_paths = Utils.ensure_array(library_paths).to_a.flatten @library_paths |= library_paths end |
#create_application_tasks(objects, executable_name) ⇒ Object
Create Rake tasks for linking
83 84 85 |
# File 'lib/mtbuild/toolchain.rb', line 83 def create_application_tasks(objects, executable_name) fail "Toolchain didn't provide create_executable_tasks" end |
#create_compile_tasks(source_files) ⇒ Object
Create Rake tasks for compilation
73 74 75 |
# File 'lib/mtbuild/toolchain.rb', line 73 def create_compile_tasks(source_files) fail "Toolchain didn't provide create_compile_tasks" end |
#create_static_library_tasks(objects, library_name) ⇒ Object
Create Rake tasks for archival
78 79 80 |
# File 'lib/mtbuild/toolchain.rb', line 78 def create_static_library_tasks(objects, library_name) fail "Toolchain didn't provide create_static_library_tasks" end |
#get_include_objects ⇒ Object
Retrieve a list of additional objects to link with
36 37 38 |
# File 'lib/mtbuild/toolchain.rb', line 36 def get_include_objects @include_objects.collect {|i| File.(i.gsub('$(PROJECT_DIR)', @project_folder))} end |
#get_include_paths ⇒ Object
Retrieve a list of include paths to compile with
41 42 43 |
# File 'lib/mtbuild/toolchain.rb', line 41 def get_include_paths @include_paths.collect {|i| File.(i.gsub('$(PROJECT_DIR)', @project_folder))} end |
#get_library_paths ⇒ Object
Retrieve a list of library paths to link with
46 47 48 |
# File 'lib/mtbuild/toolchain.rb', line 46 def get_library_paths @library_paths.collect {|i| File.(i.gsub('$(PROJECT_DIR)', @project_folder))} end |
#scan_sources(source_files) ⇒ Object
Scan source files for any special processing needs
69 70 |
# File 'lib/mtbuild/toolchain.rb', line 69 def scan_sources(source_files) end |