Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Setelah mendownload library ke
mesin dan memeriksanya ke sistem kontrol sumber, lakukan perubahan
berikut pada setelan build project Anda.
Library statis
Lakukan langkah-langkah berikut untuk menautkan project Anda ke library statis:
Tambahkan gamesdk/include ke jalur penyertaan compiler.
Sertakan swappy/swappyVk.h untuk integrasi dengan Vulkan. Pada umumnya, file header berisi semua fungsi yang diperlukan untuk mengintegrasikan library ke dalam mesin Anda.
Tambahkan jalur dari formulir berikut di jalur library linker Anda:
Tambahkan -lswappy_static ke perintah linker Anda.
Pustaka bersama
Langkah-langkah di atas secara statis menautkan ke versi library Frame Pacing yang dikompilasi untuk kombinasi ABI, API level, NDK, dan STL tertentu. Jika kombinasi tidak tersedia untuk setelan, Anda dapat menautkan ke pustaka bersama:
Ikuti langkah 1 dan 2 dari bagian sebelumnya untuk mengupdate jalur penyertaan compiler dan gunakan file header yang sesuai.
Tambahkan jalur dari formulir berikut di jalur library penaut Anda:
Penautan statis akan memberi Anda jejak kode yang jauh lebih kecil karena Anda tidak perlu memaketkan pustaka bersama libswappy.so.
Menggunakan CMake (khusus library statis)
Jika Anda menggunakan CMake, lihat file gamesdk/samples/bouncyball/app/CMakeLists.txt
di library yang didownload
untuk melihat contoh konfigurasi CMake. Rilis ini mencakup file utilitas, gamesdk/samples/gamesdk.cmake,
yang melakukan pemeriksaan akhir, menambahkan jalur penyertaan compiler yang sesuai, dan
menghasilkan target yang dapat digunakan untuk menautkan library.
Untuk menggunakan utilitas ini, lakukan hal berikut:
Sertakan file ini dalam CMakeLists.txt:
include("path/to/gamesdk/samples/gamesdk.cmake")
Panggil fungsi add_gamesdk_target dengan folder yang berisi gamesdk:
add_gamesdk_target(PACKAGE_DIR path/to/gamesdk)
Dalam target_link_libraries untuk library native, tambahkan swappy sebagai dependensi:
target_link_libraries(native-lib swappy ...)
Konten dan contoh kode di halaman ini tunduk kepada lisensi yang dijelaskan dalam Lisensi Konten. Java dan OpenJDK adalah merek dagang atau merek dagang terdaftar dari Oracle dan/atau afiliasinya.
Terakhir diperbarui pada 2025-08-26 UTC.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Informasi yang saya butuhkan tidak ada","missingTheInformationINeed","thumb-down"],["Terlalu rumit/langkahnya terlalu banyak","tooComplicatedTooManySteps","thumb-down"],["Sudah usang","outOfDate","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Masalah kode / contoh","samplesCodeIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-08-26 UTC."],[],[],null,["After you've [downloaded the library](/games/sdk/frame-pacing/vulkan) onto your\nmachine and have checked it into your source control system, make the following\nchanges to your project's build settings.\n\nStatic library\n\nDo the following steps to link your project to the static library:\n\n1. Add `gamesdk/include` to your compiler include paths.\n2. Include `swappy/swappyVk.h` for integration with Vulkan. In most cases, the header file contains all the functions you need to integrate the library into your engine.\n3. Add a path of the following form in your linker library paths:\n\n ```\n gamesdk/libs/architecture_APIapiLevel_NDKndkVersion_stlVersion_Release\n ```\n\n For example: `gamesdk/libs/arm64-v8a_API24_NDK17_cpp_static_Release`\n4. Add `-lswappy_static` to your linker command.\n\nShared library\n\nThe above steps statically link against a version of the Frame Pacing library\ncompiled for the given ABI, API level, NDK and STL combination. If the combination is\nnot available for your settings, you can instead link against the shared\nlibrary:\n\n1. Follow steps 1 and 2 from the previous section to update your compiler include paths and use the appropriate header file.\n2. Add a path of the following form in your linker library paths:\n\n ```\n gamesdk/libs/architecture_APIapiLevel_NDKndkVersion_stlVersion_Release/lib/swappy\n ```\n3. Add `-lswappy` to your linker command.\n\nStatic linking will give you a much smaller code footprint as you don't need to\nbundle the `libswappy.so` shared library.\n\nUsing CMake (static library only)\n\nIf you are using CMake, see the `gamesdk/samples/bouncyball/app/CMakeLists.txt`\nfile in the [downloaded library](/games/sdk/frame-pacing/vulkan)\nfor an example CMake configuration. It includes a utility file, `gamesdk/samples/gamesdk.cmake`,\nthat performs final checks, adds the proper compiler include paths, and\ngenerates a target that you can use to link the library.\n\nTo use this utility, do the following:\n\n1. Include this file in your CMakeLists.txt: `include(\"`\u003cvar translate=\"no\"\u003epath/to/gamesdk\u003c/var\u003e`/samples/gamesdk.cmake\")`\n2. Call the `add_gamesdk_target` function with the folder containing the gamesdk: `add_gamesdk_target(PACKAGE_DIR `\u003cvar translate=\"no\"\u003epath/to/gamesdk\u003c/var\u003e`)`\n3. In your `target_link_libraries` for your native library, add `swappy` as a dependency: `\n target_link_libraries(native-lib swappy ...)\n `\n\n| **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.\n\nFor advanced usage of CMake, see the [`gamesdk.cmake` source file](https://android.googlesource.com/platform/frameworks/opt/gamesdk/+/refs/heads/master/samples/gamesdk.cmake)."]]