Class: BuildTool::BuildSystem::QMake

Inherits:
Base
  • Object
show all
Includes:
MJ::Tools::SubProcess
Defined in:
lib/build-tool/build-system/qmake.rb

Overview

QMake build system.

Defined Under Namespace

Classes: MakeError, QMakeError

Instance Attribute Summary

Attributes inherited from Base

#defaults, #feature, #module, #out_of_source

Instance Method Summary collapse

Methods inherited from Base

#[], #[]=, #active?, #after_rebase, #append, #build_directory, #check_build_directory, #dup, #env, #install_prefix, #option_hash, #option_names, #option_set?, #parent, #prepend, #recipe, #remove_build_directory, #set, #source_directory, #to_s

Constructor Details

#initialize(*args) ⇒ QMake

Returns a new instance of QMake.



16
17
18
# File 'lib/build-tool/build-system/qmake.rb', line 16

def initialize( *args )
    super( *args )
end

Instance Method Details

#configureObject



51
52
53
54
55
56
57
# File 'lib/build-tool/build-system/qmake.rb', line 51

def configure
    check_build_directory( true )
    opt = option_string
    opt += " PREFIX=#{install_prefix.to_s}" if install_prefix
    rc = qmake "#{source_directory}/*.pro #{opt}"
    rc
end

#configured?Boolean

Check if the module is configured

Returns:

  • (Boolean)


25
26
27
# File 'lib/build-tool/build-system/qmake.rb', line 25

def configured?
    Pathname.new( build_directory ).join( 'Makefile' ).exist?
end

#do_make(target = nil) ⇒ Object



59
60
61
62
63
64
65
# File 'lib/build-tool/build-system/qmake.rb', line 59

def do_make( target = nil )
    rc = self.class.execute( "make #{target ? target : "" }", build_directory, self.module.environment.values )
    if rc != 0
        raise MakeError, "make #{target || "" } failed with error code #{rc}";
    end
    rc
end

#install(fast) ⇒ Object



67
68
69
# File 'lib/build-tool/build-system/qmake.rb', line 67

def install( fast )
    make( "install" )
end

#install_fast_supported?Boolean

Returns:

  • (Boolean)


71
72
73
# File 'lib/build-tool/build-system/qmake.rb', line 71

def install_fast_supported?
    false
end

#make(target = nil) ⇒ Object



75
76
77
# File 'lib/build-tool/build-system/qmake.rb', line 75

def make( target = nil )
    do_make( target )
end

#nameObject



29
30
31
# File 'lib/build-tool/build-system/qmake.rb', line 29

def name
    "qmake"
end

#option_stringObject



79
80
81
82
83
84
85
86
# File 'lib/build-tool/build-system/qmake.rb', line 79

def option_string
    arr = []
    option_names.each do |var|
        val = self[var]
        arr << "#{var}='#{val}'"
    end
    arr.join(" ")
end

#qmake(command, wd = build_directory) ⇒ Object

Execute a qmake command in the context of the build directory



43
44
45
46
47
48
49
# File 'lib/build-tool/build-system/qmake.rb', line 43

def qmake( command, wd = build_directory )
    rc = self.class.execute "qmake #{command}", wd, env
    if rc != 0
        raise QMakeError, "qmake failed with error #{rc}!"
    end
    rc
end

#reconfigureObject

Configure the module



38
39
40
# File 'lib/build-tool/build-system/qmake.rb', line 38

def reconfigure()
    configure
end