From: Sylvain Beucler Date: Sun, 11 Mar 2012 09:18:53 +0000 (+0000) Subject: Android documentation X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=commitdiff_plain;h=8b08d68ba789289f1744c7d3724c6c6b118ead44;p=freeglut Android documentation git-svn-id: svn+ssh://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut@1103 7f0cb862-5218-0410-a997-914c9d46530a --- diff --git a/README.android b/README.android new file mode 100644 index 0000000..71a1822 --- /dev/null +++ b/README.android @@ -0,0 +1,61 @@ +Create a module compatible with the NDK build-system +==================================================== + +- Use your own cross-compiler for Android, or export the one from the + NDK: + + /usr/src/android-ndk-r7/build/tools/make-standalone-toolchain.sh \ + --platform=android-9 \ + --install-dir=/usr/src/ndk-standalone-9 + +- Build FreeGLUT with a '/freeglut' prefix : + + PATH=/usr/src/ndk-standalone-9/bin:$PATH + cd /usr/src/freeglut-3.0.0/ + cmake \ + -D CMAKE_TOOLCHAIN_FILE=android_toolchain.cmake \ + -D CMAKE_INSTALL_PREFIX=/freeglut \ + -D FREEGLUT_GLES2=ON \ + -D FREEGLUT_BUILD_DEMOS=NO \ + . + make -j4 + make install DESTDIR=$(pwd) + +- Copy Android.mk in the new 'freeglut/' directory : + + cp android/Android.mk freeglut/ + +- Reference this module in your jni/Android.mk: + + LOCAL_STATIC_LIBRARIES := ... freeglut + ... + $(call import-module,freeglut) + +- You now can point your NDK_MODULE_PATH to this module! + + ndk-build NDK_MODULE_PATH=/usr/src/freeglut-3.0.0/freeglut/ + + +Compile FreeGLUT for a traditional cross-compiler environment +============================================================= + +- Use your own cross-compiler for Android, or export the one from the + NDK: + + /usr/src/android-ndk-r7/build/tools/make-standalone-toolchain.sh \ + --platform=android-9 \ + --install-dir=/usr/src/ndk-standalone-9 + +- Compile FreeGLUT and install it in your Android cross-compiler path: + + PATH=/usr/src/ndk-standalone-9/bin:$PATH + ./configure --host=arm-linux-androideabi --prefix=/usr/src/ndk-standalone-9 + make + make install + +- Compile your own project, for instance if you use the autotools: + + PATH=/usr/src/ndk-standalone-9/bin:$PATH + ./configure --host=arm-linux-androideabi --prefix=/somewhere + make + make install diff --git a/android_toolchain.cmake b/android_toolchain.cmake new file mode 100644 index 0000000..ef3bb61 --- /dev/null +++ b/android_toolchain.cmake @@ -0,0 +1,6 @@ +# CMake toolchain file, cf. README.android +SET(CMAKE_SYSTEM_NAME Linux) # Tell CMake we're cross-compiling +include(CMakeForceCompiler) +# Prefix detection only works with compiler id "GNU" +CMAKE_FORCE_C_COMPILER(arm-linux-androideabi-gcc GNU) +SET(ANDROID TRUE)