Permalink
Browse files

From Jorge Izquierdo Ciges, "Mostly small changes to add more compile…

… options, and shared linking (still testing that capability, but this enables on a compile basis if the user wants). Robert, when you give the Ok I'll update/rewrite the Android section in the old/new wiki you'll say where is better. Mostly to be clear for the future users what options can configure and what are their purpose."
  • Loading branch information...
1 parent c222d66 commit a9c305c70150302622929626d44d6fadbae598af @osg-training-guest osg-training-guest committed Apr 19, 2012
View
33 CMakeLists.txt
@@ -77,7 +77,38 @@ IF(OSG_BUILD_PLATFORM_ANDROID)
INCLUDE(OsgAndroidMacroUtils)
SET(ANDROID TRUE)
- SET(ANDROID_PLATFORM 5)
+ IF(NOT ANDROID_PLATFORM)
+ MESSAGE("Warning Android Platform version NOT defined, Default selected version: 5")
+ SET(ANDROID_PLATFORM 5)
+ ENDIF()
+ IF(NOT ANDROID_ABI)
+ MESSAGE("Warning Android ABI version NOT defined, Default selection: armeabi armeabi-v7a")
+ SET(ANDROID_ABI "armeabi armeabi-v7a")
+ ENDIF()
+ IF(NOT ANDROID_STL)
+ MESSAGE("Warning Android STL NOT defined, Default selection: gnustl_static")
+ SET(ANDROID_STL "gnustl_static")
+ ENDIF()
+ IF(ANDROID_DEBUG)
+ MESSAGE("Warning Android Build is in debug mode")
+ SET(ANDROID_RELEASE_OPTIM "debug")
+ ELSE()
+ MESSAGE("Warning Android Build is in release mode")
+ SET(ANDROID_RELEASE_OPTIM "release")
+ ENDIF()
+ IF(ANDROID_NEON)
+ MESSAGE("Warning Android NEON optimizations enabled, this will not be available on all armeabi-v7a devices ie. Tegra2")
+ SET(ANDROID_OPTIM_NEON true)
+ ELSE()
+ SET(ANDROID_OPTIM_NEON false)
+ ENDIF()
+ IF(ANDROID_ARM32)
+ MESSAGE("Warning ARM 32bit instruction set will be used")
+ SET(ANDROID_OPTIM_ARM32 true)
+ ELSE()
+ SET(ANDROID_OPTIM_ARM32 false)
+ ENDIF()
+
FIND_PACKAGE(AndroidNDK REQUIRED)
SET(OSG_ANDROID_TEMPLATES "${CMAKE_SOURCE_DIR}/PlatformSpecifics/Android")
View
20 CMakeModules/OsgAndroidMacroUtils.cmake
@@ -1,12 +1,15 @@
MACRO(SETUP_ANDROID_LIBRARY LIB_NAME)
- foreach(arg ${TARGET_LIBRARIES})
- set(MODULE_LIBS "${MODULE_LIBS} -l${arg}")
- endforeach(arg ${TARGET_LIBRARIES})
+ #foreach(arg ${TARGET_LIBRARIES})
+ # set(MODULE_LIBS "${MODULE_LIBS} -l${arg}")
+ #endforeach(arg ${TARGET_LIBRARIES})
foreach(arg ${TARGET_SRC})
string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/" "" n_f ${arg})
- set(MODULE_SOURCES "${MODULE_SOURCES} ${n_f}")
+ IF ("${arg}" MATCHES ".*\\.c$" OR "${arg}" MATCHES ".*\\.cpp$")
+ #We only include source files, not header files, this removes anoying warnings
+ set(MODULE_SOURCES "${MODULE_SOURCES} ${n_f}")
+ ENDIF()
endforeach(arg ${TARGET_SRC})
#SET(MODULE_INCLUDES "${CMAKE_SOURCE_DIR}/include include")
@@ -35,7 +38,8 @@ MACRO(SETUP_ANDROID_LIBRARY LIB_NAME)
ELSEIF(OSG_GLES2_AVAILABLE)
SET(OPENGLES_LIBRARY -lGLESv2)
ENDIF()
- set(MODULE_LIBS "${MODULE_LIBS} ${OPENGLES_LIBRARY} -ldl")
+ #${MODULE_LIBS}
+ set(MODULE_LIBS_FLAGS "${OPENGLES_LIBRARY} -ldl")
if(NOT CPP_EXTENSION)
set(CPP_EXTENSION "cpp")
endif()
@@ -44,8 +48,12 @@ MACRO(SETUP_ANDROID_LIBRARY LIB_NAME)
ENDIF()
IF("MODULE_USER_STATIC_OR_DYNAMIC" MATCHES "STATIC")
SET(MODULE_BUILD_TYPE "\$\(BUILD_STATIC_LIBRARY\)")
+ SET(MODULE_LIBS_SHARED " ")
+ SET(MODULE_LIBS_STATIC ${TARGET_LIBRARIES})
ELSE()
- SET(MODULE_BUILD_TYPE "\$\(BUILD_DYNAMIC_LIBRARY\)")
+ SET(MODULE_BUILD_TYPE "\$\(BUILD_SHARED_LIBRARY\)")
+ SET(MODULE_LIBS_SHARED ${TARGET_LIBRARIES})
+ SET(MODULE_LIBS_STATIC " ")
ENDIF()
set(ENV{AND_OSG_LIB_NAMES} "$ENV{AND_OSG_LIB_NAMES} ${LIB_NAME}")
set(ENV{AND_OSG_LIB_PATHS} "$ENV{AND_OSG_LIB_PATHS}include ${CMAKE_CURRENT_BINARY_DIR}/Android.mk \n")
View
33 PlatformSpecifics/Android/Android.mk.modules.in
@@ -1,27 +1,36 @@
-#ANDROID makefile ${MODULE_NAME}
+#ANDROID makefile ${MODULE_NAME}
-LOCAL_PATH := ${MODULE_DIR}
+LOCAL_PATH := ${MODULE_DIR}
include $(CLEAR_VARS)
-ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
-LOCAL_ARM_NEON := true
+ifeq (${ANDROID_OPTIM_NEON},true)
+ ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
+ LOCAL_ARM_NEON := true
+ endif
endif
-LOCAL_CPP_EXTENSION := ${CPP_EXTENSION}
+ifeq (${ANDROID_OPTIM_ARM32},true)
+ LOCAL_ARM_MODE := arm
+endif
+
+
+LOCAL_CPP_EXTENSION := ${CPP_EXTENSION}
+
+LOCAL_LDLIBS := ${MODULE_LIBS_FLAGS}
-LOCAL_LDLIBS := ${MODULE_LIBS}
+LOCAL_MODULE := ${MODULE_NAME}
-LOCAL_MODULE := ${MODULE_NAME}
+LOCAL_SRC_FILES := ${MODULE_SOURCES}
-LOCAL_SRC_FILES := ${MODULE_SOURCES}
+LOCAL_C_INCLUDES := ${MODULE_INCLUDES}
-LOCAL_C_INCLUDES := ${MODULE_INCLUDES}
+LOCAL_CFLAGS := ${MODULE_FLAGS_C}
-LOCAL_CFLAGS := ${MODULE_FLAGS_C}
+LOCAL_CPPFLAGS := ${MODULE_FLAGS_CPP}
-LOCAL_CPPFLAGS := ${MODULE_FLAGS_CPP}
+LOCAL_SHARED_LIBRARIES := ${MODULE_LIBS_SHARED}
+LOCAL_STATIC_LIBRARIES := ${MODULE_LIBS_STATIC}
-#include $(BUILD_STATIC_LIBRARY)
include ${MODULE_BUILD_TYPE}
View
8 PlatformSpecifics/Android/Application.mk.master.in
@@ -2,14 +2,14 @@
APP_BUILD_SCRIPT := $(call my-dir)/Android.mk
APP_PROJECT_PATH := $(call my-dir)
-APP_OPTIM := release
+APP_OPTIM := ${ANDROID_RELEASE_OPTIM}
-APP_PLATFORM := android-5
-APP_STL := gnustl_static
+APP_PLATFORM := ${ANDROID_PLATFORM}
+APP_STL := ${ANDROID_STL}
APP_CPPFLAGS := -fexceptions -frtti
#APP_CPPFLAGS := -Os -mthumb-interwork -fno-short-enums
#APP_CPPFLAGS := -Wl,--no-undefined
-APP_ABI := armeabi armeabi-v7a
+APP_ABI := ${ANDROID_ABI}
APP_MODULES := $ENV{AND_OSG_LIB_NAMES}

0 comments on commit a9c305c

Please sign in to comment.