# - the shared library should link to the dependency libraries so that the user
# won't have to link them explicitly (they shouldn't have to know that we depend
# on Xrandr or Xxf86vm)
- SET_TARGET_PROPERTIES(freeglut PROPERTIES VERSION 3.9.0 SOVERSION 3 OUTPUT_NAME glut)
- SET_TARGET_PROPERTIES(freeglut_static PROPERTIES OUTPUT_NAME glut)
+ IF(FREEGLUT_GLES2)
+ SET(LIBNAME freeglut-gles2)
+ ELSEIF(FREEGLUT_GLES1)
+ SET(LIBNAME freeglut-gles1)
+ ELSE()
+ SET(LIBNAME glut)
+ ENDIF()
+
+ SET_TARGET_PROPERTIES(freeglut PROPERTIES VERSION 3.9.0 SOVERSION 3 OUTPUT_NAME ${LIBNAME})
+ SET_TARGET_PROPERTIES(freeglut_static PROPERTIES OUTPUT_NAME ${LIBNAME})
IF(ANDROID)
# Not in CMake toolchain file, because the toolchain
# file is called several times and generally doesn't
ENDIF()
# Client applications need to define FreeGLUT GLES version to
# bootstrap headers inclusion in freeglut_std.h:
+SET(PC_LIBNAME "glut")
+SET(PC_FILENAME "freeglut.pc")
IF(FREEGLUT_GLES2)
SET(PC_CFLAGS "-DFREEGLUT_GLES2")
+ SET(PC_LIBNAME "freeglut-gles2")
+ SET(PC_FILENAME "freeglut-gles2.pc")
ELSEIF(FREEGLUT_GLES1)
SET(PC_CFLAGS "-DFREEGLUT_GLES1")
+ SET(PC_LIBNAME "freeglut-gles1")
+ SET(PC_FILENAME "freeglut-gles1.pc")
ENDIF()
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/freeglut.pc.in ${CMAKE_BINARY_DIR}/freeglut.pc @ONLY)
-INSTALL(FILES ${CMAKE_BINARY_DIR}/freeglut.pc DESTINATION share/pkgconfig)
+INSTALL(FILES ${CMAKE_BINARY_DIR}/freeglut.pc DESTINATION share/pkgconfig/ RENAME ${PC_FILENAME})
# TODO: change the library and .pc name when building for GLES,
# e.g. -lglut-GLES2
cd cross-android-module/
cmake \
-D CMAKE_TOOLCHAIN_FILE=../android_toolchain.cmake \
- -D CMAKE_INSTALL_PREFIX=/freeglut \
+ -D CMAKE_INSTALL_PREFIX=/freeglut-gles2 \
-D FREEGLUT_GLES2=ON \
-D FREEGLUT_BUILD_DEMOS=NO \
..
- Copy Android.mk in the new 'freeglut/' directory :
- cp android/Android.mk freeglut/
+ cp ../android/gles2/Android.mk freeglut-gles2/
- Reference this module in your jni/Android.mk:
- LOCAL_STATIC_LIBRARIES := ... freeglut
+ LOCAL_STATIC_LIBRARIES := ... freeglut-gles2
...
- $(call import-module,freeglut)
+ $(call import-module,freeglut-gles2)
- You now can point your NDK_MODULE_PATH to this module!
- ndk-build NDK_MODULE_PATH=/usr/src/freeglut-3.0.0/freeglut/
+ ndk-build NDK_MODULE_PATH=/usr/src/freeglut-3.0.0/cross-android-module/freeglut-gles2/
Compile FreeGLUT for a traditional cross-compiler environment
+++ /dev/null
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := freeglut
-LOCAL_SRC_FILES := lib/libglut.a
-LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
-
-include $(PREBUILT_STATIC_LIBRARY)
--- /dev/null
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := freeglut-gles1
+LOCAL_SRC_FILES := lib/libfreeglut-gles1.a
+LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
+
+include $(PREBUILT_STATIC_LIBRARY)
--- /dev/null
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := freeglut-gles2
+LOCAL_SRC_FILES := lib/libfreeglut-gles2.a
+LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
+
+include $(PREBUILT_STATIC_LIBRARY)
Name: glut
Description: A freely licensed and improved alternative to the GLUT library
Version: @VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_PATCH@
-Libs: -L${libdir} -lglut
+Libs: -L${libdir} -l@PC_LIBNAME@
Libs.private: @PC_LIBS_PRIVATE@
Cflags: -I${includedir} @PC_CFLAGS@