From b1af5e27b969c29852c07c3badd2d13756b4829d Mon Sep 17 00:00:00 2001 From: Sylvain Beucler Date: Mon, 2 Apr 2012 22:22:33 +0000 Subject: [PATCH] Use different names for GLES1 and GLES2 libraries, to allow parallel install git-svn-id: svn+ssh://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut@1233 7f0cb862-5218-0410-a997-914c9d46530a --- CMakeLists.txt | 20 +++++++++++++++++--- README.android | 10 +++++----- android/Android.mk | 9 --------- android/gles1/Android.mk | 9 +++++++++ android/gles2/Android.mk | 9 +++++++++ freeglut.pc.in | 2 +- 6 files changed, 41 insertions(+), 18 deletions(-) delete mode 100644 android/Android.mk create mode 100644 android/gles1/Android.mk create mode 100644 android/gles2/Android.mk diff --git a/CMakeLists.txt b/CMakeLists.txt index e27463d..b5e1920 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -297,8 +297,16 @@ ELSE() # - 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 @@ -405,12 +413,18 @@ ELSE() 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 diff --git a/README.android b/README.android index 4cded4a..c0b43b8 100644 --- a/README.android +++ b/README.android @@ -22,7 +22,7 @@ Create a module compatible with the NDK build-system 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 \ .. @@ -31,17 +31,17 @@ Create a module compatible with the NDK build-system - 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 diff --git a/android/Android.mk b/android/Android.mk deleted file mode 100644 index 4f69c82..0000000 --- a/android/Android.mk +++ /dev/null @@ -1,9 +0,0 @@ -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) diff --git a/android/gles1/Android.mk b/android/gles1/Android.mk new file mode 100644 index 0000000..83dc219 --- /dev/null +++ b/android/gles1/Android.mk @@ -0,0 +1,9 @@ +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) diff --git a/android/gles2/Android.mk b/android/gles2/Android.mk new file mode 100644 index 0000000..3f663e1 --- /dev/null +++ b/android/gles2/Android.mk @@ -0,0 +1,9 @@ +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) diff --git a/freeglut.pc.in b/freeglut.pc.in index 57b9ea0..54340b3 100644 --- a/freeglut.pc.in +++ b/freeglut.pc.in @@ -5,6 +5,6 @@ includedir=${prefix}/include 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@ -- 1.7.10.4