Class: MiniPortileCMake

Inherits:
MiniPortile show all
Defined in:
lib/mini_portile2/mini_portile_cmake.rb

Constant Summary

Constants inherited from MiniPortile

MiniPortile::DEFAULT_TIMEOUT, MiniPortile::VERSION

Instance Attribute Summary

Attributes inherited from MiniPortile

#configure_options, #files, #host, #logger, #name, #original_host, #patch_files, #source_directory, #target, #version

Instance Method Summary collapse

Methods inherited from MiniPortile

#activate, #apply_patch, #compile, #cook, #download, #downloaded?, #extract, #gcc_cmd, #install, #installed?, mingw?, mswin?, #patch, #path, #prepare_build_directory, windows?

Constructor Details

#initialize(name, version, **kwargs) ⇒ MiniPortileCMake

Returns a new instance of MiniPortileCMake.



8
9
10
11
# File 'lib/mini_portile2/mini_portile_cmake.rb', line 8

def initialize(name, version, **kwargs)
  super(name, version, **kwargs)
  @cmake_command = kwargs[:cmake_command]
end

Instance Method Details

#cmake_cmdObject



48
49
50
# File 'lib/mini_portile2/mini_portile_cmake.rb', line 48

def cmake_cmd
  (ENV["CMAKE"] || @cmake_command || "cmake").dup
end

#configureObject



23
24
25
26
27
28
29
30
# File 'lib/mini_portile2/mini_portile_cmake.rb', line 23

def configure
  return if configured?

  cache_file = File.join(tmp_path, 'configure.options_cache')
  File.open(cache_file, "w") { |f| f.write computed_options.to_s }

  execute('configure', [cmake_cmd] + computed_options + ["."])
end

#configure_defaultsObject



13
14
15
16
17
18
19
20
21
# File 'lib/mini_portile2/mini_portile_cmake.rb', line 13

def configure_defaults
  if MiniPortile.mswin?
    ['-G', 'NMake Makefiles']
  elsif MiniPortile.mingw?
    ['-G', 'MSYS Makefiles']
  else
    []
  end
end

#configure_prefixObject



4
5
6
# File 'lib/mini_portile2/mini_portile_cmake.rb', line 4

def configure_prefix
  "-DCMAKE_INSTALL_PREFIX=#{File.expand_path(port_path)}"
end

#configured?Boolean

Returns:

  • (Boolean)


32
33
34
35
36
37
38
39
40
41
# File 'lib/mini_portile2/mini_portile_cmake.rb', line 32

def configured?
  configure = File.join(work_path, 'configure')
  makefile  = File.join(work_path, 'CMakefile')
  cache_file  = File.join(tmp_path, 'configure.options_cache')

  stored_options  = File.exist?(cache_file) ? File.read(cache_file) : ""
  current_options = computed_options.to_s

  (current_options == stored_options) && newer?(makefile, configure)
end

#make_cmdObject



43
44
45
46
# File 'lib/mini_portile2/mini_portile_cmake.rb', line 43

def make_cmd
  return "nmake" if MiniPortile.mswin?
  super
end