Module: MilkTea::VendoredFlecs
- Defined in:
- lib/milk_tea/bindings/vendored_flecs.rb
Constant Summary collapse
- Error =
VendoredCLibrary::Error
- SOURCE_NAME =
"flecs"- SOURCES =
%w[ distr/flecs.c ].freeze
- SYSTEM_LINK_FLAGS =
%w[ -lrt -lpthread -lm ].freeze
- C_FLAGS =
%w[ -std=gnu99 ].freeze
Class Method Summary collapse
- .archive_path(root: MilkTea.root) ⇒ Object
- .build_root(root: MilkTea.root) ⇒ Object
- .header_path(root: MilkTea.root) ⇒ Object
- .include_flags(root: MilkTea.root) ⇒ Object
- .include_root(root: MilkTea.root) ⇒ Object
- .library(root: MilkTea.root) ⇒ Object
- .link_flags(root: MilkTea.root) ⇒ Object
- .prepare!(root: MilkTea.root, **kwargs) ⇒ Object
- .source(root: MilkTea.root) ⇒ Object
- .source_root(root: MilkTea.root) ⇒ Object
Class Method Details
.archive_path(root: MilkTea.root) ⇒ Object
61 62 63 |
# File 'lib/milk_tea/bindings/vendored_flecs.rb', line 61 def archive_path(root: MilkTea.root) build_root(root:).join("libflecs.a") end |
.build_root(root: MilkTea.root) ⇒ Object
57 58 59 |
# File 'lib/milk_tea/bindings/vendored_flecs.rb', line 57 def build_root(root: MilkTea.root) MilkTea.writable_root_for(root).join("tmp/vendored-flecs") end |
.header_path(root: MilkTea.root) ⇒ Object
53 54 55 |
# File 'lib/milk_tea/bindings/vendored_flecs.rb', line 53 def header_path(root: MilkTea.root) include_root(root:).join("flecs.h") end |
.include_flags(root: MilkTea.root) ⇒ Object
65 66 67 |
# File 'lib/milk_tea/bindings/vendored_flecs.rb', line 65 def include_flags(root: MilkTea.root) library(root:).include_flags end |
.include_root(root: MilkTea.root) ⇒ Object
49 50 51 |
# File 'lib/milk_tea/bindings/vendored_flecs.rb', line 49 def include_root(root: MilkTea.root) source_root(root:).join("distr") end |
.library(root: MilkTea.root) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/milk_tea/bindings/vendored_flecs.rb', line 29 def library(root: MilkTea.root) resolved_root = Pathname.new(File.(root.to_s)) @libraries ||= {} @libraries[resolved_root.to_s] ||= VendoredCLibrary::Archive.new( name: "flecs", source_root: source_root(root: resolved_root), build_root: build_root(root: resolved_root), archive_name: "libflecs.a", sources: SOURCES, include_roots: [include_root(root: resolved_root)], system_link_flags: SYSTEM_LINK_FLAGS, cc_env_var: "FLECS_CC", c_flags: C_FLAGS, ) end |
.link_flags(root: MilkTea.root) ⇒ Object
69 70 71 |
# File 'lib/milk_tea/bindings/vendored_flecs.rb', line 69 def link_flags(root: MilkTea.root) library(root:).link_flags end |
.prepare!(root: MilkTea.root, **kwargs) ⇒ Object
73 74 75 76 |
# File 'lib/milk_tea/bindings/vendored_flecs.rb', line 73 def prepare!(root: MilkTea.root, **kwargs) source(root:).bootstrap! library(root:).prepare!(**kwargs) end |
.source(root: MilkTea.root) ⇒ Object
24 25 26 27 |
# File 'lib/milk_tea/bindings/vendored_flecs.rb', line 24 def source(root: MilkTea.root) UpstreamSources.default_sources(root:).find { |entry| entry.name == SOURCE_NAME } || raise(Error, "missing upstream source definition for #{SOURCE_NAME}") end |