Class: MilkTea::VendoredSteamworks::Library
- Inherits:
-
MilkTea::VendoredCLibrary::Base
- Object
- MilkTea::VendoredCLibrary::Base
- MilkTea::VendoredSteamworks::Library
- Defined in:
- lib/milk_tea/bindings/vendored_steamworks.rb
Instance Attribute Summary collapse
-
#build_root ⇒ Object
readonly
Returns the value of attribute build_root.
-
#root ⇒ Object
readonly
Returns the value of attribute root.
Attributes inherited from MilkTea::VendoredCLibrary::Base
#include_roots, #name, #source_root
Instance Method Summary collapse
-
#initialize(root: MilkTea.root) ⇒ Library
constructor
A new instance of Library.
- #link_flags(platform: nil) ⇒ Object
- #prepare!(env: ENV, cc: ENV.fetch("CC", "cc"), platform: nil) ⇒ Object
Methods inherited from MilkTea::VendoredCLibrary::Base
Constructor Details
#initialize(root: MilkTea.root) ⇒ Library
Returns a new instance of Library.
20 21 22 23 24 |
# File 'lib/milk_tea/bindings/vendored_steamworks.rb', line 20 def initialize(root: MilkTea.root) @root = Pathname.new(File.(root.to_s)) @build_root = MilkTea.writable_root_for(root).join("tmp/vendored-steamworks") super(name: "steamworks", source_root: MilkTea.writable_root_for(root).join("third_party/steamworks-sdk-upstream")) end |
Instance Attribute Details
#build_root ⇒ Object (readonly)
Returns the value of attribute build_root.
18 19 20 |
# File 'lib/milk_tea/bindings/vendored_steamworks.rb', line 18 def build_root @build_root end |
#root ⇒ Object (readonly)
Returns the value of attribute root.
18 19 20 |
# File 'lib/milk_tea/bindings/vendored_steamworks.rb', line 18 def root @root end |
Instance Method Details
#link_flags(platform: nil) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/milk_tea/bindings/vendored_steamworks.rb', line 26 def link_flags(platform: nil) resolved_platform = platform || host_platform case resolved_platform when :windows copied_import_library = build_root.join(MilkTea::Steamworks::IMPORT_LIBRARY_BASENAME_BY_PLATFORM.fetch(resolved_platform)) return [copied_import_library.to_s] if File.file?(copied_import_library) ["-L#{build_root}"] else ["-L#{build_root}"] end end |
#prepare!(env: ENV, cc: ENV.fetch("CC", "cc"), platform: nil) ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/milk_tea/bindings/vendored_steamworks.rb', line 40 def prepare!(env: ENV, cc: ENV.fetch("CC", "cc"), platform: nil) _resolved_cc = resolved_cc(env, cc) FileUtils.mkdir_p(build_root) resolved_platform = platform || host_platform import_library = MilkTea::Steamworks.import_library_path(root:, env:, platform: resolved_platform, bootstrap: true) runtime_library = MilkTea::Steamworks.runtime_library_path(root:, env:, platform: resolved_platform, bootstrap: true) copy_if_present(import_library) copy_if_present(runtime_library) rescue Errno::ENOENT => e raise tool_not_found(e) end |