Fixed bug 3918 - CMake support for android project
This commit is contained in:
parent
102850e1bd
commit
79da113ed7
5 changed files with 64 additions and 2 deletions
|
@ -82,6 +82,23 @@ For more complex projects, follow these instructions:
|
|||
|
||||
4b. If you want to build manually, run './gradlew installDebug' in the project directory. This compiles the .java, creates an .apk with the native code embedded, and installs it on any connected Android device
|
||||
|
||||
|
||||
If you already have a project that uses CMake, the instructions change somewhat:
|
||||
|
||||
1. Do points 1 and 2 from the instruction above.
|
||||
2. Edit "<project>/app/build.gradle" to comment out or remove sections containing ndk-build
|
||||
and uncomment the cmake sections. Add arguments to the CMake invocation as needed.
|
||||
3. Edit "<project>/app/jni/CMakeLists.txt" to include your project (it defaults to
|
||||
adding the "src" subdirectory). Note that you'll have SDL2, SDL2main and SDL2-static
|
||||
as targets in your project, so you should have "target_link_libraries(yourgame SDL2 SDL2main)"
|
||||
in your CMakeLists.txt file. Also be aware that you should use add_library() instead of
|
||||
add_executable() for the target containing your "main" function.
|
||||
|
||||
If you wish to use Android Studio, you can skip the last step.
|
||||
|
||||
4. Run './gradlew installDebug' or './gradlew installRelease' in the project directory. It will build and install your .apk on any
|
||||
connected Android device
|
||||
|
||||
Here's an explanation of the files in the Android project, so you can customize them:
|
||||
|
||||
android-project/app
|
||||
|
@ -90,10 +107,12 @@ Here's an explanation of the files in the Android project, so you can customize
|
|||
jni/ - directory holding native code
|
||||
jni/Application.mk - Application JNI settings, including target platform and STL library
|
||||
jni/Android.mk - Android makefile that can call recursively the Android.mk files in all subdirectories
|
||||
jni/CMakeLists.txt - Top-level CMake project that adds SDL as a subproject
|
||||
jni/SDL/ - (symlink to) directory holding the SDL library files
|
||||
jni/SDL/Android.mk - Android makefile for creating the SDL shared library
|
||||
jni/src/ - directory holding your C/C++ source
|
||||
jni/src/Android.mk - Android makefile that you should customize to include your source code and any library references
|
||||
jni/src/CMakeLists.txt - CMake file that you may customize to include your source code and any library references
|
||||
src/main/assets/ - directory holding asset files for your application
|
||||
src/main/res/ - directory holding resources for your application
|
||||
src/main/res/mipmap-* - directories holding icons for different phone hardware
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue