After you've [downloaded the library](https://developer.android.com/games/sdk/frame-pacing/opengl) onto your
machine and have checked it into your source control system, make the following
changes to your project's build settings.

## Static library

Do the following steps to link your project to the static library:

1. Add `gamesdk/include` to your compiler include paths.
2. Include `swappy/swappyGL.h` for integration with OpenGL ES. In most cases, the header file contains all the functions you need to integrate the library into your engine.
3. Add a path of the following form in your linker library paths:

   ```
   gamesdk/libs/architecture_APIapiLevel_NDKndkVersion_stlVersion_Release
   ```

   For example: `gamesdk/libs/arm64-v8a_API24_NDK17_cpp_static_Release`
4. Add `-lswappy_static` to your linker command.

## Shared library

The above steps statically link against a version of the Frame Pacing 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:

1. Follow steps 1 and 2 from the previous section to update your compiler include paths and use the appropriate header file.
2. Add a path of the following form in your linker library paths:

   ```
   gamesdk/libs/architecture_APIapiLevel_NDKndkVersion_stlVersion_Release/lib/swappy
   ```
3. Add `-lswappy` to your linker command.

Static linking will give you a much smaller code footprint as you don't need to
bundle the `libswappy.so` shared library.

## Using CMake (static library only)

If you are using CMake, see the `gamesdk/samples/bouncyball/app/CMakeLists.txt`
file in the [downloaded library](https://developer.android.com/games/sdk/frame-pacing/opengl)
for an example CMake configuration. It includes a utility file, `gamesdk/samples/gamesdk.cmake`,
that 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:

1. Include this file in your CMakeLists.txt: `include("`<var translate="no">path/to/gamesdk</var>`/samples/gamesdk.cmake")`
2. Call the `add_gamesdk_target` function with the folder containing the gamesdk: `add_gamesdk_target(PACKAGE_DIR `<var translate="no">path/to/gamesdk</var>`)`
3. In your `target_link_libraries` for your native library, add `swappy` as a dependency: `
   target_link_libraries(native-lib swappy ...)
   `

| **Note:** The path to the gamesdk used for `include` and `add_gamesdk_target` can either be absolute (for example, `/home/yourusername/gamesdk` or `C:\Android\gamesdk`) or relative to the `CMakeLists.txt` file.

For advanced usage of CMake, see the [`gamesdk.cmake` source file](https://android.googlesource.com/platform/frameworks/opt/gamesdk/+/refs/heads/master/samples/gamesdk.cmake).