rustorb-dds 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 6604e9de66bfc0fc25c68b9fadecb0f3e8ce996bf359150faafcc4608bd736da
4
+ data.tar.gz: 866d4482e26373016f1b40a121f659ca07404fc44b32a494c4bbfc216da6ae5f
5
+ SHA512:
6
+ metadata.gz: 5f69058a96f95a654e6663824578cc7f3779eef0d79adcb353bc2f0304efb9b1474ae0fab2291ed36df7b6f208618c71546a6043545046d154b0b2b28583a7c7
7
+ data.tar.gz: d2f9da4b596d236b5e65bb99fbf68c47f0149b1786ae7ede2ce246ea913491e8b7ab96499c4b376b3f4ec9d2b3b1da382309f5c24b40efdb69cc09523a4b4a5f
data/README.md ADDED
@@ -0,0 +1,26 @@
1
+ # rustorb-dds (Ruby)
2
+
3
+ The Ruby binding of [rustorb-dds](https://github.com/rustorb/rustorb-dds),
4
+ a DDS implementation written in Rust (DDS 1.4, DDS-XTypes 1.3, RTPS 2.5):
5
+ the structure of the DDS C++ PSM in Ruby (`DDS::Domain`, `DDS::Pub`,
6
+ `DDS::Sub`, `DDS::Topic`, `DDS::Core`) as a C extension on rustorb-dds's C
7
+ ABI. Types are generated from IDL with
8
+ [rustorb-idl](https://github.com/rustorb/rustorb-idl):
9
+ `rustorb-idl -bruby -Wbdds_only Foo.idl` writes `Foo_dds.rb`.
10
+
11
+ ```ruby
12
+ require "rustorb/dds"
13
+ require_relative "HelloWorld_dds"
14
+
15
+ dp = DDS::Domain::DomainParticipant.new(0)
16
+ topic = DDS::Topic::Topic.new(dp, "hello_world", HelloWorld::Greeting)
17
+ qos = DDS::Pub::DataWriterQos.new << DDS::Core::Policy::Reliability.reliable
18
+ writer = DDS::Pub::DataWriter.new(DDS::Pub::Publisher.new(dp), topic, qos)
19
+ writer.write(HelloWorld::Greeting.new(1, "Hello, world!"))
20
+ ```
21
+
22
+ From a checkout: `cd ruby && rake` builds `librustorb_dds_ffi` (cargo) and
23
+ the extension and runs the tests. See
24
+ [docs/ruby.md](https://github.com/rustorb/rustorb-dds/blob/main/docs/ruby.md).
25
+
26
+ Licensed under MIT OR Apache-2.0.
@@ -0,0 +1,36 @@
1
+ # Builds rustorb_dds_ext against librustorb_dds_ffi (crates/rustorb-dds-ffi),
2
+ # linked statically. RUSTORB_DDS_FFI_LIBRARY names the library,
3
+ # RUSTORB_DDS_FFI_INCLUDE the directory of rustorb/dds.h. By default: the
4
+ # ones the released gem carries for this platform
5
+ # (vendor/<platform>/librustorb_dds_ffi.a and vendor/include), else those of
6
+ # the checkout this gem is in (target/release/librustorb_dds_ffi.a after
7
+ # cargo build --release -p rustorb-dds-ffi).
8
+ #
9
+ # Licensed under MIT OR Apache-2.0, like the rest of rustorb-dds.
10
+ require "mkmf"
11
+
12
+ gem_root = File.expand_path("../..", __dir__)
13
+ root = File.expand_path("..", gem_root)
14
+ cpu = RbConfig::CONFIG["host_cpu"].sub(/\Aarm64\z/, "aarch64")
15
+ os = RbConfig::CONFIG["host_os"] =~ /darwin/ ? "macos" : "linux"
16
+ vendor = File.join(gem_root, "vendor")
17
+ vendored = File.join(vendor, "#{os}-#{cpu}", "librustorb_dds_ffi.a")
18
+ lib = ENV["RUSTORB_DDS_FFI_LIBRARY"] ||
19
+ (File.exist?(vendored) ? vendored : File.join(root, "target", "release", "librustorb_dds_ffi.a"))
20
+ inc = ENV["RUSTORB_DDS_FFI_INCLUDE"] ||
21
+ (File.exist?(File.join(vendor, "include", "rustorb", "dds.h")) ? File.join(vendor, "include") :
22
+ File.join(root, "crates", "rustorb-dds-ffi", "include"))
23
+ unless File.exist?(lib)
24
+ abort "librustorb_dds_ffi not found for #{os}-#{cpu}: #{lib} " \
25
+ "(set RUSTORB_DDS_FFI_LIBRARY, or cargo build --release -p rustorb-dds-ffi)"
26
+ end
27
+
28
+ $INCFLAGS << " -I#{inc}"
29
+ $CFLAGS << " -std=c99 -Wall -Wextra -Wno-unused-parameter -D_POSIX_C_SOURCE=200809L"
30
+ $LOCAL_LIBS << " #{lib}"
31
+ if RUBY_PLATFORM =~ /darwin/
32
+ $LDFLAGS << " -framework CoreFoundation -framework Security -framework SystemConfiguration"
33
+ else
34
+ $LIBS << " -lpthread -ldl -lm"
35
+ end
36
+ create_makefile("rustorb/dds/rustorb_dds_ext")