Class: BuildTool::BuildSystem::CMake
Defined Under Namespace
Classes: CMakeError
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, #check_install_prefix, #dup, #env, #install_prefix, #option_hash, #option_names, #option_set?, #parent, #prepare_for_installation, #prepend, #recipe, #remove_build_directory, #remove_source_directory, #set, #source_directory, #to_s
Constructor Details
#initialize(*args) ⇒ CMake
34
35
36
37
38
39
40
41
|
# File 'lib/build-tool/build-system/cmake.rb', line 34
def initialize( *args )
super( *args )
@supported_options <<
'CMAKE_BUILD_TYPE' <<
'CMAKE_CXXFLAGS' <<
'CMAKE_VERBOSE_MAKEFILE' <<
'LIB_SUFFIX'
end
|
Instance Method Details
#cmake(command, wd = build_directory) ⇒ Object
Execute a cmake command in the context of the build directory
69
70
71
72
73
74
75
|
# File 'lib/build-tool/build-system/cmake.rb', line 69
def cmake( command, wd = build_directory )
rc = self.class.execute "cmake #{command}", wd, env
if rc != 0
raise CMakeError, "cmake failed with error #{rc}!"
end
rc
end
|
77
78
79
80
81
82
83
|
# File 'lib/build-tool/build-system/cmake.rb', line 77
def configure
check_build_directory( true )
opt = option_string
opt += " -DCMAKE_INSTALL_PREFIX=#{install_prefix.to_s}" if install_prefix
rc = cmake "#{source_directory} #{opt}"
rc
end
|
Check if the module is configured
48
49
50
|
# File 'lib/build-tool/build-system/cmake.rb', line 48
def configured?
Pathname.new( build_directory ).join( 'Makefile' ).exist?
end
|
#install(fast) ⇒ Object
85
86
87
88
89
90
91
|
# File 'lib/build-tool/build-system/cmake.rb', line 85
def install( fast )
if fast
make( "install/fast" )
else
make( "install" )
end
end
|
#install_fast_supported? ⇒ Boolean
93
94
95
|
# File 'lib/build-tool/build-system/cmake.rb', line 93
def install_fast_supported?
true
end
|
#make(target = nil) ⇒ Object
97
98
99
|
# File 'lib/build-tool/build-system/cmake.rb', line 97
def make( target = nil )
Make.make( "#{target ? target : "" }", build_directory, self.module.environment.values )
end
|
#name ⇒ Object
52
53
54
|
# File 'lib/build-tool/build-system/cmake.rb', line 52
def name
"cmake"
end
|
#option_string ⇒ Object
101
102
103
104
105
106
107
108
|
# File 'lib/build-tool/build-system/cmake.rb', line 101
def option_string
arr = []
option_names.each do |var|
val = self[var]
arr << "-D#{var}='#{val}'"
end
arr.join(" ")
end
|
#progressbar(title, &block) ⇒ Object
110
111
112
113
114
|
# File 'lib/build-tool/build-system/cmake.rb', line 110
def progressbar( title, &block )
Progressbar.new( title ) do
yield
end
end
|
61
62
63
64
65
66
|
# File 'lib/build-tool/build-system/cmake.rb', line 61
def reconfigure()
if File.exist?( "#{build_directory}/CMakeCache.txt" )
return false if self.class.execute( "rm -f #{build_directory}/CMakeCache.txt" ) != 0
end
configure
end
|