Skip to content

C++ SDK for easily integrating mod.io into your game - the UGC management service for game developers

License

Notifications You must be signed in to change notification settings

modio/modio-sdk

Repository files navigation

mod.io

mod.io SDK2

License Discord

Welcome to the mod.io SDK repository, built using C++. It allows game developers to host and automatically install user-generated content in their games. It connects to the mod.io REST API.

Features

  • Permissive MIT/BSL-license

  • Async callback-based interface

  • Non-blocking IO with a 'bring your own thread' model

  • Automatic downloads and updates

  • Email / Steam / EGS / Consoles / Custom SSO authentication

  • Mod Browsing / Filtering

  • Header-only, direct compilation or static library support with C++17 compiler

  • Native Unreal Engine integration available via our dedicated plugin

Platform Support

Platform

Support

Compiler

C++ Standard

Windows

MSVC (VS2019/22)

C++17

Windows (GDK)

(Contact Us)

Vendor-provided

C++17

Nintendo Switch

(Contact Us)

Vendor-provided

C++17

XBox (GDK)

(Contact Us)

Vendor-provided

C++17

PlayStation®4

(Contact Us)

Vendor-provided

C++17

PlayStation®5

(Contact Us)

Vendor-provided

C++17

Linux

Clang 10

C++17

macOS

Clang 10

C++17

iOS

Clang 10

C++17

Android

Clang 10

C++17

Pre-requisites

Pre-requisites to compile this SDK are listed in Getting Started documentation

Download repository

It is possible to download the source code as a zip file from this webpage. However, a recursive clone downloads all dependencies. Therefore, the suggestion is to perform the following:

git clone --recurse-submodule https://github.com/modio/modio-sdk
cd modio-sdk

Installation

To use the mod.io SDK, you can proceed with the installation using one of the following perspectives:

Linux Dependencies

The mod.io SDK requires a Linux kernel with liburing support (v5.1 or later). The io_uring system calls provides asynchronous input/output operations. To fulfill that requirement and have the development tools ready, the following commands employ the "apt" package manager (tested on Ubuntu 20.04 Focal Fossa):

sudo apt update
sudo apt upgrade
sudo apt install llvm clang lldb make wget python3 ninja-build git unzip libsdl2-dev
## Install Cmake
sudo apt install -y cmake
## Install liburing-dev
sudo apt install liburing-dev
Note
If you are using the "header_only" release mode, the mod.io SDK includes MbedTLS headers, but requires the library installed in your system, which was tested with libmbedtls-dev 2.28.0 in Ubuntu. The "static" mode includes these libraries in the same folder as the libmodioStatic.a

macOS / iOS Dependencies

The mod.io SDK for development on macOS / iOS requires Clang 10 or GCC 10 or later, which come included in the XCode installation. XCode 14 or later is recommended. To install CMake 3.20 or Ninja 1.10, it is recommended to use brew as follows:

brew install cmake ninja

iOS compiles by default to the simulator. If you need to deploy to a device, add variable MODIO_IOS_DEVICE to cmake. Check documentation in the platform README.adoc for more details.

The minimum deployment target is macOS 12.0. In case of mobile, it is iOS 15.0

Android Dependencies

The mod.io Android SDK is built against NDK version NDK r23c and supports the arm64-v8a ABI.

Start by modifying your Visual Studio installation to add the "Mobile development with C++" workload. This will install the Android SDK and NDK.

Install a Perl distribution (ie Strawberry Perl) and ensure perl.exe is in your PATH.

Ensure that you have configured an Android target in your CMaketSettings.json (copy from the Template if need be), and set your CMAKE_ANDROID_NDK property to the location where NDK has been installed - by default this is C:/Program Files (x86)/Android/AndroidNDK/android-ndk-r23c if you have installed it from Visual Studio.

Inside a CMake project

  1. Clone the repository, or add it as a submodule

  2. Confirm your_project uses CMake 3.20 or later

    cmake_minimum_required(VERSION 3.20)
  3. Specify the target platform, with options: WIN or LINUX

    set (MODIO_PLATFORM WIN)
  4. Add the SDK subdirectory to your project

    add_subdirectory(<modio-sdk folder> EXCLUDE_FROM_ALL)
    target_compile_features(your_project PUBLIC cxx_std_17)
  5. Link the library to your project

    • To use the header-only configuration:

      target_link_libraries(your_project PUBLIC modio)
    • Or to use the static library configuration:

      target_link_libraries(your_project PUBLIC modioStatic)

Standalone

When building the mod.io SDK in standalone mode, Ninja is used as the default code generator. The following steps apply when using Ninja as a code generator. If you wish to use a different code generator, such as the Visual Studio code generator, go to the Other Build Systems section.

The included CMakePresets.json includes the most common configurations as presets and require Ninja to be in your path.

Platform

Preset

Target

Build System

Windows

win

Release

Ninja or Visual Studio 2022

Windows

win-debug

Debug

Ninja or Visual Studio 2022

Windows

win-dbginfo

Pre-Release

Ninja or Visual Studio 2022

Linux

linux64

Release

Ninja

Linux

linux64-debug

Debug

Ninja

Linux

linux64-dbginfo

Pre-Release

Ninja

macOS

macOS

Release

Ninja or XCode

macOS

macOS-debug

Debug

Ninja or XCode

macOS

macOS-dbginfo

Pre-Release

Ninja or XCode

iOS

iOS

Release

Ninja or XCode

iOS

iOS-debug

Debug

Ninja or XCode

iOS

iOS-dbginfo

Pre-Release

Ninja or XCode

Android

android-arm64

Release

Ninja

Android

android-arm64-debug

Debug

Ninja

Android

android-arm64-dbginfo

Pre-Release

Ninja

Debug presets have the -debug suffix, and Release-with-debug-info is -dbginfo. If you want to build the SDK in debug configuration specify the name, for example win-debug as the preset name.

Note
If you have Visual Studio installed as your development environment, you can run the following commands from the Developer Command Prompt to easily have your environment configured. Otherwise, ensure that CMake and Ninja are part of your PATH.

Generate Source

To generate build files using Ninja, run cmake -S <modio-sdk folder> --preset=win. This will produce a Windows build configuration using Ninja at <modio-sdk folder>/out/build/win. This directory can then be used to build the SDK in the way you wish to include it.

Build the project

To build the SDK, run cmake --build <modio-sdk folder>/out/build/win.

Install the project

Run cmake --install <modio-sdk folder>/out/build/win. This will produce 3 separate folders in the <modio-sdk folder>/out/install/win directory.

  • header_only - directory with the header-only version of the SDK.

  • source - directory containing the implementation files of the SDK for use in 'separate compilation' mode.

  • static - directory containing the static library binaries and necessary public include headers

Note
If you are compiling the mod.io SDK using different architectures, you can change the preset compilation folder by modifying the "CMAKE_INSTALL_PREFIX" path.
Header-only mode

Simply add each of the subdirectories in header_only to your include directories. You will need to add each of these subdirectories to your project’s "include directories". Then, in your_project source file add #include "modio/ModioSDK.h"

Separate compilation mode

If you prefer to compile the source code directly, add the cpp files in the source directory, along with the include from the header-only mode. You must add MODIO_SEPARATE_COMPILATION to your project’s compiler definitions. Then, in your_project source file add #include "modio/ModioSDK.h"

Static library mode

Add the inc directory inside static to your include and link against the static libraries in the lib folder. You must add MODIO_SEPARATE_COMPILATION to your project’s compiler definitions. Then, in your_project source file add #include "modio/ModioSDK.h"

Other Build Systems

If you use a different build system or wish to generate project files for inclusion in an existing Visual Studio solution, you can override the default CMake generator. For example, it is possible to use an MSBuild-based Visual Studio Solution:

cmake -S <modio-sdk folder> --preset=win -G "Visual Studio 16 2019"
cmake --build <modio-sdk folder>/out/build/win
cmake --install <modio-sdk folder>/out/build/win

Note that when using the Visual Studio code generator, you have to pass in the target configuration (ie Release or Debug) as well, for instance:

cmake -S <modio-sdk folder> --preset=win -G "Visual Studio 16 2019" --Config=Release

If you are using the clang compiler with Visual studio, check section Clang compiler in Visual Studio for further details

Custom FMT library

If you have a custom version of the FMT library, you can modify the linking stage defining MODIO_USE_CUSTOM_FMT. This define signals the CMake build system to use a custom version of the library. Also, it requires that you define MODIO_CUSTOM_FMT_PATH to the system path that contains the FMT library to use.

The directory given to MODIO_CUSTOM_FMT_PATH should contain a CMakeLists.txt which exposes the fmt and/or fmt-header-only targets.

By default the SDK will consume the fmt-header-only target. Define MODIO_CUSTOM_FMT_STATIC to true to override this and request the consumption of the fmt static library target instead.

Windows Terminal Compilation of x64 library

When you compile the mod.io SDK and you require a x64 library in Windows, confirm the use the "x64 Native Tools Command Prompt for VS 2019", which by default employs the x64 compiler. To verify the Static or Shared library was compiled with x64 architecture, you can use the "dumpbin" command:

dumpbin out\build\win\modio\modioStatic.lib /headers

Then search for the confirmation as follows:

Dump of file out\build\win\modio\modioStatic.lib

File Type: LIBRARY

FILE HEADER VALUES
            8664 machine (x64)
             34A number of sections
        63336D7D time date stamp Wed Sep 28 10:39:09 2022
           136EC file pointer to symbol table
             AC9 number of symbols
               0 size of optional header
               0 characteristics

Usage

Please see the Getting Started documentation for a breakdown of the mod.io SDK’s concepts and usage, including:

Game studios and Publishers

If you need assistance with 1st party approvals, or require a private, white-label UGC solution. Contact us to discuss.

Contributions Welcome

Our SDK is public and open source. Game developers are welcome to utilize it directly, to add support for mods in their games, or fork it for their customized use. If you want to contribute to the SDK, submit a pull request with your recommended changes for review.

Other Repositories

About

C++ SDK for easily integrating mod.io into your game - the UGC management service for game developers

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •