Class: Cxxproject::SharedLibrary

Inherits:
Linkable show all
Defined in:
lib/cxxproject/buildingblocks/linkable.rb

Constant Summary

Constants included from HasLibraries

HasLibraries::DEPENDENCY, HasLibraries::LIB, HasLibraries::LIB_WITH_PATH, HasLibraries::SEARCH_PATH, HasLibraries::USERLIB

Instance Attribute Summary collapse

Attributes included from HasSources

#file_dependencies, #incArray

Attributes inherited from BuildingBlock

#config_files, #config_name, #name, #output_dir, #output_dir_abs, #pre_step, #project_dir, #tags

Instance Method Summary collapse

Methods inherited from Linkable

#adapt_path, #calc_command_line, #cmd_lib_string, #collect_unique, #convert_to_rake, #create_run_task, #deps, #executable_name, #get_output_name, #get_task_name, #get_temp_filename, #handle_whole_archive, #initialize, #is_whole_archive, #linker_lib_string, #no_sources_found, #set_executable_name, #set_linker_script, #set_mapfile, #target_os

Methods included from HasIncludes

#includes, #local_includes, #set_includes, #set_local_includes

Methods included from HasSources

#add_to_sources_to_build, #apply_depfile, #calc_command_line_for_source, #calc_compiler_strings, #calc_dirs_with_files, #collect_sources_and_toolchains, #convert_depfile, #create_object_file_task, #create_object_file_tasks, #define_string, #deps_in_depFiles, #enhance_with_additional_files, #exclude_sources, #get_define_string, #get_dep_file, #get_include_string, #get_object_file, #get_source_type, #get_sources_task_name, #include_string, #no_sources_found, #parse_includes, #prepare_tasks_for_objects, #process_console_output, #set_exclude_sources, #set_source_patterns, #set_sources, #set_tcs4source, #source_patterns, #sources, #tcs4source

Methods included from HasLibraries

#add_lib_element, #add_lib_elements, #lib_elements

Methods inherited from BuildingBlock

#add_output_dir_dependency, #calc_complete_output_dir, #catch_output, #check_config_file, #complete_output_dir, #get_task_name, #has_tcs?, #initialize, #printCmd, #process_result, #read_file_or_empty_string, #remove_empty_strings_and_join, #set_config_files, #set_config_name, #set_name, #set_output_dir, #set_project_dir, #set_tcs, #setup_rake_dependencies, #tcs, #typed_file_task

Methods included from HasDependencies

#add_unique, #all_dependencies, #all_dependencies_recursive, #collect_dependencies, #convert_named_values_to_string, #dependencies, #direct_deps, #helper_dependencies, #resolve_by_name, #set_dependencies, #set_helper_dependencies

Constructor Details

This class inherits a constructor from Cxxproject::Linkable

Instance Attribute Details

#compatibilityObject

Returns the value of attribute compatibility.



301
302
303
# File 'lib/cxxproject/buildingblocks/linkable.rb', line 301

def compatibility
  @compatibility
end

#majorObject

Returns the value of attribute major.



299
300
301
# File 'lib/cxxproject/buildingblocks/linkable.rb', line 299

def major
  @major
end

#minorObject

Returns the value of attribute minor.



300
301
302
# File 'lib/cxxproject/buildingblocks/linkable.rb', line 300

def minor
  @minor
end

Instance Method Details

#add_grouping_tasks(shared_lib) ⇒ Object



339
340
341
342
343
344
# File 'lib/cxxproject/buildingblocks/linkable.rb', line 339

def add_grouping_tasks(shared_lib)
  namespace 'shared' do
    desc shared_lib
    task @name => shared_lib
  end
end

#additional_object_file_flagsObject



334
335
336
337
# File 'lib/cxxproject/buildingblocks/linkable.rb', line 334

def additional_object_file_flags
  linker = @tcs[:LINKER]
  linker[:ADDITIONAL_OBJECT_FILE_FLAGS][target_os()]
end

#additional_path_componentsObject



326
327
328
# File 'lib/cxxproject/buildingblocks/linkable.rb', line 326

def additional_path_components()
  ['libs']
end

#complete_initObject



303
304
305
306
307
308
309
310
311
# File 'lib/cxxproject/buildingblocks/linkable.rb', line 303

def complete_init()
  if @output_dir_abs
    add_lib_element(HasLibraries::LIB, @name, true)
    add_lib_element(HasLibraries::SEARCH_PATH, File.join(@output_dir, 'libs'), true)
  else
    add_lib_element(HasLibraries::LIB_WITH_PATH, File.join(@output_dir,"lib#{@name}.a"), true)
  end
  super
end

#get_flags_for_output(linker) ⇒ Object



313
314
315
# File 'lib/cxxproject/buildingblocks/linkable.rb', line 313

def get_flags_for_output(linker)
  [linker[:SHARED_FLAG]] + additional_linker_commands(linker) + [linker[:OUTPUT_FLAG]]
end

#get_output_prefix(linker) ⇒ Object



317
318
319
# File 'lib/cxxproject/buildingblocks/linkable.rb', line 317

def get_output_prefix(linker)
  linker[:OUTPUT_PREFIX][:SHARED_LIBRARY][target_os()]
end

#get_output_suffix(linker) ⇒ Object



321
322
323
324
# File 'lib/cxxproject/buildingblocks/linkable.rb', line 321

def get_output_suffix(linker)
  h = linker[:ADDITIONAL_COMMANDS][target_os()]
  "#{(h ? h.get_version_suffix(linker, self) : "")}#{shared_suffix linker}"
end

#get_rake_task_typeObject



330
331
332
# File 'lib/cxxproject/buildingblocks/linkable.rb', line 330

def get_rake_task_type
  Rake::Task::SHARED_LIBRARY
end

#shared_suffix(linker) ⇒ Object



346
347
348
# File 'lib/cxxproject/buildingblocks/linkable.rb', line 346

def shared_suffix(linker)
  linker[:OUTPUT_SUFFIX][:SHARED_LIBRARY][target_os()]
end