9 releases (breaking)

0.8.0 Jan 11, 2022
0.7.0 Dec 24, 2021
0.6.0 Sep 3, 2021
0.5.1 Sep 3, 2021
0.1.0 Sep 1, 2021

#50 in Windows APIs

46 downloads per month

MIT license

380KB
9K SLoC

C++ 7.5K SLoC // 0.0% comments Rust 760 SLoC GraphQL 471 SLoC

gqlmapi-rs

The C++ portion of this crate is based on Electron-GqlMAPI. Unlike that project, there is no V8 engine or Node interoperability/threading requirement. I wrote just enough support code and state management for that API projection though, that I decided to use it as the basis for an API projection to Rust.

The next layer in the Electron stack is eMAPI. The corresponding next layer in this stack is a Tauri app called Tauri GqlMAPI that does the same thing but in a much more lightweight fashion than Electron.

Getting Started

This project only builds on Windows, and I've only tested it with x64 builds. It requires that you have CMake installed, the version included with Visual Studio 2019 works fine. It also uses the vcpkg package manager for the dependencies. At a minimum, you need to build/install cppgraphqlgen with vcpkg for your target triplet, e.g.:

> vcpkg install cppgraphqlgen:x64-windows-static

You will need to set an environment variable to tell build.rs where to find it, or install the user-wide vcpkg integration before building this crate. In this example, I have vcpkg in a subdirectory called source\repos\microsoft\vcpkg under my user profile, and I'm targetting x64-windows-static, so I don't need to copy any DLLs from vcpkg:

> set VCPKG_ROOT=%USERPROFILE%\source\repos\microsoft\vcpkg

or:

> vcpkg integrate install

The build.rs script determines the target x64-windows or x86-windows platform based on the Rust target, and if you enable the crt-static target feature feature, it also uses the -static triplet. Hint: If you would rather not redistribute DLLs for gqlmapi and cppgraphqlgen with your app, try adding this to the .cargo/config.toml file in your project:

[target.x86_64-pc-windows-msvc]
rustflags = ["-C", "target-feature=+crt-static"]

Make sure you have also cloned the gqlmapi sub-module. If you did not clone this repo recursively, you can still pull down the sub-module with a couple of git commands:

> git submodule init
> git submodule update

After that, you should be ready to build with cargo build.

Dependencies

  • Microsoft Outlook for runtime MAPI support
  • gqlmapi for the C++ GraphQL bindings to MAPI
  • vcpkg package manager for the GqlMAPI C++ dependencies
  • cmake crate to automatically build gqlmapi
  • cxx crate to generate the C++ bindings

Dependencies

~193MB
~3M SLoC