Class: VisualStudio::Windows::SoftwareDevelopmentKit
- Inherits:
-
Object
- Object
- VisualStudio::Windows::SoftwareDevelopmentKit
- Defined in:
- lib/visual_studio/sdks/windows.rb
Constant Summary collapse
- VERSIONS =
[10.0, 8.1, 8.0, 7.1, 7.0].map(&:to_s)
Instance Attribute Summary collapse
-
#binaries ⇒ Object
readonly
Returns the value of attribute binaries.
-
#includes ⇒ Object
readonly
Returns the value of attribute includes.
-
#libraries ⇒ Object
readonly
Returns the value of attribute libraries.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#root ⇒ Object
readonly
Returns the value of attribute root.
-
#supports ⇒ Object
readonly
Returns the value of attribute supports.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(desc) ⇒ SoftwareDevelopmentKit
constructor
A new instance of SoftwareDevelopmentKit.
Constructor Details
#initialize(desc) ⇒ SoftwareDevelopmentKit
14 15 16 17 18 19 20 21 22 |
# File 'lib/visual_studio/sdks/windows.rb', line 14 def initialize(desc) @name = desc[:name] @version = desc[:version] @root = desc[:root] @includes = desc[:includes] @libraries = desc[:libraries] @binaries = desc[:binaries] @supports = desc[:supports] end |
Instance Attribute Details
#binaries ⇒ Object (readonly)
Returns the value of attribute binaries.
6 7 8 |
# File 'lib/visual_studio/sdks/windows.rb', line 6 def binaries @binaries end |
#includes ⇒ Object (readonly)
Returns the value of attribute includes.
6 7 8 |
# File 'lib/visual_studio/sdks/windows.rb', line 6 def includes @includes end |
#libraries ⇒ Object (readonly)
Returns the value of attribute libraries.
6 7 8 |
# File 'lib/visual_studio/sdks/windows.rb', line 6 def libraries @libraries end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/visual_studio/sdks/windows.rb', line 6 def name @name end |
#root ⇒ Object (readonly)
Returns the value of attribute root.
6 7 8 |
# File 'lib/visual_studio/sdks/windows.rb', line 6 def root @root end |
#supports ⇒ Object (readonly)
Returns the value of attribute supports.
6 7 8 |
# File 'lib/visual_studio/sdks/windows.rb', line 6 def supports @supports end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
6 7 8 |
# File 'lib/visual_studio/sdks/windows.rb', line 6 def version @version end |
Class Method Details
.find(version) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 |
# File 'lib/visual_studio/sdks/windows.rb', line 24 def self.find(version) if Windows::SoftwareDevelopmentKit::VERSIONS.include?(version) # TODO(mtwilliams): Select the 64-bit and ARM host variants when # applicable, i.e. when running on 64-bit or ARM. name, version, root, includes, libraries, binaries, supports = case version.to_f when 7.0..7.1 name, root = self._find_via_registry(version) return nil if root.nil? includes = [File.join(root, 'include')] libraries = {:x86 => [File.join(root, 'lib')], :x86_64 => [File.join(root, 'lib', 'x64')].select{|path| Dir.exists?(path)}} binaries = {:x86 => [File.join(root, 'bin')], :x86_64 => [File.join(root, 'bin', 'x64')].select{|path| Dir.exists?(path)}} supports = [] supports << :x86 supports << :x86_64 if !libraries[:x86_64].empty? [name, version, root, includes, libraries, binaries, supports] when 8.0 name, root = self._find_kit_via_registry(version) return nil if root.nil? includes = [File.join(root, 'include', 'shared'), File.join(root, 'include', 'um')] libraries = {:x86 => [File.join(root, 'lib', 'win8', 'um', 'x86')], :x86_64 => [File.join(root, 'lib', 'win8', 'um', 'x64')]} binaries = {:x86 => [File.join(root, 'bin', 'x86')], :x86_64 => [File.join(root, 'bin', 'x64')]} supports = [:x86, :x86_64] [name, version, root, includes, libraries, binaries, supports] when 8.1 name, root = self._find_kit_via_registry(version) return nil if root.nil? includes = [File.join(root, 'include', 'shared'), File.join(root, 'include', 'um')] libraries = {:x86 => [File.join(root, 'lib', 'winv6.3', 'um', 'x86')], :x86_64 => [File.join(root, 'lib', 'winv6.3', 'um', 'x64')], :arm => [File.join(root, 'lib', 'winv6.3', 'um', 'arm')]} binaries = {:x86 => [File.join(root, 'bin', 'x86')], :x86_64 => [File.join(root, 'bin', 'x64')], :arm => [File.join(root, 'bin', 'arm')]} supports = [:x86, :x86_64, :arm] [name, version, root, includes, libraries, binaries, supports] when 10.0 name, root = self._find_kit_via_registry(version) return nil if root.nil? # HACK(mtwilliams): Determine the latest and greatest version # by finding the directory with the highest version number. We # should look into using the 'PlatformIdentity' attribute in SDKManifest.xml. version = Dir.entries(File.join(root, 'lib')).sort.last includes = [File.join(root, 'include', version, 'ucrt'), File.join(root, 'include', version, 'shared'), File.join(root, 'include', version, 'um')] libraries = {:x86 => [File.join(root, 'lib', version, 'ucrt', 'x86'), File.join(root, 'lib', version, 'um', 'x86')], :x86_64 => [File.join(root, 'lib', version, 'ucrt', 'x64'), File.join(root, 'lib', version, 'um', 'x64')], :arm => [File.join(root, 'lib', version, 'ucrt', 'arm'), File.join(root, 'lib', version, 'um', 'arm')]} binaries = {:x86 => [File.join(root, 'bin', 'x86')], :x86_64 => [File.join(root, 'bin', 'x64')], :arm => [File.join(root, 'bin', 'arm')]} supports = [:x86, :x86_64, :arm] [name, '10.0', root, includes, libraries, binaries, supports] else # TODO(mtwilliams): Raise an exception. # raise VisualStudio::UnsupportedVersion.new(...) end Windows::SoftwareDevelopmentKit.new(name: name, version: version, root: root, includes: includes, libraries: libraries, binaries: binaries, supports: supports) else # TODO(mtwilliams): Raise an exception. # raise VisualStudio::InvalidVersion.new(...) end end |