xref: /libCEED/rust/libceed-sys/src/lib.rs (revision 8a059566a00d2f44ccef3f872c398f1e412e74dd)
1 // Copyright (c) 2017, Lawrence Livermore National Security, LLC. Produced at
2 // the Lawrence Livermore National Laboratory. LLNL-CODE-734707. All Rights
3 // reserved. See files LICENSE and NOTICE for details.
4 //
5 // This file is part of CEED, a collection of benchmarks, miniapps, software
6 // libraries and APIs for efficient high-order finite element and spectral
7 // element discretizations for exascale applications. For more information and
8 // source code availability see http://github.com/ceed.
9 //
10 // The CEED research is supported by the Exascale Computing Project 17-SC-20-SC,
11 // a collaborative effort of two U.S. Department of Energy organizations (Office
12 // of Science and the National Nuclear Security Administration) responsible for
13 // the planning and preparation of a capable exascale ecosystem, including
14 // software, applications, hardware, advanced system engineering and early
15 // testbed platforms, in support of the nation's exascale computing imperative
16 
17 /*!
18 # libCEED Rust Interface
19 
20 This is the documentation for the low level (unsafe) Rust bindings to the libCEED C
21 interface. See the [libCEED user manual](https://libceed.readthedocs.io) for usage
22 information. Note that most Rust users will prefer the higher level (safe) Rust
23 interface in the [libceed](https://lib.rs/libceed) package.
24 
25 libCEED is a low-level API for for the efficient high-order discretization methods
26 developed by the ECP co-design Center for Efficient Exascale Discretizations (CEED).
27 While our focus is on high-order finite elements, the approach is mostly algebraic
28 and thus applicable to other discretizations in factored form.
29 
30 ## Usage
31 
32 To use low level libCEED bindings in a Rust package, the following `Cargo.toml`
33 can be used.
34 ```toml
35 [dependencies]
36 libceed-sys = "0.8.0"
37 ```
38 
39 For a development version of the libCEED Rust bindings, use the following `Cargo.toml`.
40 ```toml
41 [dependencies]
42 libceed-sys = { git = "https://github.com/CEED/libCEED", branch = "main" }
43 ```
44 
45 Supported features:
46 * `static` (default): link to static libceed.a
47 * `system`: use libceed from a system directory (otherwise, install from source)
48 
49 ## Development
50 
51 To develop libCEED, use `cargo build` in the `rust/libceed-sys` directory to
52 install a local copy and build the bindings. If you need custom flags for the
53 C project, we recommend using `make configure` to cache arguments. If you
54 disable the `static` feature, then you'll need to set `LD_LIBRARY_PATH` for
55 doctests to be able to find it. You can do this in `$CEED_DIR/lib` and set
56 `PKG_CONFIG_PATH`.
57 
58 Note: the `LD_LIBRARY_PATH` workarounds will become unnecessary if [this
59 issue](https://github.com/rust-lang/cargo/issues/1592) is resolved -- it's
60 currently closed, but the problem still exists.
61 
62 */
63 
64 pub mod bind_ceed {
65     #![allow(non_upper_case_globals)]
66     #![allow(non_camel_case_types)]
67     #![allow(dead_code)]
68     include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
69 }
70