Class: RakeOE::QtSettings

Inherits:
Object
  • Object
show all
Defined in:
lib/rakeoe/qt_settings.rb

Overview

Qt specific compilation and linker settings

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(toolchain) ⇒ QtSettings

Returns a new instance of QtSettings.

Parameters:

  • toolchain (Toolchain)

    The toolchain used



14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/rakeoe/qt_settings.rb', line 14

def initialize(toolchain)
  @tc = toolchain
  @qt_file_macros = %w[OE_QMAKE_MOC OE_QMAKE_UIC OE_QMAKE_UIC3 OE_QMAKE_RCC OE_QMAKE_QDBUSCPP2XML OE_QMAKE_QDBUSXML2CPP OE_QMAKE_QT_CONFIG ]
  @qt_path_macros = %w[OE_QMAKE_LIBDIR_QT OE_QMAKE_INCDIR_QT QMAKESPEC]
  @checked = false
  if check_once
    @cfg_file = read_config(@tc.settings['OE_QMAKE_QT_CONFIG'])
    if @cfg_file
      @lib_infix = @cfg_file.env['QT_LIBINFIX']
    else
      @lib_infix = ''
    end
  end
end

Instance Attribute Details

#lib_infixString

Returns Library infix dependent on if either Qt Embedded is used or Desktop Qt.

Returns:

  • (String)

    Library infix dependent on if either Qt Embedded is used or Desktop Qt



11
12
13
# File 'lib/rakeoe/qt_settings.rb', line 11

def lib_infix
  @lib_infix
end

Instance Method Details

#cflagsString

Returns the cflags configuration for the Qt compilation

Returns:

  • (String)

    cflags used for compilation qt files



69
70
71
# File 'lib/rakeoe/qt_settings.rb', line 69

def cflags
  " -I#{@tc.settings['OE_QMAKE_INCDIR_QT']} -I#{@tc.settings['OE_QMAKE_INCDIR_QT']}/QtCore -I#{@tc.settings['OE_QMAKE_INCDIR_QT']}/Qt -I#{@tc.settings['OE_QMAKE_INCDIR_QT']}/QtNetwork -I#{@tc.settings['OE_QMAKE_INCDIR_QT']}/QtDBus"
end

#checkObject

Check if all mandatory files and paths are present



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/rakeoe/qt_settings.rb', line 30

def check
  @prerequisites_resolved = true
  @qt_file_macros.each do |macro|
    macro_value = @tc.settings[macro]
    if macro_value &&  !File.exist?(macro_value)
      @prerequisites_resolved = false
    end
  end
  @qt_path_macros.each do |macro|
    macro_value = @tc.settings[macro]
    if macro_value && !Dir.exist?(macro_value)
      @prerequisites_resolved = false
    end
  end
  @checked = true
end

#check_oncebool

Check only once our sanity

Returns:

  • (bool)

    true if already checked or false if not



51
52
53
54
# File 'lib/rakeoe/qt_settings.rb', line 51

def check_once
  check unless @checked
  @prerequisites_resolved
end

#ldflagsString

Returns the ldflags configuration for the Qt linkage

Returns:

  • (String)

    ldflags used for linking qt applications



75
76
77
# File 'lib/rakeoe/qt_settings.rb', line 75

def ldflags
 " -L#{@tc.settings['OE_QMAKE_LIBDIR_QT']}"
end

#libsString

Returns the libs used for the Qt application linkage

Returns:

  • (String)

    Libraries used for linking qt apps. These are QtCore and QtNetwork by default. Add more libraries inside your project specific rake file if you need more.



82
83
84
# File 'lib/rakeoe/qt_settings.rb', line 82

def libs
  " QtCore#{@lib_infix} QtNetwork#{@lib_infix} QtDBus#{@lib_infix}"
end

#read_config(file) ⇒ KeyValueReader

Reads and parses the qt configuration

Parameters:

  • file (String)

    Filename of qt configuration file

Returns:

  • (KeyValueReader)

    Parsed configuration file accessible via properties



61
62
63
64
65
# File 'lib/rakeoe/qt_settings.rb', line 61

def read_config(file)
  if file && !file.empty?
    KeyValueReader.new(file)
  end
end