class Rmk::Moc
Qt's meta object compiler (added automatically when using +'qt'+ package)
Constants
- MOC_PATTERN
Attributes
autodetect[RW]
enable automatic detection of input files
moc[RW]
moc binary
Public Class Methods
new()
click to toggle source
Calls superclass method
Rmk::Processor.new
# File tools/moc.rb, line 16 def initialize super @slot = SLOTS[:code_generator] @requires = [CXX] data = tool_params(:Moc, generator.configuration) @flags.add(data[:flags]) @moc = data[:moc] @autodetect = data[:autodetect] || true end
Public Instance Methods
command()
click to toggle source
# File tools/moc.rb, line 29 def command '$moc $mocflags -o $out $in' end
find_sources(pattern)
click to toggle source
# File tools/moc.rb, line 67 def find_sources(pattern) return unless autodetect src = @sources + generator.files.find_all do |f| f =~ pattern && !exclude?(f) end @sources = stable_unique(grep(MOC_PATTERN, src)) end
ninja_build(writer = generator.ninja)
click to toggle source
# File tools/moc.rb, line 54 def ninja_build(writer = generator.ninja) find_sources(source_pattern) @@log.debug "Qt::moc sources = #{sources.join(' ')}" sources.each do |src| out = "$builddir/#{strip_extension(src) + '.moc.cc'}" writer.build(generator.add_file(out), 'moc', generator.expand_source(src)) end end
ninja_rules(writer = generator.ninja)
click to toggle source
# File tools/moc.rb, line 49 def ninja_rules(writer = generator.ninja) writer.rule('moc', command, description: 'Qt::moc $out') end
ninja_variables(writer = generator.ninja)
click to toggle source
# File tools/moc.rb, line 33 def ninja_variables(writer = generator.ninja) @moc = begin (@@available_packages['qt'][:moc] || @moc) rescue StandardError @moc end logger.debug "using moc '#{@moc}'" # which moc writer.comment 'Qt::moc' writer.variable('moc', @moc) writer.variable('mocflags', [cc.definitions_text, cc.include_paths_text, flags.text].join(' ')) writer.newline end
source_pattern()
click to toggle source
# File tools/moc.rb, line 77 def source_pattern /\.(h|hh|hpp|H)$/ end