Class: MTBuild::StaticLibraryConfiguration
- Inherits:
-
CompiledConfiguration
- Object
- Configuration
- CompiledConfiguration
- MTBuild::StaticLibraryConfiguration
- Defined in:
- lib/mtbuild/staticlibrary_configuration.rb
Overview
Use this class to create static library configurations. You won’t typically instantiate this directly. Instead, the StaticLibraryProject.add_configuration method will create this for you.
Instance Attribute Summary
Attributes inherited from CompiledConfiguration
#dependencies, #source_files, #tests
Attributes inherited from Configuration
#configuration_name, #output_folder, #parent_project, #project_folder
Instance Method Summary collapse
-
#configure_tasks ⇒ Object
Create the actual Rake tasks that will perform the configuration’s work.
-
#initialize(parent_project, output_folder, configuration_name, configuration, api_headers) ⇒ StaticLibraryConfiguration
constructor
A new instance of StaticLibraryConfiguration.
Methods inherited from CompiledConfiguration
Methods included from Rake::DSL
#application_task, #framework_task, #static_library_task, #test_application_task
Constructor Details
#initialize(parent_project, output_folder, configuration_name, configuration, api_headers) ⇒ StaticLibraryConfiguration
Returns a new instance of StaticLibraryConfiguration.
9 10 11 12 13 |
# File 'lib/mtbuild/staticlibrary_configuration.rb', line 9 def initialize(parent_project, output_folder, configuration_name, configuration, api_headers) @api_headers = api_headers super parent_project, output_folder, configuration_name, configuration @configuration_headers = Utils.(configuration.fetch(:configuration_headers, []), @project_folder) end |
Instance Method Details
#configure_tasks ⇒ Object
Create the actual Rake tasks that will perform the configuration’s work
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/mtbuild/staticlibrary_configuration.rb', line 16 def configure_tasks super all_object_files = [] all_object_folders = [] @toolchains.each do |toolchain, sources| toolchain.add_include_paths(@api_headers+@configuration_headers) object_files, object_folders = toolchain.create_compile_tasks(sources) all_object_files |= object_files all_object_folders |= object_folders end project_filename = @parent_project.project_name.to_s.gsub(':','-') library_files, library_folders = @default_toolchain.create_static_library_tasks(all_object_files, project_filename) dependencies = @dependencies+all_object_folders+library_folders+library_files desc "Build library '#{@parent_project.project_name}' with configuration '#{@configuration_name}'" new_task = static_library_task @configuration_name => dependencies do |t| @post_build.call if @post_build.respond_to? :call puts "built library #{t.name}." @tests.each do |test| if Rake::Task.task_defined? test Rake::Task[test].invoke else $stderr.puts "warning: Skipping unknown test '#{test}'" end end end new_task.api_headers = @api_headers new_task.configuration_headers = @configuration_headers new_task.library_files = library_files end |