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 collapse

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, darwin?, #download, #downloaded?, #extract, freebsd?, #gcc_cmd, #include_path, #install, #installed?, #lib_path, linux?, mingw?, #mkmf_config, mswin?, native_path, openbsd?, #patch, #path, posix_path, #prepare_build_directory, solaris?, target_cpu, target_os, windows?

Constructor Details

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

Returns a new instance of MiniPortileCMake.



11
12
13
14
15
# File 'lib/mini_portile2/mini_portile_cmake.rb', line 11

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

Instance Attribute Details

#system_nameObject

Returns the value of attribute system_name.



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

def system_name
  @system_name
end

Instance Method Details

#cmake_build_typeObject



53
54
55
# File 'lib/mini_portile2/mini_portile_cmake.rb', line 53

def cmake_build_type
  (ENV["CMAKE_BUILD_TYPE"] || @cmake_build_type || "Release").dup
end

#cmake_cmdObject



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

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

#configureObject



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

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



17
18
19
20
21
22
# File 'lib/mini_portile2/mini_portile_cmake.rb', line 17

def configure_defaults
  [
    generator_defaults,
    cmake_compile_flags,
  ].flatten
end

#configure_prefixObject



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

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

#configured?Boolean

Returns:

  • (Boolean)


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

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



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

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