olm-sys

Crates.ioolm-sys
lib.rsolm-sys
version1.3.2
sourcesrc
created_at2018-03-31 23:19:15.389686
updated_at2022-06-11 18:07:52.427352
descriptionLow level binding for libolm
homepage
repositoryhttps://gitlab.gnome.org/BrainBlasted/olm-sys
max_upload_size
id58387
size2,220,214
Johannes Hayeß (jhaye)

documentation

README

olm-sys: Low Level Bindings For Olm

This is an intermediate crate that exposes the C API of libolm to Rust. If you want to start building things with libolm from Rust, check out olm-rs.

Supported Platforms

  • Android
  • Linux
  • macOS
  • Windows
  • FreeBSD
  • WebAssembly

Building

This library can either be built by statically or dynamically linking against libolm:

Static

This is the default and requires no further action. libolm is built locally and then linked against statically.

Build dependencies

  • libstdc++/libc++
  • cmake (requires v3.12)
  • GNU make or a compatible variant (WebAssembly only)
  • Emscripten (WebAssembly only)

Dynamic

For linking against libolm dynamically, first make sure that you have the library in your link path. Then build this library with the OLM_LINK_VARIANT environment variable set to dylib.

For example, building your project using olm-sys as a dependency would look like this:

$ OLM_LINK_VARIANT=dylib cargo build

Cross compiling for Android

To enable cross compilation for Android set the environment variable ANDROID_NDK to the location of your NDK installation, for example:

$ ANRDOID_NDK=/home/user/Android/Sdk/ndk/22.0.7026061/

The linker needs to be set to an target specific one as well, for example for aarch64-linux-android set this into your cargo config:

[target.aarch64-linux-android]
ar = "/home/user/Android/Sdk/ndk/22.0.7026061/toolchains/llvm/prebuilt/linux-x86_64/bin/ar"
linker = "/home/user/Android/Sdk/ndk/22.0.7026061/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android30-clang"

After both of these are set, compilation should work as usual using cargo:

$ ANDROID_NDK=~/Android/Sdk/ndk/22.0.7026061 cargo build --target aarch64-linux-android

Cross compiling for iOS

To enable cross compilation for iOS, set the environment variable IOS_SDK_PATH to the iOS SDK location by running:

$ export IOS_SDK_PATH=`xcrun --show-sdk-path --sdk iphoneos`
Commit count: 0

cargo fmt