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