cue-sdk-sys
The cue-sdk-sys crate is a low-level unsafe Rust bindings to the native Corsair iCUE SDK v4.0.84.
Note: v0.1.0 is a breaking change from v0.0.x. The iCUE SDK v4 is a complete API rewrite — the device-index-based API has been replaced with a session/device-ID-based API, and the native library was renamed from CUESDK to iCUESDK.
Source Generation Process
The following describes the steps taken to generate the source code, and what manual tweaks were made to the generated code.
- Create a wrapper header that includes both
iCUESDK.handiCUESDKLedIdEnum.h. - Run bindgen:
bindgen wrapper.h -- -x c++ -std=gnu++14 -I <path_to_sdk_include> - Combine function calls into a single
unsafe extern "C"block. - Add
#[must_use]to all extern functions (they all returnCorsairError). - Import Rust FFI types from
core::ffiinstead ofstd::os::raw. - Add
SendandSynctraits to non-auto send/sync structs since the iCUE SDK documentation shares that the SDK is thread-safe. - Rename the anonymous union in
CorsairEventtoCorsairEventUnion.
Building
- Download the proper iCUE SDK release for your operating system.
- Note: v4 only ships x64 libraries (i386 is no longer supported).
macOS
- Set the environment variable
CUE_SDK_FRAMEWORK_PATHto point to the directory containingiCUESDK.framework.
Windows
- Set the environment variable
CUE_SDK_LIB_FILES_PATHto point to thelib/x64folder of the iCUE SDK. - Add the
redistiCUE SDK folder to your path to develop and run end-to-end tests, and include it in your final (built) release package to the end user.