Class: Tebako::ScenarioManagerBase
- Inherits:
-
Object
- Object
- Tebako::ScenarioManagerBase
- Defined in:
- lib/tebako/scenario_manager.rb
Overview
A couple of static Scenario definitions
Direct Known Subclasses
Instance Attribute Summary collapse
-
#exe_suffix ⇒ Object
readonly
Returns the value of attribute exe_suffix.
-
#fs_mount_point ⇒ Object
readonly
Returns the value of attribute fs_mount_point.
Instance Method Summary collapse
- #b_env ⇒ Object
-
#initialize(ostype = RUBY_PLATFORM) ⇒ ScenarioManagerBase
constructor
A new instance of ScenarioManagerBase.
- #linux? ⇒ Boolean
- #linux_gnu? ⇒ Boolean
- #linux_musl? ⇒ Boolean
- #m_files ⇒ Object
- #macos? ⇒ Boolean
- #msys? ⇒ Boolean
- #musl? ⇒ Boolean
- #ncores ⇒ Object
Constructor Details
#initialize(ostype = RUBY_PLATFORM) ⇒ ScenarioManagerBase
Returns a new instance of ScenarioManagerBase.
43 44 45 46 47 48 49 50 51 52 |
# File 'lib/tebako/scenario_manager.rb', line 43 def initialize(ostype = RUBY_PLATFORM) @ostype = ostype @linux = @ostype =~ /linux/ ? true : false @musl = @ostype =~ /linux-musl/ ? true : false @macos = @ostype =~ /darwin/ ? true : false @msys = @ostype =~ /msys|mingw|cygwin/ ? true : false @fs_mount_point = @msys ? "A:/__tebako_memfs__" : "/__tebako_memfs__" @exe_suffix = @msys ? ".exe" : "" end |
Instance Attribute Details
#exe_suffix ⇒ Object (readonly)
Returns the value of attribute exe_suffix.
54 55 56 |
# File 'lib/tebako/scenario_manager.rb', line 54 def exe_suffix @exe_suffix end |
#fs_mount_point ⇒ Object (readonly)
Returns the value of attribute fs_mount_point.
54 55 56 |
# File 'lib/tebako/scenario_manager.rb', line 54 def fs_mount_point @fs_mount_point end |
Instance Method Details
#b_env ⇒ Object
56 57 58 59 60 61 62 63 64 65 |
# File 'lib/tebako/scenario_manager.rb', line 56 def b_env u_flags = if @macos "-DTARGET_OS_SIMULATOR=0 -DTARGET_OS_IPHONE=0 #{ENV.fetch("CXXFLAGS", nil)}" elsif @msys "-DGFLAGS_IS_A_DLL=0 #{ENV.fetch("CXXFLAGS", nil)}" else ENV.fetch("CXXFLAGS", nil) end @b_env ||= { "CXXFLAGS" => u_flags } end |
#linux? ⇒ Boolean
67 68 69 |
# File 'lib/tebako/scenario_manager.rb', line 67 def linux? @linux end |
#linux_gnu? ⇒ Boolean
71 72 73 |
# File 'lib/tebako/scenario_manager.rb', line 71 def linux_gnu? @linux && !@musl end |
#linux_musl? ⇒ Boolean
75 76 77 |
# File 'lib/tebako/scenario_manager.rb', line 75 def linux_musl? @linux && @musl end |
#m_files ⇒ Object
79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/tebako/scenario_manager.rb', line 79 def m_files # [TODO] # Ninja generates incorrect script for tebako press target -- gets lost in a chain custom targets # Using makefiles has negative performance impact so it needs to be fixed @m_files ||= if @linux || @macos "Unix Makefiles" elsif @msys "MinGW Makefiles" else raise Tebako::Error.new("#{RUBY_PLATFORM} is not supported.", 112) end end |
#macos? ⇒ Boolean
93 94 95 |
# File 'lib/tebako/scenario_manager.rb', line 93 def macos? @macos end |
#msys? ⇒ Boolean
97 98 99 |
# File 'lib/tebako/scenario_manager.rb', line 97 def msys? @msys end |
#musl? ⇒ Boolean
101 102 103 |
# File 'lib/tebako/scenario_manager.rb', line 101 def musl? @musl end |
#ncores ⇒ Object
105 106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/tebako/scenario_manager.rb', line 105 def ncores if @ncores.nil? if @macos out, st = Open3.capture2e("sysctl", "-n", "hw.ncpu") else out, st = Open3.capture2e("nproc", "--all") end @ncores = !st.signaled? && st.exitstatus.zero? ? out.strip.to_i : 4 end @ncores end |