lib/autobuild/packages/cmake.rb in autobuild-1.8.3 vs lib/autobuild/packages/cmake.rb in autobuild-1.9.0.b1
- old
+ new
@@ -74,19 +74,20 @@
@defines = Hash.new
super
end
def define(name, value)
- @defines[name] = value
+ @defines[name] =
+ if value.respond_to?(:to_str)
+ value.to_str
+ elsif value
+ 'ON'
+ else
+ 'OFF'
+ end
end
- def doc_dir
- if @doc_dir
- File.expand_path(@doc_dir, builddir)
- end
- end
-
DOXYGEN_ACCEPTED_VARIABLES = {
'@CMAKE_SOURCE_DIR@' => lambda { |pkg| pkg.srcdir },
'@PROJECT_SOURCE_DIR@' => lambda { |pkg| pkg.srcdir },
'@CMAKE_BINARY_DIR@' => lambda { |pkg| pkg.builddir },
'@PROJECT_BINARY_DIR@' => lambda { |pkg| pkg.builddir },
@@ -263,17 +264,17 @@
def prepare
# A failed initial CMake configuration leaves a CMakeCache.txt file,
# but no Makefile.
#
# Delete the CMakeCache to force reconfiguration
- if !File.exists?( File.join(builddir, 'Makefile') )
+ if !File.exist?( File.join(builddir, 'Makefile') )
FileUtils.rm_f cmake_cache
end
doc_utility.source_ref_dir = builddir
- if File.exists?(cmake_cache)
+ if File.exist?(cmake_cache)
all_defines = defines.dup
all_defines['CMAKE_INSTALL_PREFIX'] = prefix
all_defines['CMAKE_MODULE_PATH'] = "#{CMake.module_path.join(";")}"
cache = File.read(cmake_cache)
did_change = all_defines.any? do |name, value|
@@ -359,28 +360,28 @@
@show_make_messages = value
end
# Do the build in builddir
def build
+ current_message = String.new
in_dir(builddir) do
progress_start "building %s" do
if always_reconfigure || !File.file?('Makefile')
Subprocess.run(self, 'build', Autobuild.tool(:cmake), '.')
end
- current_message = String.new
warning_count = 0
Autobuild.make_subcommand(self, 'build') do |line|
needs_display = false
if line =~ /\[\s*(\d+)%\]/
progress "building %s (#{Integer($1)}%)"
- elsif line !~ /^(?:Linking|Scanning|Building|Built)/
+ elsif line !~ /^(?:Generating|Linking|Scanning|Building|Built)/
if line =~ /warning/
warning_count += 1
end
if show_make_messages?
- current_message += line
+ current_message += line + "\n"
needs_display = true
end
end
if !needs_display && !current_message.empty?
current_message.split("\n").each do |l|
@@ -398,9 +399,14 @@
progress_done "built %s"
end
end
end
Autobuild.touch_stamp(buildstamp)
+ rescue ::Exception
+ current_message.split("\n").each do |l|
+ message "%s: #{l}", :magenta
+ end
+ raise
end
# Install the result in prefix
def install
in_dir(builddir) do