Sha256: 386375ebfe1e8f6f858d1ca78df3cfb54f357f0ab28f4c0d4ef2f264de7c0fba

Contents?: true

Size: 1.84 KB

Versions: 5

Compression:

Stored size: 1.84 KB

Contents

require 'mj/tools/subprocess'
require 'build-tool/build-system/base'
require 'build-tool/build-system/make'

module BuildTool; module BuildSystem

    #
    # QMake build system.
    #
    class QMake < Base

        include MJ::Tools::SubProcess

        class QMakeError < BuildTool::Error; end

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

        #
        ### ATTRIBUTES
        #

        # Check if the module is configured
        def configured?
            Pathname.new( build_directory ).join( 'Makefile' ).exist?
        end

        def name
            "qmake"
        end

        #
        ### METHODS
        #

        # Configure the module
        def reconfigure()
            configure
        end

        # Execute a qmake command in the context of the build directory
        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

        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

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

        def install_fast_supported?
            false
        end

        def make( target = nil )
            Make.make( "#{target ? target : "" }", build_directory, self.module.environment.values )
        end

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

    end # class QMake


end; end # module BuildTool::BuildSystem

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
build-tool-0.5.7 lib/build-tool/build-system/qmake.rb
build-tool-0.5.6 lib/build-tool/build-system/qmake.rb
build-tool-0.5.5 lib/build-tool/build-system/qmake.rb
build-tool-0.5.4 lib/build-tool/build-system/qmake.rb
build-tool-0.5.3 lib/build-tool/build-system/qmake.rb