The following sections describe how to integrate the Tuning Fork library into your toolchain and how to use the functions that the library provides. The library is available as a static or shared library in the AGDK Libraries.
After you've downloaded the SDK to your machine and checked it into your source control system, make the changes listed in the following sections to your project's build settings.
Before you begin
You should integrate the Android Frame Pacing library before integrating the Tuning Fork library. If you do this, the Tuning Fork library can automatically record frame time; there is no need to explicitly call the tick functions yourself.
See the following integration guides for more information:
- Integrate Android Frame Pacing into your OpenGL renderer
- Integrate Android Frame Pacing into your Vulkan renderer
Static library
To link your project to the static library, do the following:
- Add
gamesdk/include
to your compiler include paths. Add a path of the following form in your linker library paths:
gamesdk/libs/architecture_APIapiLevel_NDKndkVersion_stlVersion_Release
Look in
gamesdk/libs
and pick the one that best suits your toolchain (for example,gamesdk/libs/arm64-v8a_API24_NDK17_cpp_static_Release
).Add
-ltuningfork_static
to your linker command (and-lswappy_static
if you integrated the Android Frame Pacing library).Add the
INTERNET
permission to yourAndroidManifest.xml
file:<uses-permission android:name="android.permission.INTERNET" />
Shared library
The steps in the static library section statically link against a version of the Tuning Fork library compiled for the given ABI, API level, NDK, and STL combination. If the combination is not available for your settings, you can instead link against the shared library:
- Add
gamesdk/include
to your compiler include paths. Add a path of the following form in your linker library paths:
gamesdk/libs/architecture_APIapiLevel_NDKndkVersion_stlVersion_Release/lib/tuningfork
Add
-ltuningfork
to your linker command (and-lswappy
if you integrated the Android Frame Pacing library).Add the
INTERNET
permission to yourAndroidManifest.xml
file:<uses-permission android:name="android.permission.INTERNET" />
Static linking gives you a much smaller code footprint as you don't need to
bundle the libtuningfork.so
shared library.
Using CMake (static library only)
If you are using CMake, see the
gamesdk/samples/tuningfork/insightsdemo/app/CMakeLists.txt
file for an example
CMake configuration. It includes a utility file,
gamesdk/samples/gamesdk.cmake
, which performs final checks, adds the proper
compiler include paths, and generates a target that you can use to link the
library.
To use this utility, do the following:
- Include this file in your
CMakeLists.txt
file:include("path/to/gamesdk/samples/gamesdk.cmake")
- Call the
add_gamesdk_target
function with the folder containing the gamesdk:add_gamesdk_target(PACKAGE_DIR path/to/gamesdk)
- In your
target_link_libraries
for your native library, addtuningfork
as a dependency (andswappy
if you integrated the Android Frame Pacing library):target_link_libraries(native-lib swappy tuningfork ...)
For advanced usage of CMake, see the gamesdk.cmake
source file.