4 See http://freeglut.sourceforge.net/docs/android.php
7 Create a module compatible with the NDK build-system
8 ====================================================
10 - Use your own cross-compiler for Android, or export the one from the
13 /usr/src/android-ndk-r7c/build/tools/make-standalone-toolchain.sh \
14 --platform=android-9 \
15 --install-dir=/usr/src/ndk-standalone-9
17 - Build FreeGLUT with a '/freeglut' prefix :
19 PATH=/usr/src/ndk-standalone-9/bin:$PATH
20 cd /usr/src/freeglut-3.0.0/
21 mkdir cross-android-module-gles2/
22 cd cross-android-module-gles2/
24 -D CMAKE_TOOLCHAIN_FILE=../android_toolchain.cmake \
25 -D CMAKE_INSTALL_PREFIX=/freeglut-gles2 \
26 -D CMAKE_BUILD_TYPE=Debug \
27 -D FREEGLUT_GLES2=ON \
28 -D FREEGLUT_BUILD_DEMOS=NO \
31 make install DESTDIR=$(pwd)
33 - Copy Android.mk in the new 'freeglut/' directory :
35 cp ../android/gles2/Android.mk freeglut-gles2/
37 - Reference this module in your jni/Android.mk:
39 LOCAL_STATIC_LIBRARIES := ... freeglut-gles2
41 $(call import-module,freeglut-gles2)
43 - You now can point your NDK_MODULE_PATH to this module!
45 ndk-build NDK_MODULE_PATH=/usr/src/freeglut-3.0.0/cross-android-module/freeglut-gles2/
48 Compile FreeGLUT for a traditional cross-compiler environment
49 =============================================================
51 - Use your own cross-compiler for Android, or export the one from the
54 /usr/src/android-ndk-r7c/build/tools/make-standalone-toolchain.sh \
55 --platform=android-9 \
56 --install-dir=/usr/src/ndk-standalone-9
58 - Compile FreeGLUT and install it in your Android cross-compiler path:
60 PATH=/usr/src/ndk-standalone-9/bin:$PATH
61 cd /usr/src/freeglut-3.0.0/
62 mkdir cross-android-toolchain-gles2/
63 cd cross-android-toolchain-gles2/
65 -D CMAKE_TOOLCHAIN_FILE=../android_toolchain.cmake \
66 -D CMAKE_INSTALL_PREFIX=/usr/src/ndk-standalone-9/sysroot/usr \
67 -D CMAKE_BUILD_TYPE=Debug \
68 -D FREEGLUT_GLES2=ON \
69 -D FREEGLUT_BUILD_DEMOS=NO \
73 # Only static for now:
74 rm -f /usr/src/ndk-standalone-9/sysroot/usr/lib/libfreeglut-gles?.so*
76 - Compile your own project.
78 For instance if you use the autotools:
80 PATH=/usr/src/ndk-standalone-9/bin:$PATH
81 export PKG_CONFIG_PATH=/usr/src/ndk-standalone-9/sysroot/usr/share/pkgconfig
82 ./configure --host=arm-linux-androideabi --prefix=/somewhere
86 If you use CMake, you may want to copy our Android toolchain
87 'android_toolchain.cmake':
89 PATH=/usr/src/ndk-standalone-9/bin:$PATH
90 export PKG_CONFIG_PATH=/usr/src/ndk-standalone-9/sysroot/usr/share/pkgconfig
91 cp .../android_toolchain.cmake .
95 -D CMAKE_TOOLCHAIN_FILE=../android_toolchain.cmake \
96 -D CMAKE_INSTALL_PREFIX=/somewhere \
97 -D CMAKE_BUILD_TYPE=Debug \
98 -D MY_PROG_OPTION=something ... \