README.Android.txt 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. README.Android.txt - Building and using FLTK with CMake for the Android platform
  2. --------------------------------------------------------------------------------
  3. WARNING: BUILDING FLTK FOR ANDROID IS WORK IN PROGRESS IN A PRETTY EARLY STAGE.
  4. WARNING: THIS FILE MERELY CONTAINS A ROUGH LAYOUT AND SOME SIMPLE IDEAS HOW
  5. FLTK WILL BUILD FOR ANDROID EVENTUALLY.
  6. CONTENTS
  7. ==========
  8. 1 INTRODUCTION TO CMAKE
  9. 2 USING CMAKE TO BUILD FLTK
  10. 2.1 Prerequisites
  11. 2.2 Options
  12. 2.3 Building under Linux with Unix Makefiles
  13. 2.4 Crosscompiling
  14. 3 USING CMAKE WITH FLTK
  15. 3.1 Library names
  16. 3.2 Using Fluid files
  17. 4 DOCUMENT HISTORY
  18. INTRODUCTION TO CMAKE
  19. =======================
  20. Please read README.CMake.txt in the same directory to learn about CMake.
  21. More information on CMake can be found on its web site http://www.cmake.org.
  22. USING CMAKE TO BUILD FLTK FOR ANDROID ON OS X AND LINUX
  23. =========================================================
  24. PREREQUISITES
  25. ---------------
  26. Get CMake 3.2.3 or newer.
  27. Go to https://github.com/taka-no-me/android-cmake and download the content
  28. as a zip file.
  29. Go into the FLTK base directory, then:
  30. > mkdir build
  31. > cd build
  32. > unzip ~/Downloads/android-cmake-master.zip
  33. > mv android-cmake-master Android
  34. > cd Android
  35. > cmake -DCMAKE_TOOLCHAIN_FILE=android.toolchain.cmake -DANDROID_NDK=~/dev/android-ndk-r10e -DCMAKE_BUILD_TYPE=Release -DANDROID_ABI="armeabi-v7a" ../..
  36. > make
  37. At this time, compilation will fail relatively soon, but we are working hard to make porting easier,
  38. and to prove our work, we poert FLTK to Android at the same time. Using CMake to cross-compile
  39. is one of the many steps required to make life easier and maintenance more flexible.
  40. OPTIONS
  41. ---------
  42. Options can be specified to cmake with the -D flag:
  43. cmake -D <OPTION_NAME>=<OPTION_VALUE>
  44. WARNING: Old outdated information:
  45. Building FLTK on Android (pre alpha, don't expect miracles)
  46. 1. cd to the root of its source code ('cd android/hello')
  47. 2. Run ndk-build. This builds the native code, and should result in some .so files being put into the libs directory.
  48. 3. android update project --path . --name hello
  49. 4. ant debug (or similar). This will build the Java code and create an .apk. Crucially, the build process will pick up the .so files left within the libs directory and include them into the .apk.
  50. 5. adb install bin/name-of-project.apk
  51. 6. Then launch as normal using the Android GUI or using an am start command such as you give.
  52. 6a. emulator -avd Intel_x86
  53. 7. adb shell am start -n com.example.native_activity
  54. 8. adb uninstall com.example.native_activity
  55. DOCUMENT HISTORY
  56. ==================
  57. Feb 9 2016 - matt: recreated document with more warnings and active support