ritsu 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +96 -0
 - data/Thorfile +95 -0
 - data/VERSION +1 -0
 - data/bin/ritsu +32 -0
 - data/lib/ritsu/block.rb +259 -0
 - data/lib/ritsu/ext/test_case.rb +20 -0
 - data/lib/ritsu/external_library.rb +47 -0
 - data/lib/ritsu/project.rb +89 -0
 - data/lib/ritsu/project_generator.rb +34 -0
 - data/lib/ritsu/project_generators/default_generator.rb +73 -0
 - data/lib/ritsu/project_generators/default_generator_files/Thorfile.erb +9 -0
 - data/lib/ritsu/project_generators/default_generator_files/meta/project.rb.erb +9 -0
 - data/lib/ritsu/project_generators.rb +1 -0
 - data/lib/ritsu/src_file.rb +76 -0
 - data/lib/ritsu/src_files/cpp_file.rb +33 -0
 - data/lib/ritsu/src_files/cpp_file_mixin.rb +13 -0
 - data/lib/ritsu/src_files/executable_cmake_lists.rb +40 -0
 - data/lib/ritsu/src_files/header_file.rb +46 -0
 - data/lib/ritsu/src_files/header_file_mixin.rb +20 -0
 - data/lib/ritsu/src_files/project_cmake_lists.rb +110 -0
 - data/lib/ritsu/src_files/project_config_header_file.rb +15 -0
 - data/lib/ritsu/src_files/project_config_header_template_file.rb +46 -0
 - data/lib/ritsu/src_files/shared_library_cmake_lists.rb +40 -0
 - data/lib/ritsu/src_files/static_library_cmake_lists.rb +40 -0
 - data/lib/ritsu/src_files/target_cmake_lists.rb +159 -0
 - data/lib/ritsu/src_files/templated_src_file.rb +44 -0
 - data/lib/ritsu/src_files.rb +14 -0
 - data/lib/ritsu/target.rb +134 -0
 - data/lib/ritsu/targets/executable.rb +45 -0
 - data/lib/ritsu/targets/library.rb +29 -0
 - data/lib/ritsu/targets/shared_library.rb +39 -0
 - data/lib/ritsu/targets/static_library.rb +33 -0
 - data/lib/ritsu/targets.rb +4 -0
 - data/lib/ritsu/template.rb +69 -0
 - data/lib/ritsu/template_policies.rb +133 -0
 - data/lib/ritsu/test_helpers.rb +124 -0
 - data/lib/ritsu/thors/default_thor.rb +57 -0
 - data/lib/ritsu/thors.rb +1 -0
 - data/lib/ritsu/utility/accessors.rb +30 -0
 - data/lib/ritsu/utility/check_upon_add_set.rb +35 -0
 - data/lib/ritsu/utility/file_robot.rb +129 -0
 - data/lib/ritsu/utility/files.rb +13 -0
 - data/lib/ritsu/utility/instance_dependencies.rb +113 -0
 - data/lib/ritsu/utility/instance_set.rb +29 -0
 - data/lib/ritsu/utility/platform.rb +21 -0
 - data/lib/ritsu/utility/simple_io.rb +65 -0
 - data/lib/ritsu/utility/single_instance.rb +34 -0
 - data/lib/ritsu/utility/strings.rb +41 -0
 - data/lib/ritsu/utility.rb +8 -0
 - data/lib/ritsu.rb +17 -0
 - data/test/ritsu/block_test.rb +197 -0
 - data/test/ritsu/external_library_test.rb +42 -0
 - data/test/ritsu/project_generators/default_generator_test.rb +34 -0
 - data/test/ritsu/project_test.rb +128 -0
 - data/test/ritsu/src_file_test.rb +70 -0
 - data/test/ritsu/src_files/cpp_file_test.rb +43 -0
 - data/test/ritsu/src_files/executable_cmake_lists_test.rb +52 -0
 - data/test/ritsu/src_files/header_file_test.rb +58 -0
 - data/test/ritsu/src_files/project_cmake_lists_test.rb +152 -0
 - data/test/ritsu/src_files/shared_library_cmake_lists_test.rb +52 -0
 - data/test/ritsu/src_files/static_library_cmake_lists_test.rb +52 -0
 - data/test/ritsu/src_files/target_cmake_lists_test.rb +16 -0
 - data/test/ritsu/target_test.rb +106 -0
 - data/test/ritsu/targets/executable_test.rb +11 -0
 - data/test/ritsu/targets/shared_library_test.rb +11 -0
 - data/test/ritsu/targets/static_library_test.rb +11 -0
 - data/test/ritsu/template_policies_test.rb +0 -0
 - data/test/ritsu/utility/accessors_test.rb +15 -0
 - data/test/ritsu/utility/check_upon_add_set_test.rb +32 -0
 - data/test/ritsu/utility/file_robot_test.rb +176 -0
 - data/test/ritsu/utility/strings_test.rb +29 -0
 - data/test/test_helpers.rb +4 -0
 - metadata +209 -0
 
| 
         @@ -0,0 +1,73 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'rubygems'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'singleton'
         
     | 
| 
      
 3 
     | 
    
         
            +
            require 'erb'
         
     | 
| 
      
 4 
     | 
    
         
            +
            require 'active_support/core_ext/string/inflections'
         
     | 
| 
      
 5 
     | 
    
         
            +
            require File.dirname(__FILE__) + '/../project_generator'
         
     | 
| 
      
 6 
     | 
    
         
            +
            require File.dirname(__FILE__) + '/../utility/file_robot'
         
     | 
| 
      
 7 
     | 
    
         
            +
            require File.dirname(__FILE__) + '/../utility/files'
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            module Ritsu
         
     | 
| 
      
 10 
     | 
    
         
            +
              module ProjectGenerators
         
     | 
| 
      
 11 
     | 
    
         
            +
                class DefaultGenerator < Ritsu::ProjectGenerator
         
     | 
| 
      
 12 
     | 
    
         
            +
                  include Ritsu::Utility
         
     | 
| 
      
 13 
     | 
    
         
            +
                  
         
     | 
| 
      
 14 
     | 
    
         
            +
                  Ritsu::ProjectGenerator.generator_classes["default"] = self
         
     | 
| 
      
 15 
     | 
    
         
            +
                      
         
     | 
| 
      
 16 
     | 
    
         
            +
                  def initialize
         
     | 
| 
      
 17 
     | 
    
         
            +
                    super("default")
         
     | 
| 
      
 18 
     | 
    
         
            +
                  end
         
     | 
| 
      
 19 
     | 
    
         
            +
                
         
     | 
| 
      
 20 
     | 
    
         
            +
                  def source_dir
         
     | 
| 
      
 21 
     | 
    
         
            +
                    File.dirname(__FILE__) + "/default_generator_files"
         
     | 
| 
      
 22 
     | 
    
         
            +
                  end
         
     | 
| 
      
 23 
     | 
    
         
            +
                
         
     | 
| 
      
 24 
     | 
    
         
            +
                  def source_path(path)
         
     | 
| 
      
 25 
     | 
    
         
            +
                    source_dir + "/" + path
         
     | 
| 
      
 26 
     | 
    
         
            +
                  end
         
     | 
| 
      
 27 
     | 
    
         
            +
                
         
     | 
| 
      
 28 
     | 
    
         
            +
                  def target_dir
         
     | 
| 
      
 29 
     | 
    
         
            +
                    return @location + "/" + @project_name
         
     | 
| 
      
 30 
     | 
    
         
            +
                  end
         
     | 
| 
      
 31 
     | 
    
         
            +
                
         
     | 
| 
      
 32 
     | 
    
         
            +
                  def target_path(path)
         
     | 
| 
      
 33 
     | 
    
         
            +
                    target_dir + "/" + path
         
     | 
| 
      
 34 
     | 
    
         
            +
                  end
         
     | 
| 
      
 35 
     | 
    
         
            +
                
         
     | 
| 
      
 36 
     | 
    
         
            +
                  def create_dir(dirname)
         
     | 
| 
      
 37 
     | 
    
         
            +
                    FileRobot.create_dir(target_path(dirname))
         
     | 
| 
      
 38 
     | 
    
         
            +
                  end
         
     | 
| 
      
 39 
     | 
    
         
            +
                
         
     | 
| 
      
 40 
     | 
    
         
            +
                  def create_file(filename, content)
         
     | 
| 
      
 41 
     | 
    
         
            +
                    FileRobot.create_file(target_path(filename), content)
         
     | 
| 
      
 42 
     | 
    
         
            +
                  end
         
     | 
| 
      
 43 
     | 
    
         
            +
                
         
     | 
| 
      
 44 
     | 
    
         
            +
                  def create_file_from_erb(filename)
         
     | 
| 
      
 45 
     | 
    
         
            +
                    template_filename = source_path(filename + ".erb")
         
     | 
| 
      
 46 
     | 
    
         
            +
                    template_content = Files.read(template_filename)
         
     | 
| 
      
 47 
     | 
    
         
            +
                    template = ERB.new(template_content)
         
     | 
| 
      
 48 
     | 
    
         
            +
                    create_file(filename, template.result(binding))
         
     | 
| 
      
 49 
     | 
    
         
            +
                  end
         
     | 
| 
      
 50 
     | 
    
         
            +
                
         
     | 
| 
      
 51 
     | 
    
         
            +
                  def copy_file(filename)
         
     | 
| 
      
 52 
     | 
    
         
            +
                    source_filename = source_path(filename)
         
     | 
| 
      
 53 
     | 
    
         
            +
                    source_content = Files.read(source_filename)
         
     | 
| 
      
 54 
     | 
    
         
            +
                    create_file(filename, source_content)
         
     | 
| 
      
 55 
     | 
    
         
            +
                  end
         
     | 
| 
      
 56 
     | 
    
         
            +
                
         
     | 
| 
      
 57 
     | 
    
         
            +
                  def generate(project_name, location, options={})
         
     | 
| 
      
 58 
     | 
    
         
            +
                    @location = File.expand_path(location)
         
     | 
| 
      
 59 
     | 
    
         
            +
                    @project_name = project_name
         
     | 
| 
      
 60 
     | 
    
         
            +
                  
         
     | 
| 
      
 61 
     | 
    
         
            +
                    create_dir("")
         
     | 
| 
      
 62 
     | 
    
         
            +
                  
         
     | 
| 
      
 63 
     | 
    
         
            +
                    create_dir("build")
         
     | 
| 
      
 64 
     | 
    
         
            +
                    create_dir("meta")
         
     | 
| 
      
 65 
     | 
    
         
            +
                    create_dir("src")
         
     | 
| 
      
 66 
     | 
    
         
            +
                    create_dir("src/cmake_modules")
         
     | 
| 
      
 67 
     | 
    
         
            +
                  
         
     | 
| 
      
 68 
     | 
    
         
            +
                    create_file_from_erb("Thorfile")
         
     | 
| 
      
 69 
     | 
    
         
            +
                    create_file_from_erb("meta/project.rb")
         
     | 
| 
      
 70 
     | 
    
         
            +
                  end
         
     | 
| 
      
 71 
     | 
    
         
            +
                end
         
     | 
| 
      
 72 
     | 
    
         
            +
              end
         
     | 
| 
      
 73 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require File.dirname(__FILE__) + '/project_generators/default_generator'
         
     | 
| 
         @@ -0,0 +1,76 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'rubygems'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'active_support'
         
     | 
| 
      
 3 
     | 
    
         
            +
            require File.dirname(__FILE__) + '/utility/instance_set'
         
     | 
| 
      
 4 
     | 
    
         
            +
            require File.dirname(__FILE__) + '/utility/file_robot'
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            module Ritsu
         
     | 
| 
      
 7 
     | 
    
         
            +
              class SrcFile
         
     | 
| 
      
 8 
     | 
    
         
            +
                include Ritsu::Utility::InstanceSet
         
     | 
| 
      
 9 
     | 
    
         
            +
                include Ritsu::Utility
         
     | 
| 
      
 10 
     | 
    
         
            +
                
         
     | 
| 
      
 11 
     | 
    
         
            +
                attr_reader :src_path
         
     | 
| 
      
 12 
     | 
    
         
            +
                attr_reader :owner
         
     | 
| 
      
 13 
     | 
    
         
            +
                
         
     | 
| 
      
 14 
     | 
    
         
            +
                def self.is_valid_src_path?(p)
         
     | 
| 
      
 15 
     | 
    
         
            +
                  p =~ /^[A-Za-z0-9_.][A-Za-z0-9_.\-\/]*$/
         
     | 
| 
      
 16 
     | 
    
         
            +
                end
         
     | 
| 
      
 17 
     | 
    
         
            +
                    
         
     | 
| 
      
 18 
     | 
    
         
            +
                def initialize(src_path, owner)
         
     | 
| 
      
 19 
     | 
    
         
            +
                  if !(self.class.is_valid_src_path?(src_path))
         
     | 
| 
      
 20 
     | 
    
         
            +
                    raise ArgumentError.new "'#{src_path}' is not a valid source path"
         
     | 
| 
      
 21 
     | 
    
         
            +
                  end
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
                  @src_path = src_path
         
     | 
| 
      
 24 
     | 
    
         
            +
                  @owner = owner
         
     | 
| 
      
 25 
     | 
    
         
            +
                  
         
     | 
| 
      
 26 
     | 
    
         
            +
                  SrcFile.instances << self
         
     | 
| 
      
 27 
     | 
    
         
            +
                  @owner.src_files << self
         
     | 
| 
      
 28 
     | 
    
         
            +
                end
         
     | 
| 
      
 29 
     | 
    
         
            +
                
         
     | 
| 
      
 30 
     | 
    
         
            +
                def self.validate_instance(instance)
         
     | 
| 
      
 31 
     | 
    
         
            +
                  if instances.select { |x| x.src_path == instance.src_path }.length > 0
         
     | 
| 
      
 32 
     | 
    
         
            +
                    raise ArgumentError.new "source file with path '#{instance.src_path}' already exists"
         
     | 
| 
      
 33 
     | 
    
         
            +
                  end
         
     | 
| 
      
 34 
     | 
    
         
            +
                end
         
     | 
| 
      
 35 
     | 
    
         
            +
                
         
     | 
| 
      
 36 
     | 
    
         
            +
                def project
         
     | 
| 
      
 37 
     | 
    
         
            +
                  owner.project
         
     | 
| 
      
 38 
     | 
    
         
            +
                end
         
     | 
| 
      
 39 
     | 
    
         
            +
                
         
     | 
| 
      
 40 
     | 
    
         
            +
                def abs_path
         
     | 
| 
      
 41 
     | 
    
         
            +
                  File.expand_path(project.project_dir + "/src/" + src_path)
         
     | 
| 
      
 42 
     | 
    
         
            +
                end
         
     | 
| 
      
 43 
     | 
    
         
            +
                
         
     | 
| 
      
 44 
     | 
    
         
            +
                def create
         
     | 
| 
      
 45 
     | 
    
         
            +
                  FileRobot.create_file(abs_path, "\n")
         
     | 
| 
      
 46 
     | 
    
         
            +
                end
         
     | 
| 
      
 47 
     | 
    
         
            +
                
         
     | 
| 
      
 48 
     | 
    
         
            +
                def update
         
     | 
| 
      
 49 
     | 
    
         
            +
                  if !File.exists?(abs_path)
         
     | 
| 
      
 50 
     | 
    
         
            +
                    create
         
     | 
| 
      
 51 
     | 
    
         
            +
                  else
         
     | 
| 
      
 52 
     | 
    
         
            +
                    update_content
         
     | 
| 
      
 53 
     | 
    
         
            +
                  end
         
     | 
| 
      
 54 
     | 
    
         
            +
                end
         
     | 
| 
      
 55 
     | 
    
         
            +
                
         
     | 
| 
      
 56 
     | 
    
         
            +
                def update_content
         
     | 
| 
      
 57 
     | 
    
         
            +
                end
         
     | 
| 
      
 58 
     | 
    
         
            +
                
         
     | 
| 
      
 59 
     | 
    
         
            +
                def remove
         
     | 
| 
      
 60 
     | 
    
         
            +
                  FileRobot.remove_file(abs_path)
         
     | 
| 
      
 61 
     | 
    
         
            +
                end
         
     | 
| 
      
 62 
     | 
    
         
            +
                
         
     | 
| 
      
 63 
     | 
    
         
            +
                def include_in_cmake?
         
     | 
| 
      
 64 
     | 
    
         
            +
                  return true
         
     | 
| 
      
 65 
     | 
    
         
            +
                end
         
     | 
| 
      
 66 
     | 
    
         
            +
                
         
     | 
| 
      
 67 
     | 
    
         
            +
                def self.find_by_src_path(src_path)
         
     | 
| 
      
 68 
     | 
    
         
            +
                  instances.each do |instance|
         
     | 
| 
      
 69 
     | 
    
         
            +
                    if instance.src_path == src_path
         
     | 
| 
      
 70 
     | 
    
         
            +
                      return instance
         
     | 
| 
      
 71 
     | 
    
         
            +
                    end
         
     | 
| 
      
 72 
     | 
    
         
            +
                  end
         
     | 
| 
      
 73 
     | 
    
         
            +
                  nil
         
     | 
| 
      
 74 
     | 
    
         
            +
                end
         
     | 
| 
      
 75 
     | 
    
         
            +
              end
         
     | 
| 
      
 76 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,33 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require File.dirname(__FILE__) + '/../src_file'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require File.dirname(__FILE__) + '/../project'
         
     | 
| 
      
 3 
     | 
    
         
            +
            require File.dirname(__FILE__) + '/../utility/instance_set'
         
     | 
| 
      
 4 
     | 
    
         
            +
            require File.dirname(__FILE__) + '/cpp_file_mixin'
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            module Ritsu
         
     | 
| 
      
 7 
     | 
    
         
            +
              module SrcFiles
         
     | 
| 
      
 8 
     | 
    
         
            +
                class CppFile < Ritsu::SrcFile
         
     | 
| 
      
 9 
     | 
    
         
            +
                  include CppFileMixin
         
     | 
| 
      
 10 
     | 
    
         
            +
                  
         
     | 
| 
      
 11 
     | 
    
         
            +
                  def initialize(src_path, owner)
         
     | 
| 
      
 12 
     | 
    
         
            +
                    super(src_path, owner)
         
     | 
| 
      
 13 
     | 
    
         
            +
                  end
         
     | 
| 
      
 14 
     | 
    
         
            +
                end
         
     | 
| 
      
 15 
     | 
    
         
            +
              
         
     | 
| 
      
 16 
     | 
    
         
            +
                module AddCppFile
         
     | 
| 
      
 17 
     | 
    
         
            +
                  def add_cpp_file(path, options={})
         
     | 
| 
      
 18 
     | 
    
         
            +
                    src_path = compute_src_path(path, options)
         
     | 
| 
      
 19 
     | 
    
         
            +
                    CppFile.new(src_path, self)
         
     | 
| 
      
 20 
     | 
    
         
            +
                  end
         
     | 
| 
      
 21 
     | 
    
         
            +
                end
         
     | 
| 
      
 22 
     | 
    
         
            +
              end
         
     | 
| 
      
 23 
     | 
    
         
            +
            end
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
            module Ritsu
         
     | 
| 
      
 26 
     | 
    
         
            +
              class Target
         
     | 
| 
      
 27 
     | 
    
         
            +
                include Ritsu::SrcFiles::AddCppFile
         
     | 
| 
      
 28 
     | 
    
         
            +
              end
         
     | 
| 
      
 29 
     | 
    
         
            +
              
         
     | 
| 
      
 30 
     | 
    
         
            +
              class Project
         
     | 
| 
      
 31 
     | 
    
         
            +
                include Ritsu::SrcFiles::AddCppFile
         
     | 
| 
      
 32 
     | 
    
         
            +
              end
         
     | 
| 
      
 33 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,40 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require File.dirname(__FILE__) + '/../src_files/target_cmake_lists'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            module Ritsu
         
     | 
| 
      
 4 
     | 
    
         
            +
              module SrcFiles
         
     | 
| 
      
 5 
     | 
    
         
            +
                class ExecutableCmakeLists < TargetCmakeLists
         
     | 
| 
      
 6 
     | 
    
         
            +
                  class ExecutableTemplate < Ritsu::Template
         
     | 
| 
      
 7 
     | 
    
         
            +
                    attr_accessor :target
         
     | 
| 
      
 8 
     | 
    
         
            +
                    attr_accessor :parent 
         
     | 
| 
      
 9 
     | 
    
         
            +
                  
         
     | 
| 
      
 10 
     | 
    
         
            +
                    def initialize(target, parent)
         
     | 
| 
      
 11 
     | 
    
         
            +
                      super("ExecutableCmakeLists -- #{target.name} -- Executable")
         
     | 
| 
      
 12 
     | 
    
         
            +
                      @target = target
         
     | 
| 
      
 13 
     | 
    
         
            +
                      @parent = parent
         
     | 
| 
      
 14 
     | 
    
         
            +
                    end
         
     | 
| 
      
 15 
     | 
    
         
            +
                  
         
     | 
| 
      
 16 
     | 
    
         
            +
                    def update_block(block, options={})
         
     | 
| 
      
 17 
     | 
    
         
            +
                      block.contents.clear
         
     | 
| 
      
 18 
     | 
    
         
            +
                      block.contents << "ADD_EXECUTABLE(#{@target.name} ${#{@parent.source_files_template.src_files_var_name}})"
         
     | 
| 
      
 19 
     | 
    
         
            +
                    end
         
     | 
| 
      
 20 
     | 
    
         
            +
                  end
         
     | 
| 
      
 21 
     | 
    
         
            +
                
         
     | 
| 
      
 22 
     | 
    
         
            +
                  class Template < Ritsu::SrcFiles::TargetCmakeLists::Template
         
     | 
| 
      
 23 
     | 
    
         
            +
                    def initialize(target, options={})
         
     | 
| 
      
 24 
     | 
    
         
            +
                      super(target, "ExecutableCmakeLists -- #{target.name}")
         
     | 
| 
      
 25 
     | 
    
         
            +
                    
         
     | 
| 
      
 26 
     | 
    
         
            +
                      position_to_insert = contents.index(dependencies_template)
         
     | 
| 
      
 27 
     | 
    
         
            +
                      contents.insert(position_to_insert, ExecutableTemplate.new(target, self))
         
     | 
| 
      
 28 
     | 
    
         
            +
                      contents.insert(position_to_insert+1, "")
         
     | 
| 
      
 29 
     | 
    
         
            +
                    end
         
     | 
| 
      
 30 
     | 
    
         
            +
                  end
         
     | 
| 
      
 31 
     | 
    
         
            +
                
         
     | 
| 
      
 32 
     | 
    
         
            +
                  def initialize(target)
         
     | 
| 
      
 33 
     | 
    
         
            +
                    super(target)
         
     | 
| 
      
 34 
     | 
    
         
            +
                    self.template = Template.new(target,
         
     | 
| 
      
 35 
     | 
    
         
            +
                      :block_start_prefix => '##<<',
         
     | 
| 
      
 36 
     | 
    
         
            +
                      :block_end_prefix => '##>>')
         
     | 
| 
      
 37 
     | 
    
         
            +
                  end
         
     | 
| 
      
 38 
     | 
    
         
            +
                end
         
     | 
| 
      
 39 
     | 
    
         
            +
              end
         
     | 
| 
      
 40 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,46 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require File.dirname(__FILE__) + '/../src_file'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require File.dirname(__FILE__) + '/../project'
         
     | 
| 
      
 3 
     | 
    
         
            +
            require File.dirname(__FILE__) + '/../utility/instance_set'
         
     | 
| 
      
 4 
     | 
    
         
            +
            require File.dirname(__FILE__) + '/../utility/file_robot'
         
     | 
| 
      
 5 
     | 
    
         
            +
            require File.dirname(__FILE__) + '/header_file_mixin'
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            module Ritsu
         
     | 
| 
      
 8 
     | 
    
         
            +
              module SrcFiles
         
     | 
| 
      
 9 
     | 
    
         
            +
                class HeaderFile < Ritsu::SrcFile
         
     | 
| 
      
 10 
     | 
    
         
            +
                  include HeaderFileMixin
         
     | 
| 
      
 11 
     | 
    
         
            +
                
         
     | 
| 
      
 12 
     | 
    
         
            +
                  def initialize(src_path, owner)
         
     | 
| 
      
 13 
     | 
    
         
            +
                    super(src_path, owner)
         
     | 
| 
      
 14 
     | 
    
         
            +
                  end
         
     | 
| 
      
 15 
     | 
    
         
            +
                  
         
     | 
| 
      
 16 
     | 
    
         
            +
                  def create
         
     | 
| 
      
 17 
     | 
    
         
            +
                    Ritsu::Utility::FileRobot.create_file(abs_path,
         
     | 
| 
      
 18 
     | 
    
         
            +
                      "#ifndef #{include_guard}\n" +
         
     | 
| 
      
 19 
     | 
    
         
            +
                      "#define #{include_guard}\n" +
         
     | 
| 
      
 20 
     | 
    
         
            +
                      "\n" +
         
     | 
| 
      
 21 
     | 
    
         
            +
                      "////////////////////\n" +
         
     | 
| 
      
 22 
     | 
    
         
            +
                      "// YOUR CODE HERE //\n" +
         
     | 
| 
      
 23 
     | 
    
         
            +
                      "////////////////////\n" +
         
     | 
| 
      
 24 
     | 
    
         
            +
                      "\n" +
         
     | 
| 
      
 25 
     | 
    
         
            +
                      "#endif\n")
         
     | 
| 
      
 26 
     | 
    
         
            +
                  end          
         
     | 
| 
      
 27 
     | 
    
         
            +
                end
         
     | 
| 
      
 28 
     | 
    
         
            +
                
         
     | 
| 
      
 29 
     | 
    
         
            +
                module AddHeaderFile
         
     | 
| 
      
 30 
     | 
    
         
            +
                  def add_header_file(path, options={})
         
     | 
| 
      
 31 
     | 
    
         
            +
                    src_path = compute_src_path(path, options)
         
     | 
| 
      
 32 
     | 
    
         
            +
                    HeaderFile.new(src_path, self)
         
     | 
| 
      
 33 
     | 
    
         
            +
                  end
         
     | 
| 
      
 34 
     | 
    
         
            +
                end
         
     | 
| 
      
 35 
     | 
    
         
            +
              end
         
     | 
| 
      
 36 
     | 
    
         
            +
            end
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
      
 38 
     | 
    
         
            +
            module Ritsu
         
     | 
| 
      
 39 
     | 
    
         
            +
              class Target
         
     | 
| 
      
 40 
     | 
    
         
            +
                include Ritsu::SrcFiles::AddHeaderFile
         
     | 
| 
      
 41 
     | 
    
         
            +
              end
         
     | 
| 
      
 42 
     | 
    
         
            +
              
         
     | 
| 
      
 43 
     | 
    
         
            +
              class Project
         
     | 
| 
      
 44 
     | 
    
         
            +
                include Ritsu::SrcFiles::AddHeaderFile
         
     | 
| 
      
 45 
     | 
    
         
            +
              end
         
     | 
| 
      
 46 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,20 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'rubygems'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'active_support/core_ext/string/inflections'
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            module Ritsu
         
     | 
| 
      
 5 
     | 
    
         
            +
              module SrcFiles
         
     | 
| 
      
 6 
     | 
    
         
            +
                module HeaderFileMixin
         
     | 
| 
      
 7 
     | 
    
         
            +
                  def include_guard
         
     | 
| 
      
 8 
     | 
    
         
            +
                    '__' + project.name.underscore.upcase + '_' + src_path.gsub(/[.\/]+/,'_').upcase + '__'
         
     | 
| 
      
 9 
     | 
    
         
            +
                  end
         
     | 
| 
      
 10 
     | 
    
         
            +
                  
         
     | 
| 
      
 11 
     | 
    
         
            +
                  def header_file?
         
     | 
| 
      
 12 
     | 
    
         
            +
                    true
         
     | 
| 
      
 13 
     | 
    
         
            +
                  end
         
     | 
| 
      
 14 
     | 
    
         
            +
                  
         
     | 
| 
      
 15 
     | 
    
         
            +
                  def cpp_file?
         
     | 
| 
      
 16 
     | 
    
         
            +
                    false
         
     | 
| 
      
 17 
     | 
    
         
            +
                  end
         
     | 
| 
      
 18 
     | 
    
         
            +
                end
         
     | 
| 
      
 19 
     | 
    
         
            +
              end
         
     | 
| 
      
 20 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,110 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require File.dirname(__FILE__) + '/../template'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require File.dirname(__FILE__) + '/../template_policies'
         
     | 
| 
      
 3 
     | 
    
         
            +
            require File.dirname(__FILE__) + '/../src_files/templated_src_file'
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            module Ritsu
         
     | 
| 
      
 6 
     | 
    
         
            +
              module SrcFiles
         
     | 
| 
      
 7 
     | 
    
         
            +
                class ProjectCmakeLists < Ritsu::SrcFiles::TemplatedSrcFile
         
     | 
| 
      
 8 
     | 
    
         
            +
                  class HeaderTemplate < Ritsu::Template
         
     | 
| 
      
 9 
     | 
    
         
            +
                    include Ritsu::TemplatePolicies::Overwrite
         
     | 
| 
      
 10 
     | 
    
         
            +
                    
         
     | 
| 
      
 11 
     | 
    
         
            +
                    def initialize(project)
         
     | 
| 
      
 12 
     | 
    
         
            +
                      super("ProjectCmakeLists -- Header")
         
     | 
| 
      
 13 
     | 
    
         
            +
                      @project = project
         
     | 
| 
      
 14 
     | 
    
         
            +
                      
         
     | 
| 
      
 15 
     | 
    
         
            +
                      add_line "PROJECT(#{@project.name})"
         
     | 
| 
      
 16 
     | 
    
         
            +
                      add_line "CMAKE_MINIMUM_REQUIRED(VERSION 2.6)"
         
     | 
| 
      
 17 
     | 
    
         
            +
                      add_line "SET(CMAKE_MODULE_PATH \"${CMAKE_SOURCE_DIR}/cmake_modules\" ${CMAKE_MODULE_PATH})"
         
     | 
| 
      
 18 
     | 
    
         
            +
                      add_new_line
         
     | 
| 
      
 19 
     | 
    
         
            +
                      add_line "IF(WIN32)"
         
     | 
| 
      
 20 
     | 
    
         
            +
                      add_line '    OPTION(__WIN_PLATFORM__ "Windows Platform" ON)'
         
     | 
| 
      
 21 
     | 
    
         
            +
                      add_line "ELSE(WIN32)"
         
     | 
| 
      
 22 
     | 
    
         
            +
                      add_line '    OPTION(__WIN_PLATFORM__ "Windows Platform" OFF)'
         
     | 
| 
      
 23 
     | 
    
         
            +
                      add_line "ENDIF(WIN32)"
         
     | 
| 
      
 24 
     | 
    
         
            +
                      add_new_line
         
     | 
| 
      
 25 
     | 
    
         
            +
                      add_line "IF(UNIX)"
         
     | 
| 
      
 26 
     | 
    
         
            +
                      add_line "    IF(APPLE)"          
         
     | 
| 
      
 27 
     | 
    
         
            +
                      add_line '        OPTION(__MAC_PLATFORM__ "Apple Platform" ON)'
         
     | 
| 
      
 28 
     | 
    
         
            +
                      add_line '        OPTION(__UNIX_PLATFORM__ "Unix Platform" OFF)'
         
     | 
| 
      
 29 
     | 
    
         
            +
                      add_line "    ELSE(APPLE)"
         
     | 
| 
      
 30 
     | 
    
         
            +
                      add_line '        OPTION(__MAC_PLATFORM__ "Apple Platform" OFF)'
         
     | 
| 
      
 31 
     | 
    
         
            +
                      add_line '        OPTION(__UNIX_PLATFORM__ "Unix Platform" ON)'
         
     | 
| 
      
 32 
     | 
    
         
            +
                      add_line "    ENDIF(APPLE)"
         
     | 
| 
      
 33 
     | 
    
         
            +
                      add_line "ELSE(UNIX)"
         
     | 
| 
      
 34 
     | 
    
         
            +
                      add_line '    OPTION(__MAC_PLATFORM__ "Apple Platform" OFF)'
         
     | 
| 
      
 35 
     | 
    
         
            +
                      add_line '    OPTION(__UNIX_PLATFORM__ "Unix Platform" OFF)'
         
     | 
| 
      
 36 
     | 
    
         
            +
                      add_line "ENDIF(UNIX)"
         
     | 
| 
      
 37 
     | 
    
         
            +
                    end
         
     | 
| 
      
 38 
     | 
    
         
            +
                  end
         
     | 
| 
      
 39 
     | 
    
         
            +
                  
         
     | 
| 
      
 40 
     | 
    
         
            +
                  class ExternalLibrariesTemplate < Ritsu::Template
         
     | 
| 
      
 41 
     | 
    
         
            +
                    def initialize(project)
         
     | 
| 
      
 42 
     | 
    
         
            +
                      super("ProjectCmakeLists -- External Libraries")
         
     | 
| 
      
 43 
     | 
    
         
            +
                      @project = project
         
     | 
| 
      
 44 
     | 
    
         
            +
                    end
         
     | 
| 
      
 45 
     | 
    
         
            +
                  
         
     | 
| 
      
 46 
     | 
    
         
            +
                    def update_block(block, options={})
         
     | 
| 
      
 47 
     | 
    
         
            +
                      block.contents.clear
         
     | 
| 
      
 48 
     | 
    
         
            +
                      external_libraries = @project.external_libraries.to_a
         
     | 
| 
      
 49 
     | 
    
         
            +
                      external_libraries.sort! {|x,y| x.name <=> y.name}
         
     | 
| 
      
 50 
     | 
    
         
            +
                      external_libraries.each do |external_library|
         
     | 
| 
      
 51 
     | 
    
         
            +
                        block.contents << external_library.cmake_find_script
         
     | 
| 
      
 52 
     | 
    
         
            +
                      end        
         
     | 
| 
      
 53 
     | 
    
         
            +
                    end
         
     | 
| 
      
 54 
     | 
    
         
            +
                  end
         
     | 
| 
      
 55 
     | 
    
         
            +
                
         
     | 
| 
      
 56 
     | 
    
         
            +
                  class DirectoriesTemplate < Ritsu::Template
         
     | 
| 
      
 57 
     | 
    
         
            +
                    def initialize(project)
         
     | 
| 
      
 58 
     | 
    
         
            +
                      super("ProjectCmakeLists -- Directories")
         
     | 
| 
      
 59 
     | 
    
         
            +
                      @project = project          
         
     | 
| 
      
 60 
     | 
    
         
            +
                    end
         
     | 
| 
      
 61 
     | 
    
         
            +
                  
         
     | 
| 
      
 62 
     | 
    
         
            +
                    def update_block(block, options={})
         
     | 
| 
      
 63 
     | 
    
         
            +
                      block.contents.clear
         
     | 
| 
      
 64 
     | 
    
         
            +
                      @project.targets_sorted_by_topological_order.each do |target|
         
     | 
| 
      
 65 
     | 
    
         
            +
                        block.contents << "ADD_SUBDIRECTORY(#{target.name})"
         
     | 
| 
      
 66 
     | 
    
         
            +
                      end
         
     | 
| 
      
 67 
     | 
    
         
            +
                    end
         
     | 
| 
      
 68 
     | 
    
         
            +
                  end
         
     | 
| 
      
 69 
     | 
    
         
            +
                  
         
     | 
| 
      
 70 
     | 
    
         
            +
                  class ConfigureFileTemplate < Ritsu::Template
         
     | 
| 
      
 71 
     | 
    
         
            +
                    include Ritsu::TemplatePolicies::Overwrite
         
     | 
| 
      
 72 
     | 
    
         
            +
                    
         
     | 
| 
      
 73 
     | 
    
         
            +
                    def initialize(project)
         
     | 
| 
      
 74 
     | 
    
         
            +
                      super("ProjectCmakeLists -- Configure File")
         
     | 
| 
      
 75 
     | 
    
         
            +
                      @project = project
         
     | 
| 
      
 76 
     | 
    
         
            +
                      
         
     | 
| 
      
 77 
     | 
    
         
            +
                      add_line "CONFIGURE_FILE( ${CMAKE_SOURCE_DIR}/config.h.in ${CMAKE_SOURCE_DIR}/config.h )"
         
     | 
| 
      
 78 
     | 
    
         
            +
                    end
         
     | 
| 
      
 79 
     | 
    
         
            +
                  end
         
     | 
| 
      
 80 
     | 
    
         
            +
                
         
     | 
| 
      
 81 
     | 
    
         
            +
                  class Template < Ritsu::Template
         
     | 
| 
      
 82 
     | 
    
         
            +
                    include Ritsu::TemplatePolicies::StrictBlockMatchingButLeaveUserTextBe
         
     | 
| 
      
 83 
     | 
    
         
            +
                  
         
     | 
| 
      
 84 
     | 
    
         
            +
                    def initialize(project)
         
     | 
| 
      
 85 
     | 
    
         
            +
                      super
         
     | 
| 
      
 86 
     | 
    
         
            +
                      @project = project
         
     | 
| 
      
 87 
     | 
    
         
            +
                      
         
     | 
| 
      
 88 
     | 
    
         
            +
                      add_template HeaderTemplate.new(project)
         
     | 
| 
      
 89 
     | 
    
         
            +
                      add_new_line
         
     | 
| 
      
 90 
     | 
    
         
            +
                      add_template ExternalLibrariesTemplate.new(project)
         
     | 
| 
      
 91 
     | 
    
         
            +
                      add_new_line
         
     | 
| 
      
 92 
     | 
    
         
            +
                      add_template DirectoriesTemplate.new(project)
         
     | 
| 
      
 93 
     | 
    
         
            +
                      add_new_line
         
     | 
| 
      
 94 
     | 
    
         
            +
                      add_template ConfigureFileTemplate.new(project)
         
     | 
| 
      
 95 
     | 
    
         
            +
                    end
         
     | 
| 
      
 96 
     | 
    
         
            +
                  end
         
     | 
| 
      
 97 
     | 
    
         
            +
                
         
     | 
| 
      
 98 
     | 
    
         
            +
                  def initialize(owner)
         
     | 
| 
      
 99 
     | 
    
         
            +
                    super('CMakeLists.txt', owner,
         
     | 
| 
      
 100 
     | 
    
         
            +
                      :block_start_prefix => "##<<",
         
     | 
| 
      
 101 
     | 
    
         
            +
                      :block_end_prefix => "##>>")
         
     | 
| 
      
 102 
     | 
    
         
            +
                    self.template = Template.new(project)
         
     | 
| 
      
 103 
     | 
    
         
            +
                  end
         
     | 
| 
      
 104 
     | 
    
         
            +
                
         
     | 
| 
      
 105 
     | 
    
         
            +
                  def include_in_cmake?
         
     | 
| 
      
 106 
     | 
    
         
            +
                    false
         
     | 
| 
      
 107 
     | 
    
         
            +
                  end
         
     | 
| 
      
 108 
     | 
    
         
            +
                end
         
     | 
| 
      
 109 
     | 
    
         
            +
              end
         
     | 
| 
      
 110 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,15 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require File.dirname(__FILE__) + "/../src_file"
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            module Ritsu
         
     | 
| 
      
 4 
     | 
    
         
            +
              module SrcFiles
         
     | 
| 
      
 5 
     | 
    
         
            +
                class ProjectConfigHeaderFile < Ritsu::SrcFile
         
     | 
| 
      
 6 
     | 
    
         
            +
                  def initialize(project)
         
     | 
| 
      
 7 
     | 
    
         
            +
                    super("config.h", project)
         
     | 
| 
      
 8 
     | 
    
         
            +
                  end
         
     | 
| 
      
 9 
     | 
    
         
            +
                  
         
     | 
| 
      
 10 
     | 
    
         
            +
                  def include_in_cmake?
         
     | 
| 
      
 11 
     | 
    
         
            +
                    false
         
     | 
| 
      
 12 
     | 
    
         
            +
                  end
         
     | 
| 
      
 13 
     | 
    
         
            +
                end
         
     | 
| 
      
 14 
     | 
    
         
            +
              end
         
     | 
| 
      
 15 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,46 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'rubygems'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'active_support/core_ext/string/inflections'
         
     | 
| 
      
 3 
     | 
    
         
            +
            require File.dirname(__FILE__) + "/templated_src_file"
         
     | 
| 
      
 4 
     | 
    
         
            +
            require File.dirname(__FILE__) + "/../template_policies"
         
     | 
| 
      
 5 
     | 
    
         
            +
            require File.dirname(__FILE__) + "/../template"
         
     | 
| 
      
 6 
     | 
    
         
            +
            require File.dirname(__FILE__) + "/../utility/platform"
         
     | 
| 
      
 7 
     | 
    
         
            +
            require File.dirname(__FILE__) + "/header_file_mixin"
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            module Ritsu
         
     | 
| 
      
 10 
     | 
    
         
            +
              module SrcFiles
         
     | 
| 
      
 11 
     | 
    
         
            +
                class ProjectConfigHeaderTemplateFile < Ritsu::SrcFiles::TemplatedSrcFile
         
     | 
| 
      
 12 
     | 
    
         
            +
                  class Template < Ritsu::Template
         
     | 
| 
      
 13 
     | 
    
         
            +
                    include Ritsu::TemplatePolicies::DoNotUpdate
         
     | 
| 
      
 14 
     | 
    
         
            +
                    
         
     | 
| 
      
 15 
     | 
    
         
            +
                    attr_reader :src_file
         
     | 
| 
      
 16 
     | 
    
         
            +
                    
         
     | 
| 
      
 17 
     | 
    
         
            +
                    def initialize(src_file)
         
     | 
| 
      
 18 
     | 
    
         
            +
                      @src_file = src_file
         
     | 
| 
      
 19 
     | 
    
         
            +
                      super("ProjectConfigHeaderTemplateFile -- #{project.name}")
         
     | 
| 
      
 20 
     | 
    
         
            +
                      
         
     | 
| 
      
 21 
     | 
    
         
            +
                      add_line "#ifndef __#{project.name.underscore.upcase}_CONFIG_H__"
         
     | 
| 
      
 22 
     | 
    
         
            +
                      add_line "#define __#{project.name.underscore.upcase}_CONFIG_H__"
         
     | 
| 
      
 23 
     | 
    
         
            +
                      add_new_line
         
     | 
| 
      
 24 
     | 
    
         
            +
                      add_line "#cmakedefine __WIN_PLATFORM__"
         
     | 
| 
      
 25 
     | 
    
         
            +
                      add_line "#cmakedefine __MAC_PLATFORM__"
         
     | 
| 
      
 26 
     | 
    
         
            +
                      add_line "#cmakedefine __UNIX_PLATFORM__"
         
     | 
| 
      
 27 
     | 
    
         
            +
                      add_new_line
         
     | 
| 
      
 28 
     | 
    
         
            +
                      add_line "#endif"
         
     | 
| 
      
 29 
     | 
    
         
            +
                    end
         
     | 
| 
      
 30 
     | 
    
         
            +
                    
         
     | 
| 
      
 31 
     | 
    
         
            +
                    def project
         
     | 
| 
      
 32 
     | 
    
         
            +
                      src_file.project
         
     | 
| 
      
 33 
     | 
    
         
            +
                    end
         
     | 
| 
      
 34 
     | 
    
         
            +
                  end
         
     | 
| 
      
 35 
     | 
    
         
            +
                  
         
     | 
| 
      
 36 
     | 
    
         
            +
                  def initialize(project)
         
     | 
| 
      
 37 
     | 
    
         
            +
                    super("config.h.in", project)
         
     | 
| 
      
 38 
     | 
    
         
            +
                    self.template = Template.new(self)
         
     | 
| 
      
 39 
     | 
    
         
            +
                  end
         
     | 
| 
      
 40 
     | 
    
         
            +
                  
         
     | 
| 
      
 41 
     | 
    
         
            +
                  def include_in_cmake?
         
     | 
| 
      
 42 
     | 
    
         
            +
                    false
         
     | 
| 
      
 43 
     | 
    
         
            +
                  end
         
     | 
| 
      
 44 
     | 
    
         
            +
                end
         
     | 
| 
      
 45 
     | 
    
         
            +
              end
         
     | 
| 
      
 46 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,40 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require File.dirname(__FILE__) + '/../src_files/target_cmake_lists'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            module Ritsu
         
     | 
| 
      
 4 
     | 
    
         
            +
              module SrcFiles
         
     | 
| 
      
 5 
     | 
    
         
            +
                class SharedLibraryCmakeLists < TargetCmakeLists
         
     | 
| 
      
 6 
     | 
    
         
            +
                  class SharedLibraryTemplate < Ritsu::Template
         
     | 
| 
      
 7 
     | 
    
         
            +
                    attr_accessor :target
         
     | 
| 
      
 8 
     | 
    
         
            +
                    attr_accessor :parent 
         
     | 
| 
      
 9 
     | 
    
         
            +
                  
         
     | 
| 
      
 10 
     | 
    
         
            +
                    def initialize(target, parent)
         
     | 
| 
      
 11 
     | 
    
         
            +
                      super("SharedLibraryCmakeLists -- #{target.name} -- Shared Library")
         
     | 
| 
      
 12 
     | 
    
         
            +
                      @target = target
         
     | 
| 
      
 13 
     | 
    
         
            +
                      @parent = parent
         
     | 
| 
      
 14 
     | 
    
         
            +
                    end
         
     | 
| 
      
 15 
     | 
    
         
            +
                  
         
     | 
| 
      
 16 
     | 
    
         
            +
                    def update_block(block, options={})
         
     | 
| 
      
 17 
     | 
    
         
            +
                      block.contents.clear
         
     | 
| 
      
 18 
     | 
    
         
            +
                      block.contents << "ADD_LIBRARY(#{@target.name} SHARED ${#{@parent.source_files_template.src_files_var_name}})"
         
     | 
| 
      
 19 
     | 
    
         
            +
                    end
         
     | 
| 
      
 20 
     | 
    
         
            +
                  end
         
     | 
| 
      
 21 
     | 
    
         
            +
                
         
     | 
| 
      
 22 
     | 
    
         
            +
                  class Template < Ritsu::SrcFiles::TargetCmakeLists::Template
         
     | 
| 
      
 23 
     | 
    
         
            +
                    def initialize(target, options={})
         
     | 
| 
      
 24 
     | 
    
         
            +
                      super(target, "SharedLibraryCmakeLists -- #{target.name}")
         
     | 
| 
      
 25 
     | 
    
         
            +
                    
         
     | 
| 
      
 26 
     | 
    
         
            +
                      position_to_insert = contents.index(dependencies_template)
         
     | 
| 
      
 27 
     | 
    
         
            +
                      contents.insert(position_to_insert, SharedLibraryTemplate.new(target, self))
         
     | 
| 
      
 28 
     | 
    
         
            +
                      contents.insert(position_to_insert+1, "")
         
     | 
| 
      
 29 
     | 
    
         
            +
                    end
         
     | 
| 
      
 30 
     | 
    
         
            +
                  end
         
     | 
| 
      
 31 
     | 
    
         
            +
                
         
     | 
| 
      
 32 
     | 
    
         
            +
                  def initialize(target)
         
     | 
| 
      
 33 
     | 
    
         
            +
                    super(target)
         
     | 
| 
      
 34 
     | 
    
         
            +
                    self.template = Template.new(target,
         
     | 
| 
      
 35 
     | 
    
         
            +
                      :block_start_prefix => '##<<',
         
     | 
| 
      
 36 
     | 
    
         
            +
                      :block_end_prefix => '##>>')
         
     | 
| 
      
 37 
     | 
    
         
            +
                  end
         
     | 
| 
      
 38 
     | 
    
         
            +
                end
         
     | 
| 
      
 39 
     | 
    
         
            +
              end
         
     | 
| 
      
 40 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,40 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require File.dirname(__FILE__) + '/../src_files/target_cmake_lists'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            module Ritsu
         
     | 
| 
      
 4 
     | 
    
         
            +
              module SrcFiles
         
     | 
| 
      
 5 
     | 
    
         
            +
                class StaticLibraryCmakeLists < TargetCmakeLists
         
     | 
| 
      
 6 
     | 
    
         
            +
                  class StaticLibraryTemplate < Ritsu::Template
         
     | 
| 
      
 7 
     | 
    
         
            +
                    attr_accessor :target
         
     | 
| 
      
 8 
     | 
    
         
            +
                    attr_accessor :parent 
         
     | 
| 
      
 9 
     | 
    
         
            +
                  
         
     | 
| 
      
 10 
     | 
    
         
            +
                    def initialize(target, parent)
         
     | 
| 
      
 11 
     | 
    
         
            +
                      super("StaticLibraryCmakeLists -- #{target.name} -- Static Library")
         
     | 
| 
      
 12 
     | 
    
         
            +
                      @target = target
         
     | 
| 
      
 13 
     | 
    
         
            +
                      @parent = parent
         
     | 
| 
      
 14 
     | 
    
         
            +
                    end
         
     | 
| 
      
 15 
     | 
    
         
            +
                  
         
     | 
| 
      
 16 
     | 
    
         
            +
                    def update_block(block, options={})
         
     | 
| 
      
 17 
     | 
    
         
            +
                      block.contents.clear
         
     | 
| 
      
 18 
     | 
    
         
            +
                      block.contents << "ADD_LIBRARY(#{@target.name} STATIC ${#{@parent.source_files_template.src_files_var_name}})"
         
     | 
| 
      
 19 
     | 
    
         
            +
                    end
         
     | 
| 
      
 20 
     | 
    
         
            +
                  end
         
     | 
| 
      
 21 
     | 
    
         
            +
                
         
     | 
| 
      
 22 
     | 
    
         
            +
                  class Template < Ritsu::SrcFiles::TargetCmakeLists::Template
         
     | 
| 
      
 23 
     | 
    
         
            +
                    def initialize(target, options={})
         
     | 
| 
      
 24 
     | 
    
         
            +
                      super(target, "StaticLibraryCmakeLists -- #{target.name}")
         
     | 
| 
      
 25 
     | 
    
         
            +
                    
         
     | 
| 
      
 26 
     | 
    
         
            +
                      position_to_insert = contents.index(dependencies_template)
         
     | 
| 
      
 27 
     | 
    
         
            +
                      contents.insert(position_to_insert, StaticLibraryTemplate.new(target, self))
         
     | 
| 
      
 28 
     | 
    
         
            +
                      contents.insert(position_to_insert+1, "")
         
     | 
| 
      
 29 
     | 
    
         
            +
                    end
         
     | 
| 
      
 30 
     | 
    
         
            +
                  end
         
     | 
| 
      
 31 
     | 
    
         
            +
                
         
     | 
| 
      
 32 
     | 
    
         
            +
                  def initialize(target)
         
     | 
| 
      
 33 
     | 
    
         
            +
                    super(target)
         
     | 
| 
      
 34 
     | 
    
         
            +
                    self.template = Template.new(target,
         
     | 
| 
      
 35 
     | 
    
         
            +
                      :block_start_prefix => '##<<',
         
     | 
| 
      
 36 
     | 
    
         
            +
                      :block_end_prefix => '##>>')
         
     | 
| 
      
 37 
     | 
    
         
            +
                  end
         
     | 
| 
      
 38 
     | 
    
         
            +
                end
         
     | 
| 
      
 39 
     | 
    
         
            +
              end
         
     | 
| 
      
 40 
     | 
    
         
            +
            end
         
     |