msdfgen_lib/lib.rs
1/*!
2# Bundled msdfgen library
3
4This crate provides bundled [msdfgen](https://github.com/Chlumsky/msdfgen) library for using with [__msdfgen__](https://crates.io/crates/msdfgen) crate.
5
6## Usage
7
8You can simply add this as dependency to your manifest:
9
10```toml
11[dependencies]
12msdfgen = "^0.1"
13
14# Use bundled library to avoid unresolved links
15msdfgen-lib = "^0.1"
16```
17
18Next you should say compiler that you want to use that crate:
19
20```rust
21// Either in traditional manner
22extern crate msdfgen_lib;
23
24// Or in Rust2018 manner
25use msdfgen_lib as _;
26```
27
28## Features
29
30You can apply some customizations to library using those features:
31
32- __shared__ Force bundle shared (or dynamic) library instead of static (default)
33- __libcxx__ Link with _libc++_ instead of _libstdc++_ (default)
34- __stdcxx-static__ Link with static C++ stdlib instead of shared (default)
35
36 */
37
38#[cfg(test)]
39mod test {
40 #[repr(C)]
41 struct msdfgen_SignedDistance {
42 distance: f64,
43 dot: f64,
44 }
45
46 extern "C" {
47 #[link_name = "\u{1}_ZN7msdfgen14SignedDistance8INFINITEE"]
48 static msdfgen_SignedDistance_INFINITE: msdfgen_SignedDistance;
49 }
50
51 #[test]
52 fn linking() {
53 let infinite = unsafe { &msdfgen_SignedDistance_INFINITE };
54
55 assert_eq!(infinite.distance, -1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0);
56 assert_eq!(infinite.dot, 1.0);
57 }
58}