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.
-
Permissive MIT/BSL-license
-
Async callback-based interface
-
Non-blocking IO with a 'bring your own thread' model
-
Automatic downloads and updates
-
Email / Steam / GoG authentication
-
Mod Browsing / Filtering
-
Header-only support with C++17 compiler or later
-
C++14 codebases can use a static library or direct compilation
-
Native Unreal Engine integration available via our dedicated plugin
Platform |
Support |
Compiler |
Windows |
✔ |
MSVC C++ 2019 |
Windows (GDK) |
Vendor-provided |
|
Nintendo Switch |
Vendor-provided |
|
XBox (GDK) |
Vendor-provided |
|
Linux |
✔ |
Clang 10 |
macOS |
✔ |
Clang 10 |
Pre-requisites to compile this SDK are listed in Getting Started documentation
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-sdkTo use the mod.io SDK, you can proceed with the installation using one of the following perspectives:
-
Inside a CMake project
-
Standalone: Header-only mode
-
Standalone: Separate compilation mode
-
Standalone: Static library mode
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
wget -q -O cmake-linux.sh https://github.com/Kitware/CMake/releases/download/v3.20.0/cmake-3.20.0-Linux-x86_64.sh
sh cmake-linux.sh -- --skip-license --prefix=/usr/
## Install liburing-dev
wget http://mirrors.kernel.org/ubuntu/pool/main/libu/liburing/liburing-dev_0.7-3ubuntu3_amd64.deb
wget http://mirrors.kernel.org/ubuntu/pool/main/libu/liburing/liburing1_0.7-3ubuntu3_amd64.deb
sudo apt install ./liburing*deb|
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 |
The mod.io SDK for development on macOS requires Clang 10 or GCC 10, which come included in the XCode installation. XCode 13 is recommended. To install CMake 3.20 or Ninja 1.10, it is recommended to use brew as follows:
brew install cmake ninja-
Clone the repository, or add it as a submodule
-
Confirm
your_projectuses CMake 3.20 or latercmake_minimum_required(VERSION 3.20)
-
Specify the target platform, with options: WIN or LINUX
set (MODIO_PLATFORM WIN) -
Add the SDK subdirectory to your project
add_subdirectory(<modio-sdk folder> EXCLUDE_FROM_ALL)
-
Link the library to your project
-
To use the header-only configuration:
target_compile_features(your_project PUBLIC cxx_std_17) target_link_libraries(your_project PUBLIC modio)
-
Or to use the static library configuration:
target_compile_features(your_project PUBLIC cxx_std_14) target_link_libraries(your_project PUBLIC modioStatic)
-
To simplify the SDK compilation, the file CMakePresets.json includes the most common configurations as presets that employ Ninja by default. Therefore, confirm it is available on your PATH unless you want to override the CMake generator in use.
Platform |
Preset |
Target |
Build System |
Windows |
win |
Release |
Visual Studio 2019 |
Windows |
win-debug |
Debug |
Visual Studio 2019 |
Windows |
win-dbginfo |
Pre-Release |
Visual Studio 2019 |
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 |
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.
To build the SDK using the default build and install directories:
-
cmake -S <modio-sdk folder> --preset=winThis will use the Ninja generator to create a Ninja build system in
<modio-sdk folder>/out/build/win. It installs the compiled libraries/headers to<modio-sdk folder>/out/install/win. -
cmake --build <modio-sdk folder>/out/build/winThis step compiles the SDK as a static library.
-
cmake --install <modio-sdk folder>/out/build/winThis produces a folder
<modio-sdk folder>/out/install/winwith the following:-
header_only- directory with the header-only version of the SDK -
source- directory containing the implementation files of the SDK for use in 'split 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. |
Simply add each of the subdirectories in header_only to your include directories. Then, in your_project source file add #include "modio/ModioSDK.h"
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"
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/winWhen 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 /headersThen 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 characteristicsPlease see the Getting Started documentation for a breakdown of the mod.io SDK’s concepts and usage, including:
A private, white-label option is available for license. If you want a fully-featured platform that you control and host in-house send us a message Contact us to discuss.
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.
mod.io provides an open API for user-generated content. You are welcome to view, fork and contribute to other codebases we release.