Skip to main content

Using inside a CMake project

1 Confirm your_project uses CMake 3.20 or later

cmake_minimum_required(VERSION 3.20)

2 Specify the target platform with OCULUS

set (MODIO_PLATFORM OCULUS)

3 Add the SDK subdirectory to your project

add_subdirectory(<modio-sdk folder> EXCLUDE_FROM_ALL)
target_compile_features(your_project PUBLIC cxx_std_17)
  1. 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)
  1. Ensure that you have configured the environment variable MODIO_NDK_ROOT to point to your NDK installation directory.

To simplify the CMake configuration, the folder cmake/ has the file CMakePresets.json with the basic configuration required to guide the mod.io SDK compilation using the Windows SDK. If you copy that file to the folder root, it can be used as follows:

cmake --preset oculus
  1. There are some resources that must be copied from the mod.io SDK to your own Java application in order to compile and use the SDK. Make sure you include the following somewhere in your CMake scripts.

platform/android/java/com/modio/modiosdk/ must be copied to your applications app/src/main/java/com/modio/modiosdk/ directory. The mod.io SDK will automatically load this class for any native interop.

platform/android/assets/ must be copied to your applications app/src/main/assets directory. This includes a signed certificate used for HTTPS requests.