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.
19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/mtbuild/toolchain.rb', line 19 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
14 15 16 |
# File 'lib/mtbuild/toolchain.rb', line 14 def output_decorator @output_decorator end |
#output_folder ⇒ Object
The toolchain’s output folder
7 8 9 |
# File 'lib/mtbuild/toolchain.rb', line 7 def output_folder @output_folder end |
#parent_configuration ⇒ Object
parent configuration
17 18 19 |
# File 'lib/mtbuild/toolchain.rb', line 17 def parent_configuration @parent_configuration end |
#project_folder ⇒ Object
The project’s folder. Relative path references are interpreted as relative to this folder.
11 12 13 |
# File 'lib/mtbuild/toolchain.rb', line 11 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
49 50 51 52 |
# File 'lib/mtbuild/toolchain.rb', line 49 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
55 56 57 58 |
# File 'lib/mtbuild/toolchain.rb', line 55 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
61 62 63 64 |
# File 'lib/mtbuild/toolchain.rb', line 61 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
81 82 83 |
# File 'lib/mtbuild/toolchain.rb', line 81 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
71 72 73 |
# File 'lib/mtbuild/toolchain.rb', line 71 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
76 77 78 |
# File 'lib/mtbuild/toolchain.rb', line 76 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
34 35 36 |
# File 'lib/mtbuild/toolchain.rb', line 34 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
39 40 41 |
# File 'lib/mtbuild/toolchain.rb', line 39 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
44 45 46 |
# File 'lib/mtbuild/toolchain.rb', line 44 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
67 68 |
# File 'lib/mtbuild/toolchain.rb', line 67 def scan_sources(source_files) end |