Class: Qt::Qmake
- Inherits:
-
Object
- Object
- Qt::Qmake
- Defined in:
- lib/qt/qmake.rb
Constant Summary collapse
- QMAKES =
%w{qmake-qt4 qmake}
Class Method Summary collapse
- .best_qmake ⇒ Object
- .command(project_file = nil) ⇒ Object
- .installed? ⇒ Boolean
- .make!(name, project_file = nil) ⇒ Object
- .make_installed? ⇒ Boolean
- .make_path ⇒ Object
-
.path ⇒ Object
We need integration tests for these!.
- .platform ⇒ Object
- .qt_version_of(qmake_path) ⇒ Object
Class Method Details
.best_qmake ⇒ Object
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/qt/qmake.rb', line 71 def best_qmake if qmake_path = QMAKES.collect do |path| result = nil if qmake_path = get_exe_path(path) if (qt_version = qt_version_of(qmake_path)) >= Gem::Version.create('4.7') result = [ qmake_path, qt_version ] end end result end.compact.sort { |a, b| b.last <=> a.last }.first qmake_path.first else nil end end |
.command(project_file = nil) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/qt/qmake.rb', line 19 def command(project_file = nil) spec = (case platform when :linux "linux-g++" when :freebsd "freebsd-g++" when :mac_os_x "macx-g++" end) command = "#{path} #{envs} -spec #{spec}" command << " #{project_file}" if project_file command end |
.installed? ⇒ Boolean
11 12 13 |
# File 'lib/qt/qmake.rb', line 11 def installed? path != nil end |
.make!(name, project_file = nil) ⇒ Object
34 35 36 37 38 39 40 41 42 43 |
# File 'lib/qt/qmake.rb', line 34 def make!(name, project_file = nil) @name = name check_make! check_qmake! system command(project_file) system %{make} end |
.make_installed? ⇒ Boolean
15 16 17 |
# File 'lib/qt/qmake.rb', line 15 def make_installed? make_path != nil end |
.make_path ⇒ Object
52 53 54 |
# File 'lib/qt/qmake.rb', line 52 def make_path get_exe_path('gmake') || get_exe_path('make') end |
.path ⇒ Object
We need integration tests for these!
48 49 50 |
# File 'lib/qt/qmake.rb', line 48 def path @path ||= best_qmake end |
.platform ⇒ Object
56 57 58 59 60 61 62 63 64 65 |
# File 'lib/qt/qmake.rb', line 56 def platform case RbConfig::CONFIG['host_os'] when /linux/ :linux when /freebsd/i :freebsd when /darwin/ :mac_os_x end end |
.qt_version_of(qmake_path) ⇒ Object
67 68 69 |
# File 'lib/qt/qmake.rb', line 67 def qt_version_of(qmake_path) Gem::Version.new(%x{#{qmake_path} -v}.lines.to_a[1][%r{Using Qt version ([^ ]+) },1]) end |