Class: Gears::CMake

Inherits:
Gear
  • Object
show all
Defined in:
lib/gears/cmake.rb

Instance Attribute Summary

Attributes inherited from Gear

#build_path, #built, #checked, #headers, #installed, #libs, #obtained

Instance Method Summary collapse

Methods inherited from Gear

#disengage, #engage, #gear_exec, #gear_exec_mac, #git_obtain, #github_obtain, #initialize, initialized?, install_path, #name, #remove, #std_config_make, #std_make_install, #target

Constructor Details

This class inherits a constructor from Gear

Instance Method Details

#buildObject



25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/gears/cmake.rb', line 25

def build()
  puts 'Engaging CMake dependencies'
  la = Gears::LibArchive.new
  la.engage

  puts "Building CMake in #{@build_path}"
  Dir.chdir(@build_path)
  `./configure --prefix=#{@@install_path}`
  `make`
  @built = true
  return true
end

#checkObject



9
10
11
12
13
14
15
16
17
18
# File 'lib/gears/cmake.rb', line 9

def check()
  puts 'Checking for CMake'
  if RUBY_PLATFORM.match(/darwin/)
    @checked = gear_exec_mac > 0 ? true : false
  else
    gear_exec 'cmake --version'
    @checked = $?.exitstatus == 0 ? true : false
  end
  return @checked
end

#installObject



38
39
40
41
# File 'lib/gears/cmake.rb', line 38

def install()
  puts "Installing CMake to #{@@install_path}"
  std_make_install
end

#obtainObject



20
21
22
23
# File 'lib/gears/cmake.rb', line 20

def obtain()
  puts 'Obtaining CMake'
  github_obtain('Kitware', 'CMake')
end

#uninstallObject



43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/gears/cmake.rb', line 43

def uninstall()
  puts 'Uninstalling CMake'
  FileUtils.rm_f("#{@@install_path}/bin/ccmake")
  FileUtils.rm_f("#{@@install_path}/bin/cmake")
  FileUtils.rm_f("#{@@install_path}/bin/cmakexbuild")
  FileUtils.rm_f("#{@@install_path}/bin/cpack")
  FileUtils.rm_f("#{@@install_path}/bin/ctest")
  FileUtils.rm_rf(Dir.glob("#{@@install_path}/doc/cmake-*"))
  FileUtils.rm_rf("#{@@install_path}/share/aclocal")
  FileUtils.rm_rf(Dir.glob("#{@@install_path}/share/cmake-*"))
  @installed = false
  return true
end