Module: Buildfile
- Defined in:
- lib/buildfile.rb
Overview
Buildfile The process a yaml file into a clang++ buildstring.
Defined Under Namespace
Classes: Project
Class Method Summary collapse
- .generate_exe(proj) ⇒ Object
- .generate_project_build_string_from_buildfile(file_name) ⇒ Object
- .generate_project_build_string_from_loaded_yaml(yaml) ⇒ Object
- .generate_static_lib(proj) ⇒ Object
Class Method Details
.generate_exe(proj) ⇒ Object
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 |
# File 'lib/buildfile.rb', line 135 def self.generate_exe(proj) build_str = "" # Compiler name compiler = proj.get_compiler() if(compiler) then build_str += compiler end # Output name, or fallback to project name output_name = proj.get_output_name() if(compiler) then build_str += output_name end # input files files = proj.get_file_list() if(files) then build_str += files end # include dirs inc_dirs = proj.get_inc_dirs() if(inc_dirs) then build_str += inc_dirs end # lib dirs lib_dirs = proj.get_lib_dirs() if(lib_dirs) then build_str += lib_dirs end # libs libs = proj.get_libs() if(libs) then build_str += libs end # other_flags other_flags = proj.get_other_flags() if(other_flags) then build_str += other_flags end # pre processor defines = proj.get_pre_processor_defines() if(defines) then build_str += defines end # custom_flag custom_flags = proj.get_custom_flags() if(custom_flags) then build_str += custom_flags end #return build_str end |
.generate_project_build_string_from_buildfile(file_name) ⇒ Object
118 119 120 |
# File 'lib/buildfile.rb', line 118 def self.generate_project_build_string_from_buildfile(file_name) generate_project_build_string_from_loaded_yaml(YAML.load_file(file_name)) end |
.generate_project_build_string_from_loaded_yaml(yaml) ⇒ Object
123 124 125 126 127 128 129 130 131 132 |
# File 'lib/buildfile.rb', line 123 def self.generate_project_build_string_from_loaded_yaml(yaml) proj = Project.new(yaml) if(proj.get_output_type == "exe") return Buildfile.generate_exe(proj) elsif(proj.get_output_type == "static_lib") return Buildfile.generate_static_lib(proj) end end |
.generate_static_lib(proj) ⇒ Object
111 112 113 114 115 |
# File 'lib/buildfile.rb', line 111 def self.generate_static_lib(proj) compile_str = "#{proj.get_compiler} -c #{proj.get_file_list} #{proj.get_other_flags} #{proj.get_inc_dirs} && ar -rcs #{proj.get_output_name} *.o" end |