fredemmott / StreamDeck-CPPSDK

A fork of Elgato's C++ StreamDeck SDK, focussing on reusability
MIT License
44 stars 10 forks source link

Continuous Integration

What is this?

This is re-usable library derived from Elgato's CPU plugin, targetting MacOS and Windows. Linux is also tested in case Elgato expand support in the future.

It is currently based on a version from 2019-05-27. This is:

This library has been bundled with and used by several plugins for since January 2019:

What's changed from the Elgato SDK?

Adding this to a CMake project

  1. Download StreamDeckSDK.cmake from the latest release
  2. include() it in your project
  3. A StreamDeckSDK static library is now available in your project; depending on it will also make nlohmann/json, websocketpp, and asio available in your project, including header files.

For example:

include("StreamDeckSDK.cmake")
add_executable(
  myplugin
  MyStreamDeckPlugin.cpp
  main.cpp
)
target_link_libraries(myplugin StreamDeckSDK)

To update, replace StreamDeckSDK.cmake with the newer version and address any incompatibilities.

Copying

This is strongly discouraged; however if it seems necessary:

  1. Copy into a subdirectory of your project
  2. add_subdirectory('StreamDeckCPPSDK/Vendor')
  3. add_subdirectory('StreamDeckCPPSDK/StreamDeckSDK')
  4. You are now able to directly refer to the StreamDeckSDK, asio, json, and websocketpp targets.

Creating new plugins

A small example is included.

To build, open Windows Terminal, cmd.exe, Apple Terminal, or iTerm, then:

mkdir example/build
cd example/build
cmake ..
cmake --build . --parallel --config Debug
cmake --install . --config Debug

When creating your

Porting from Elgato's code

First, you need to add a main function; this is usually very short, and looks something like:

#include "MyStreamDeckPlugin.h"

#include <StreamDeckSDK/ESDMain.h>
#include <StreamDeckSDK/ESDLogger.h>

int main(int argc, const char** argv) {
  return esd_main(argc, argv, new MyStreamDeckPlugin());
}

You will then need to do several smaller changes:

For example, the CPU plugin was ported by:

  1. Deleting all common code and build artifacts
  2. Adding CMake and main.cpp
  3. Manually fixing some compatibility issues

Additionally, using CMake makes it easy to automatically build on both platforms using GitHub actions.

Getting Help

I make this for my own use, and I share this in the hope others find it useful; I'm not able to commit to support, bug fixes, or feature development.

If you have found a bug or have a feature request, please check GitHub issues to see if it has already been reported, and create a new issue if not.

Support may be available from the community via Discord.

I am not able to respond to 1:1 requests for help via any means, including GitHub, Discord, Twitter, Reddit, or email.

LICENSE

The source code for this project is MIT-licensed.