README.md.in 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. The Simple DirectMedia Layer (SDL for short) is a cross-platform library
  2. designed to make it easy to write multi-media software, such as games
  3. and emulators.
  4. The Simple DirectMedia Layer library source code is available from:
  5. https://www.libsdl.org/
  6. This library is distributed under the terms of the zlib license:
  7. http://www.zlib.net/zlib_license.html
  8. # @<@PROJECT_NAME@>@-@<@PROJECT_VERSION@>@.aar
  9. This Android archive allows use of @<@PROJECT_NAME@>@ in your Android project, without needing to copy any SDL source.
  10. ## Gradle integration
  11. For integration with CMake/ndk-build, it uses [prefab](https://google.github.io/prefab/).
  12. Copy the aar archive (@<@PROJECT_NAME@>@-@<@PROJECT_VERSION@>@.aar) to a `app/libs` directory of your project.
  13. In `app/build.gradle` of your Android project, add:
  14. ```
  15. android {
  16. /* ... */
  17. buildFeatures {
  18. prefab true
  19. }
  20. }
  21. dependencies {
  22. implementation files('libs/@<@PROJECT_NAME@>@-@<@PROJECT_VERSION@>@.aar')
  23. /* ... */
  24. }
  25. ```
  26. If you're using CMake, add the following to your CMakeLists.txt:
  27. ```
  28. find_package(@<@PROJECT_NAME@>@ REQUIRED CONFIG)
  29. target_link_libraries(yourgame PRIVATE @<@PROJECT_NAME@>@::@<@PROJECT_NAME@>@)
  30. ```
  31. If you use ndk-build, add the following before `include $(BUILD_SHARED_LIBRARY)` to your `Android.mk`:
  32. ```
  33. LOCAL_SHARED_LIBARARIES := SDL3 SDL3-Headers
  34. ```
  35. And add the following at the bottom:
  36. ```
  37. # https://google.github.io/prefab/build-systems.html
  38. # Add the prefab modules to the import path.
  39. $(call import-add-path,/out)
  40. # Import @<@PROJECT_NAME@>@ so we can depend on it.
  41. $(call import-module,prefab/@<@PROJECT_NAME@>@)
  42. ```
  43. ---
  44. ## Other build systems (advanced)
  45. If you want to build a project without Gradle,
  46. running the following command will extract the Android archive into a more common directory structure.
  47. ```
  48. python @<@PROJECT_NAME@>@-@<@PROJECT_VERSION@>@.aar -o android_prefix
  49. ```
  50. Add `--help` for a list of all available options.
  51. Look at the example programs in ./examples (of the source archive), and check out online documentation:
  52. https://wiki.libsdl.org/SDL3/FrontPage
  53. Join the SDL discourse server if you want to join the community:
  54. https://discourse.libsdl.org/
  55. That's it!
  56. Sam Lantinga <slouken@libsdl.org>