Fixed Android library stripping on some Windows configurations.
Perform Android build as out-of-source on Windows to match the Unix behavior and allow the same commands to be used. Finalized the Android build documentation. Removed the old Android native code build path using ndk-build. Fixed post processing intermediate rendertargets not matching the rendertarget format.
This commit is contained in:
Родитель
c37695b16a
Коммит
dac3f4e0a8
|
@ -495,11 +495,6 @@ endif()
|
|||
# see if we have path to Android NDK
|
||||
__INIT_VARIABLE( ANDROID_NDK PATH ENV_ANDROID_NDK )
|
||||
|
||||
# Urho3D: allow also ANDROID_NDK_ROOT
|
||||
if( NOT ANDROID_NDK )
|
||||
__INIT_VARIABLE( ANDROID_NDK PATH ENV_ANDROID_NDK_ROOT )
|
||||
endif()
|
||||
|
||||
if( NOT ANDROID_NDK )
|
||||
# see if we have path to Android standalone toolchain
|
||||
__INIT_VARIABLE( ANDROID_STANDALONE_TOOLCHAIN PATH ENV_ANDROID_STANDALONE_TOOLCHAIN OBSOLETE_ANDROID_NDK_TOOLCHAIN_ROOT OBSOLETE_ENV_ANDROID_NDK_TOOLCHAIN_ROOT )
|
||||
|
@ -1563,9 +1558,7 @@ if(NOT _CMAKE_IN_TRY_COMPILE)
|
|||
else()
|
||||
set( EXECUTABLE_OUTPUT_PATH "${LIBRARY_OUTPUT_PATH_ROOT}/bin" CACHE PATH "Output directory for applications" )
|
||||
endif()
|
||||
# Urho3D: differentiate between non-stripped (local) and stripped (installed) library folder
|
||||
set( LIBRARY_OUTPUT_PATH "${LIBRARY_OUTPUT_PATH_ROOT}/libs/local/${ANDROID_NDK_ABI_NAME}" CACHE PATH "path for local android libs" )
|
||||
set( INSTALLED_LIBRARY_OUTPUT_PATH "${LIBRARY_OUTPUT_PATH_ROOT}/libs/${ANDROID_NDK_ABI_NAME}" CACHE PATH "path for installed/stripped android libs" )
|
||||
set( LIBRARY_OUTPUT_PATH "${LIBRARY_OUTPUT_PATH_ROOT}/libs/${ANDROID_NDK_ABI_NAME}" CACHE PATH "path for android libs" )
|
||||
endif()
|
||||
|
||||
# set these global flags for cmake client scripts to change behavior
|
||||
|
|
|
@ -1,312 +0,0 @@
|
|||
# AngelScript library
|
||||
LOCAL_PATH = $(ROOT_PATH)/ThirdParty/AngelScript
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE := AngelScript
|
||||
|
||||
LOCAL_ARM_MODE := arm
|
||||
|
||||
LOCAL_SRC_FILES := \
|
||||
$(subst $(LOCAL_PATH)/,, \
|
||||
$(wildcard $(LOCAL_PATH)/source/*.cpp) \
|
||||
$(LOCAL_PATH)/source/as_callfunc_arm_gcc.S)
|
||||
|
||||
LOCAL_C_INCLUDES := \
|
||||
$(LOCAL_PATH)/include
|
||||
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
|
||||
|
||||
# Bullet library
|
||||
LOCAL_PATH = $(ROOT_PATH)/ThirdParty/Bullet
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE := Bullet
|
||||
|
||||
LOCAL_SRC_FILES := \
|
||||
$(subst $(LOCAL_PATH)/,, \
|
||||
$(wildcard $(LOCAL_PATH)/src/BulletCollision/BroadphaseCollision/*.cpp) \
|
||||
$(wildcard $(LOCAL_PATH)/src/BulletCollision/CollisionDispatch/*.cpp) \
|
||||
$(wildcard $(LOCAL_PATH)/src/BulletCollision/CollisionShapes/*.cpp) \
|
||||
$(wildcard $(LOCAL_PATH)/src/BulletCollision/Gimpact/*.cpp) \
|
||||
$(wildcard $(LOCAL_PATH)/src/BulletCollision/NarrowPhaseCollision/*.cpp) \
|
||||
$(wildcard $(LOCAL_PATH)/src/BulletDynamics/Character/*.cpp) \
|
||||
$(wildcard $(LOCAL_PATH)/src/BulletDynamics/ConstraintSolver/*.cpp) \
|
||||
$(wildcard $(LOCAL_PATH)/src/BulletDynamics/Dynamics/*.cpp) \
|
||||
$(wildcard $(LOCAL_PATH)/src/BulletDynamics/Vehicle/*.cpp) \
|
||||
$(wildcard $(LOCAL_PATH)/src/BulletSoftBody/*.cpp) \
|
||||
$(wildcard $(LOCAL_PATH)/src/LinearMath/*.cpp))
|
||||
|
||||
LOCAL_C_INCLUDES := \
|
||||
$(LOCAL_PATH)/src
|
||||
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
|
||||
|
||||
# Detour library
|
||||
LOCAL_PATH = $(ROOT_PATH)/ThirdParty/Detour
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE := Detour
|
||||
|
||||
LOCAL_SRC_FILES := \
|
||||
$(subst $(LOCAL_PATH)/,, \
|
||||
$(wildcard $(LOCAL_PATH)/Source/*.cpp))
|
||||
|
||||
LOCAL_C_INCLUDES := \
|
||||
$(LOCAL_PATH)/Include
|
||||
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
|
||||
|
||||
# FreeType library
|
||||
LOCAL_PATH = $(ROOT_PATH)/ThirdParty/FreeType
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE := FreeType
|
||||
|
||||
LOCAL_SRC_FILES := \
|
||||
$(subst $(LOCAL_PATH)/,, \
|
||||
$(LOCAL_PATH)/src/autofit/autofit.c \
|
||||
$(LOCAL_PATH)/src/base/ftbase.c \
|
||||
$(LOCAL_PATH)/src/base/ftbbox.c \
|
||||
$(LOCAL_PATH)/src/base/ftbitmap.c \
|
||||
$(LOCAL_PATH)/src/base/ftfstype.c \
|
||||
$(LOCAL_PATH)/src/base/ftgasp.c \
|
||||
$(LOCAL_PATH)/src/base/ftglyph.c \
|
||||
$(LOCAL_PATH)/src/base/ftgxval.c \
|
||||
$(LOCAL_PATH)/src/base/ftinit.c \
|
||||
$(LOCAL_PATH)/src/base/ftlcdfil.c \
|
||||
$(LOCAL_PATH)/src/base/ftmm.c \
|
||||
$(LOCAL_PATH)/src/base/ftotval.c \
|
||||
$(LOCAL_PATH)/src/base/ftpatent.c \
|
||||
$(LOCAL_PATH)/src/base/ftpfr.c \
|
||||
$(LOCAL_PATH)/src/base/ftstroke.c \
|
||||
$(LOCAL_PATH)/src/base/ftsynth.c \
|
||||
$(LOCAL_PATH)/src/base/ftsystem.c \
|
||||
$(LOCAL_PATH)/src/base/fttype1.c \
|
||||
$(LOCAL_PATH)/src/base/ftwinfnt.c \
|
||||
$(LOCAL_PATH)/src/bdf/bdf.c \
|
||||
$(LOCAL_PATH)/src/cache/ftccache.c \
|
||||
$(LOCAL_PATH)/src/cff/cff.c \
|
||||
$(LOCAL_PATH)/src/cid/type1cid.c \
|
||||
$(LOCAL_PATH)/src/gzip/ftgzip.c \
|
||||
$(LOCAL_PATH)/src/lzw/ftlzw.c \
|
||||
$(LOCAL_PATH)/src/pcf/pcf.c \
|
||||
$(LOCAL_PATH)/src/pfr/pfr.c \
|
||||
$(LOCAL_PATH)/src/psaux/psaux.c \
|
||||
$(LOCAL_PATH)/src/pshinter/pshinter.c \
|
||||
$(LOCAL_PATH)/src/psnames/psmodule.c \
|
||||
$(LOCAL_PATH)/src/raster/raster.c \
|
||||
$(LOCAL_PATH)/src/sfnt/sfnt.c \
|
||||
$(LOCAL_PATH)/src/smooth/smooth.c \
|
||||
$(LOCAL_PATH)/src/truetype/truetype.c \
|
||||
$(LOCAL_PATH)/src/type1/type1.c \
|
||||
$(LOCAL_PATH)/src/type42/type42.c \
|
||||
$(LOCAL_PATH)/src/winfonts/winfnt.c)
|
||||
|
||||
LOCAL_C_INCLUDES := \
|
||||
$(LOCAL_PATH)/include
|
||||
|
||||
LOCAL_CFLAGS += -DFT2_BUILD_LIBRARY
|
||||
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
|
||||
|
||||
# kNet library
|
||||
LOCAL_PATH = $(ROOT_PATH)/ThirdParty/kNet
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE := kNet
|
||||
|
||||
LOCAL_C_INCLUDES := \
|
||||
$(LOCAL_PATH)/include
|
||||
|
||||
LOCAL_SRC_FILES := \
|
||||
$(subst $(LOCAL_PATH)/,, \
|
||||
$(wildcard $(LOCAL_PATH)/src/*.cpp) \
|
||||
$(wildcard $(LOCAL_PATH)/src/unix/*.cpp))
|
||||
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
|
||||
|
||||
# PugiXml library
|
||||
LOCAL_PATH = $(ROOT_PATH)/ThirdParty/PugiXml
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE := PugiXml
|
||||
|
||||
LOCAL_SRC_FILES := \
|
||||
$(subst $(LOCAL_PATH)/,, \
|
||||
$(wildcard $(LOCAL_PATH)/src/*.cpp))
|
||||
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
|
||||
|
||||
# Recast library
|
||||
LOCAL_PATH = $(ROOT_PATH)/ThirdParty/Recast
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE := Recast
|
||||
|
||||
LOCAL_SRC_FILES := \
|
||||
$(subst $(LOCAL_PATH)/,, \
|
||||
$(wildcard $(LOCAL_PATH)/Source/*.cpp))
|
||||
|
||||
LOCAL_C_INCLUDES := \
|
||||
$(LOCAL_PATH)/Include
|
||||
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
|
||||
|
||||
# SDL library
|
||||
LOCAL_PATH = $(ROOT_PATH)/ThirdParty/SDL
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE := SDL
|
||||
|
||||
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
|
||||
|
||||
LOCAL_SRC_FILES := \
|
||||
$(subst $(LOCAL_PATH)/,, \
|
||||
$(wildcard $(LOCAL_PATH)/src/*.c) \
|
||||
$(wildcard $(LOCAL_PATH)/src/audio/*.c) \
|
||||
$(wildcard $(LOCAL_PATH)/src/audio/android/*.c) \
|
||||
$(wildcard $(LOCAL_PATH)/src/audio/dummy/*.c) \
|
||||
$(LOCAL_PATH)/src/atomic/SDL_atomic.c \
|
||||
$(LOCAL_PATH)/src/atomic/SDL_spinlock.c.arm \
|
||||
$(wildcard $(LOCAL_PATH)/src/core/android/*.cpp) \
|
||||
$(wildcard $(LOCAL_PATH)/src/cpuinfo/*.c) \
|
||||
$(wildcard $(LOCAL_PATH)/src/events/*.c) \
|
||||
$(wildcard $(LOCAL_PATH)/src/file/*.c) \
|
||||
$(wildcard $(LOCAL_PATH)/src/haptic/*.c) \
|
||||
$(wildcard $(LOCAL_PATH)/src/haptic/dummy/*.c) \
|
||||
$(wildcard $(LOCAL_PATH)/src/joystick/*.c) \
|
||||
$(wildcard $(LOCAL_PATH)/src/joystick/android/*.c) \
|
||||
$(wildcard $(LOCAL_PATH)/src/loadso/dlopen/*.c) \
|
||||
$(wildcard $(LOCAL_PATH)/src/stdlib/*.c) \
|
||||
$(wildcard $(LOCAL_PATH)/src/thread/*.c) \
|
||||
$(wildcard $(LOCAL_PATH)/src/thread/pthread/*.c) \
|
||||
$(wildcard $(LOCAL_PATH)/src/timer/*.c) \
|
||||
$(wildcard $(LOCAL_PATH)/src/timer/unix/*.c) \
|
||||
$(wildcard $(LOCAL_PATH)/src/video/*.c) \
|
||||
$(wildcard $(LOCAL_PATH)/src/video/android/*.c))
|
||||
|
||||
LOCAL_CFLAGS += -DGL_GLEXT_PROTOTYPES
|
||||
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
|
||||
|
||||
# StanHull library
|
||||
LOCAL_PATH = $(ROOT_PATH)/ThirdParty/StanHull
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE := StanHull
|
||||
|
||||
LOCAL_SRC_FILES := \
|
||||
$(subst $(LOCAL_PATH)/,, \
|
||||
$(wildcard $(LOCAL_PATH)/*.cpp))
|
||||
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
|
||||
|
||||
# STB library
|
||||
LOCAL_PATH = $(ROOT_PATH)/ThirdParty/STB
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE := STB
|
||||
|
||||
LOCAL_SRC_FILES := \
|
||||
$(subst $(LOCAL_PATH)/,, \
|
||||
$(wildcard $(LOCAL_PATH)/*.c))
|
||||
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
|
||||
|
||||
# JO JPEG
|
||||
LOCAL_PATH = $(ROOT_PATH)/ThirdParty/JO
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE := JO
|
||||
|
||||
LOCAL_SRC_FILES := \
|
||||
$(subst $(LOCAL_PATH)/,, \
|
||||
$(wildcard $(LOCAL_PATH)/*.cpp))
|
||||
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
|
||||
|
||||
# Urho3D executable
|
||||
LOCAL_PATH = $(ROOT_PATH)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE := Urho3D
|
||||
|
||||
LOCAL_C_INCLUDES := \
|
||||
$(LOCAL_PATH)/Engine/Audio \
|
||||
$(LOCAL_PATH)/Engine/Container \
|
||||
$(LOCAL_PATH)/Engine/Core \
|
||||
$(LOCAL_PATH)/Engine/Engine \
|
||||
$(LOCAL_PATH)/Engine/Graphics \
|
||||
$(LOCAL_PATH)/Engine/Input \
|
||||
$(LOCAL_PATH)/Engine/IO \
|
||||
$(LOCAL_PATH)/Engine/Math \
|
||||
$(LOCAL_PATH)/Engine/Navigation \
|
||||
$(LOCAL_PATH)/Engine/Network \
|
||||
$(LOCAL_PATH)/Engine/Physics \
|
||||
$(LOCAL_PATH)/Engine/Resource \
|
||||
$(LOCAL_PATH)/Engine/Scene \
|
||||
$(LOCAL_PATH)/Engine/Script \
|
||||
$(LOCAL_PATH)/Engine/UI \
|
||||
$(LOCAL_PATH)/ThirdParty/AngelScript/include \
|
||||
$(LOCAL_PATH)/ThirdParty/Bullet/src \
|
||||
$(LOCAL_PATH)/ThirdParty/Detour/Include \
|
||||
$(LOCAL_PATH)/ThirdParty/FreeType/include \
|
||||
$(LOCAL_PATH)/ThirdParty/kNet/include \
|
||||
$(LOCAL_PATH)/ThirdParty/PugiXml/src \
|
||||
$(LOCAL_PATH)/ThirdParty/Recast/Include \
|
||||
$(LOCAL_PATH)/ThirdParty/SDL/include \
|
||||
$(LOCAL_PATH)/ThirdParty/StanHull \
|
||||
$(LOCAL_PATH)/ThirdParty/STB \
|
||||
$(LOCAL_PATH)/ThirdParty/JO
|
||||
|
||||
LOCAL_SRC_FILES := \
|
||||
$(subst $(LOCAL_PATH)/,, \
|
||||
$(wildcard $(LOCAL_PATH)/Engine/Audio/*.cpp) \
|
||||
$(wildcard $(LOCAL_PATH)/Engine/Container/*.cpp) \
|
||||
$(wildcard $(LOCAL_PATH)/Engine/Core/*.cpp) \
|
||||
$(wildcard $(LOCAL_PATH)/Engine/Engine/*.cpp) \
|
||||
$(wildcard $(LOCAL_PATH)/Engine/Graphics/*.cpp) \
|
||||
$(wildcard $(LOCAL_PATH)/Engine/Graphics/OpenGL/*.cpp) \
|
||||
$(wildcard $(LOCAL_PATH)/Engine/Input/*.cpp) \
|
||||
$(wildcard $(LOCAL_PATH)/Engine/IO/*.cpp) \
|
||||
$(wildcard $(LOCAL_PATH)/Engine/Math/*.cpp) \
|
||||
$(wildcard $(LOCAL_PATH)/Engine/Navigation/*.cpp) \
|
||||
$(wildcard $(LOCAL_PATH)/Engine/Network/*.cpp) \
|
||||
$(wildcard $(LOCAL_PATH)/Engine/Physics/*.cpp) \
|
||||
$(wildcard $(LOCAL_PATH)/Engine/Resource/*.cpp) \
|
||||
$(wildcard $(LOCAL_PATH)/Engine/Scene/*.cpp) \
|
||||
$(wildcard $(LOCAL_PATH)/Engine/Script/*.cpp) \
|
||||
$(wildcard $(LOCAL_PATH)/Engine/UI/*.cpp) \
|
||||
$(wildcard $(LOCAL_PATH)/Urho3D/*.cpp) \
|
||||
$(wildcard $(LOCAL_PATH)/ThirdParty/SDL/src/main/android/*.cpp))
|
||||
|
||||
LOCAL_CPPFLAGS += -DENABLE_LOGGING
|
||||
|
||||
LOCAL_STATIC_LIBRARIES := AngelScript Bullet Detour FreeType kNet PugiXml Recast SDL StanHull STB JO
|
||||
|
||||
LOCAL_LDLIBS := -ldl -lGLESv1_CM -lGLESv2 -llog
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
|
@ -1,4 +0,0 @@
|
|||
ROOT_PATH := $(call my-dir)/../..
|
||||
APP_ABI := armeabi armeabi-v7a
|
||||
APP_STL := gnustl_static
|
||||
APP_CPPFLAGS += -fexceptions -frtti -Wno-invalid-offsetof -DUSE_OPENGL -DENABLE_PROFILING
|
|
@ -199,7 +199,9 @@ macro (setup_main_executable)
|
|||
else ()
|
||||
add_library (${TARGET_NAME} SHARED ${SOURCE_FILES})
|
||||
setup_target ()
|
||||
install (TARGETS ${TARGET_NAME} LIBRARY DESTINATION ${INSTALLED_LIBRARY_OUTPUT_PATH})
|
||||
# Strip the output shared library
|
||||
get_target_property (EXECUTABLE_NAME ${TARGET_NAME} LOCATION)
|
||||
add_custom_command (TARGET ${TARGET_NAME} POST_BUILD COMMAND ${CMAKE_STRIP} ${EXECUTABLE_NAME})
|
||||
endif ()
|
||||
|
||||
# Define a custom target to check for resource modification
|
||||
|
|
|
@ -54,27 +54,27 @@ To run from Xcode on Mac OS X, edit the Product Scheme to set "Run" setting to e
|
|||
|
||||
\section Building_Android Android build process
|
||||
|
||||
First, if you are building under Windows platform, copy Bin/Data and Bin/CoreData directories to the Android/assets directory (you can use the provided batch file CopyData.bat). This step is not necessary for non-Windows platform because the build script uses symbolic links for platforms that support it. Next, execute the following commands in the Android directory:
|
||||
First, if you are building under Windows platform, copy Bin/Data and Bin/CoreData directories to the Android/assets directory (you can use the provided batch file CopyData.bat). This step is not necessary for non-Windows platform because the build script uses symbolic links for platforms that support it.
|
||||
|
||||
- android update project -p . -t 1 (only needed on the first time, replace '-t 1' with desired target-id)
|
||||
- ndk-build
|
||||
Set the ANDROID_NDK environment variable to point to your Android NDK. On Windows, ensure that make.exe from the Android NDK is included in the path and is executable from the command line.
|
||||
|
||||
On Windows, execute cmake_android.bat. On OS X or Linux, execute cmake_gcc.sh (the ANDROID_NDK environment variable distinguishes from a normal desktop build.) Then go to the Android directory and execute the following commands
|
||||
|
||||
- android update project -p . -t 1 (only needed on the first time,
|
||||
replace '-t 1' with desired target-id)
|
||||
- make -j8 (replace '-j8' with the number of logical CPU cores of the
|
||||
host/build system)
|
||||
- ant debug
|
||||
|
||||
Note that ndk-build builds Urho3D twice, once without hardware floating point instructions, and once with them. After the commands finish successfully, the APK should have been generated to the Android/bin directory, from where it can be installed on a device or an emulator.
|
||||
After the commands finish successfully, the APK should have been generated to the Android/bin directory, from where it can be installed on a device or an emulator. The command "ant installd" can be used for this.
|
||||
|
||||
For a release build, use the "ant release" command instead of "ant debug" and follow the Android SDK instructions on how to sign your APK properly.
|
||||
|
||||
By default the Android package for Urho3D is com.googlecode.urho3d. For a real application you must replace this with your own package name. The Urho3D activity subclasses the SDLActivity from org.libsdl.app package, whose name (or the JNI code from SDL library) does not have to be changed.
|
||||
|
||||
There is also a CMake-based, work-in-progress method to build the Urho3D native code. To use, first set "ANDROID_NDK" environment variable to point to where your NDK is being installed, then run cmake_android.bat or cmake_gcc.sh, then run make in the Android directory. After the native code build is finished, proceed to ant debug like above. In Linux, typically:
|
||||
Note that the native code is built by default for armeabi-v7a ABI. To make your program compatible also with old Android devices, build also an armeabi version by executing the CMake batch file again with the parameter -DANDROID_ABI=armeabi added, then execute make again in the Android directory.
|
||||
|
||||
- ./cmake_gcc.sh
|
||||
- cd Android
|
||||
- android update project -p . -t 1
|
||||
- make -j8 install/strip (replace '-j8' with the number of logical CPU cores of the host/build system)
|
||||
- ant debug && ant installd (for deploying the debug apk)
|
||||
|
||||
You can also build and deploy using Eclipse IDE with ADT plugin. To do that, after setting the "ANDROID_NDK" environment variable then run cmake_eclipse.sh. Import "Existing Android Code into Workspace" from the CMake generated Eclipse's project found in the Android directory. Switch Eclipse IDE to use Java Perspective. Update project properties to choose the desired Android API target and that's it. Just choose "Run" to let ADT automatically build and deploy the application to Android (virtual) device.
|
||||
You can also build and deploy using Eclipse IDE with ADT plugin. To do that, after setting the ANDROID_NDK environment variable then run cmake_eclipse.sh. Import "Existing Android Code into Workspace" from the CMake generated Eclipse's project found in the Android directory. Switch Eclipse IDE to use Java Perspective. Update project properties to choose the desired Android API target and that's it. Just choose "Run" to let ADT automatically build and deploy the application to Android (virtual) device.
|
||||
|
||||
\section Building_Ios iOS build process
|
||||
|
||||
|
|
|
@ -1541,7 +1541,9 @@ void View::AllocateScreenBuffers()
|
|||
if (deferred_ && !renderTarget_ && graphics_->GetMultiSample() > 1)
|
||||
neededBuffers = 1;
|
||||
|
||||
unsigned format = Graphics::GetRGBFormat();
|
||||
// Follow final rendertarget format, or use RGB to match the backbuffer format
|
||||
unsigned format = renderTarget_ ? renderTarget_->GetParentTexture()->GetFormat() : Graphics::GetRGBFormat();
|
||||
|
||||
#ifdef USE_OPENGL
|
||||
if (deferred_)
|
||||
format = Graphics::GetRGBAFormat();
|
||||
|
|
41
Readme.txt
41
Readme.txt
|
@ -200,18 +200,25 @@ Android build process
|
|||
First, if you are building under Windows platform, copy Bin/Data and Bin/CoreData
|
||||
directories to the Android/assets directory (you can use the provided batch file
|
||||
CopyData.bat). This step is not necessary for non-Windows platform because the
|
||||
build script uses symbolic links for platforms that support it. Next, execute the
|
||||
following commands in the Android directory:
|
||||
build script uses symbolic links for platforms that support it.
|
||||
|
||||
Set the ANDROID_NDK environment variable to point to your Android NDK. On Windows,
|
||||
ensure that make.exe from the Android NDK is included in the path and is executable
|
||||
from the command line.
|
||||
|
||||
On Windows, execute cmake_android.bat. On OS X or Linux, execute cmake_gcc.sh (the
|
||||
ANDROID_NDK environment variable distinguishes from a normal desktop build.) Then
|
||||
go to the Android directory and execute the following commands
|
||||
|
||||
- android update project -p . -t 1 (only needed on the first time,
|
||||
replace '-t 1' with desired target-id)
|
||||
- ndk-build
|
||||
- make -j8 (replace '-j8' with the number of logical CPU cores of the
|
||||
host/build system)
|
||||
- ant debug
|
||||
|
||||
Note that ndk-build builds Urho3D twice, once without hardware floating point
|
||||
instructions, and once with them. After the commands finish successfully, the
|
||||
APK should have been generated to the Android/bin directory, from where it can
|
||||
be installed on a device or an emulator.
|
||||
After the commands finish successfully, the APK should have been generated to the
|
||||
Android/bin directory, from where it can be installed on a device or an emulator.
|
||||
The command "ant installd" can be used for this.
|
||||
|
||||
For a release build, use the "ant release" command instead of "ant debug" and
|
||||
follow the Android SDK instructions on how to sign your APK properly.
|
||||
|
@ -221,21 +228,13 @@ application you must replace this with your own package name. The Urho3D
|
|||
activity subclasses the SDLActivity from org.libsdl.app package, whose name
|
||||
(or the JNI code from SDL library) does not have to be changed.
|
||||
|
||||
There is also a CMake-based, work-in-progress method to build the Urho3D native
|
||||
code. To use, first set "ANDROID_NDK" environment variable to point to where your
|
||||
NDK is being installed, then run cmake_android.bat or cmake_gcc.sh, then run make
|
||||
in the Android directory. After the native code build is finished, proceed to ant
|
||||
debug like above. In Linux, typically:
|
||||
|
||||
- ./cmake_gcc.sh
|
||||
- cd Android
|
||||
- android update project -p . -t 1
|
||||
- make -j8 install/strip (replace '-j8' with the number of logical CPU cores of
|
||||
the host/build system)
|
||||
- ant debug && ant installd (for deploying the debug apk)
|
||||
Note that the native code is built by default for armeabi-v7a ABI. To make your
|
||||
program compatible also with old Android devices, build also an armeabi version
|
||||
by executing the CMake batch file again with the parameter -DANDROID_ABI=armeabi
|
||||
added, then execute make again in the Android directory.
|
||||
|
||||
You can also build and deploy using Eclipse IDE with ADT plugin. To do that, after
|
||||
setting the "ANDROID_NDK" environment variable then run cmake_eclipse.sh. Import
|
||||
setting the ANDROID_NDK environment variable then run cmake_eclipse.sh. Import
|
||||
"Existing Android Code into Workspace" from the CMake generated Eclipse's project
|
||||
found in the Android directory. Switch Eclipse IDE to use Java Perspective. Update
|
||||
project properties to choose the desired Android API target and that's it. Just
|
||||
|
@ -382,4 +381,4 @@ V1.1 - Object and scene model refactoring.
|
|||
- Added OpenGL and cross-platform support.
|
||||
- Switched to kNet library for networking.
|
||||
|
||||
V1.0 - Original release.
|
||||
V1.0 - Original release.
|
|
@ -1,3 +1,7 @@
|
|||
@del /F CMakeCache.txt
|
||||
@rd /S /Q CMakeFiles
|
||||
cmake -G "Unix Makefiles" -DANDROID=1 -DCMAKE_TOOLCHAIN_FILE=Android/android.toolchain.cmake -DLIBRARY_OUTPUT_PATH_ROOT=Android -DCMAKE_BUILD_TYPE=Release %*
|
||||
@cd Android
|
||||
@del /F CMakeCache.txt
|
||||
@rd /S /Q CMakeFiles
|
||||
cmake -G "Unix Makefiles" -DANDROID=1 -DCMAKE_TOOLCHAIN_FILE=android.toolchain.cmake -DLIBRARY_OUTPUT_PATH_ROOT=. -DCMAKE_BUILD_TYPE=Release .. %*
|
||||
@cd ..
|
Загрузка…
Ссылка в новой задаче