Merge pull request #1486 from akallabeth/android_build_enhanced
Android build enhanced
This commit is contained in:
commit
c60ea8adb0
@ -3,10 +3,10 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:installLocation="auto"
|
||||
package="com.freerdp.freerdpcore"
|
||||
android:versionCode="1"
|
||||
android:versionCode="2"
|
||||
android:versionName="@GIT_REVISION@" >
|
||||
|
||||
<uses-sdk android:targetSdkVersion="8" android:minSdkVersion="8"/>
|
||||
<uses-sdk android:targetSdkVersion="@ANDROID_APP_TARGET_SDK@" android:minSdkVersion="@ANDROID_APP_MIN_SDK@"/>
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
|
||||
|
@ -16,28 +16,39 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set(ANDROID_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
set(ANDROID_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
|
||||
set(ANDROID_PACKAGE_NAME "aFreeRDPCore")
|
||||
|
||||
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/AndroidManifest.xml.cmake ${CMAKE_CURRENT_SOURCE_DIR}/AndroidManifest.xml @ONLY)
|
||||
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/AndroidManifest.xml.cmake
|
||||
${CMAKE_CURRENT_BINARY_DIR}/AndroidManifest.xml @ONLY)
|
||||
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/build.xml.cmake
|
||||
${CMAKE_CURRENT_BINARY_DIR}/build.xml @ONLY)
|
||||
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/project.properties.cmake
|
||||
${CMAKE_CURRENT_BINARY_DIR}/project.properties @ONLY)
|
||||
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/ant.properties.cmake
|
||||
${CMAKE_CURRENT_BINARY_DIR}/ant.properties @ONLY)
|
||||
|
||||
file(COPY res DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
if (ANDROID_SDK)
|
||||
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/local.properties.cmake ${CMAKE_CURRENT_SOURCE_DIR}/local.properties @ONLY)
|
||||
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/local.properties.cmake
|
||||
${CMAKE_CURRENT_BINARY_DIR}/local.properties @ONLY)
|
||||
endif()
|
||||
|
||||
add_subdirectory(jni)
|
||||
|
||||
|
||||
if(ANDROID_BUILD_JAVA)
|
||||
set(ANDROIDLIB "${ANDROID_SOURCE_DIR}/bin/classes.jar")
|
||||
set(ANDROIDLIB "${ANDROID_BINARY_DIR}/bin/classes.jar")
|
||||
|
||||
# command to create the android package
|
||||
add_custom_command(
|
||||
OUTPUT "${ANDROIDLIB}"
|
||||
COMMAND ${ANT_COMMAND} ${ANDROID_BUILD_TYPE}
|
||||
WORKING_DIRECTORY "${ANDROID_SOURCE_DIR}"
|
||||
WORKING_DIRECTORY "${ANDROID_BINARY_DIR}"
|
||||
MAIN_DEPENDENCY AndroidManifest.xml
|
||||
DEPENDS freerdp-android local.properties
|
||||
DEPENDS freerdp-android
|
||||
${CMAKE_CURRENT_BINARY_DIR}/local.properties
|
||||
)
|
||||
add_custom_target(android-lib ALL SOURCES "${ANDROIDLIB}")
|
||||
SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "gen;bin")
|
||||
|
@ -14,3 +14,7 @@
|
||||
# 'key.store' for the location of your keystore and
|
||||
# 'key.alias' for the name of the key to use.
|
||||
# The password will be asked during the build when you use the 'release' target.
|
||||
build.dir=@CMAKE_CURRENT_BINARY_DIR@
|
||||
source.dir=@CMAKE_CURRENT_SOURCE_DIR@/src
|
||||
out.dir=@CMAKE_CURRENT_BINARY_DIR@/bin
|
||||
|
@ -68,6 +68,7 @@ set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} jnigraphics)
|
||||
|
||||
target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS})
|
||||
|
||||
set_target_properties(${MODULE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${ANDROID_SOURCE_DIR}/libs/${ANDROID_ABI}")
|
||||
set_target_properties(${MODULE_NAME}
|
||||
PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${ANDROID_BINARY_DIR}/libs/${ANDROID_ABI}")
|
||||
|
||||
set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Client/Android")
|
||||
|
@ -11,5 +11,5 @@
|
||||
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
|
||||
|
||||
# Project target.
|
||||
target=android-11
|
||||
target=android-@ANDROID_APP_TARGET_SDK@
|
||||
android.library=true
|
@ -6,7 +6,7 @@
|
||||
android:versionCode="3"
|
||||
android:versionName="@GIT_REVISION@" >
|
||||
|
||||
<uses-sdk android:targetSdkVersion="8" android:minSdkVersion="8"/>
|
||||
<uses-sdk android:targetSdkVersion="@ANDROID_APP_TARGET_SDK@" android:minSdkVersion="@ANDROID_APP_MIN_SDK@"/>
|
||||
<supports-screens android:anyDensity="true" android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:xlargeScreens="true" />
|
||||
|
||||
<application android:name="com.freerdp.afreerdp.application.GlobalApp"
|
||||
|
@ -16,29 +16,41 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set(ANDROID_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
set(ANDROID_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
|
||||
set(ANDROID_PACKAGE_NAME "aFreeRDP")
|
||||
|
||||
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/AndroidManifest.xml.cmake ${CMAKE_CURRENT_SOURCE_DIR}/AndroidManifest.xml @ONLY)
|
||||
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/AndroidManifest.xml.cmake
|
||||
${CMAKE_CURRENT_BINARY_DIR}/AndroidManifest.xml @ONLY)
|
||||
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/build.xml.cmake
|
||||
${CMAKE_CURRENT_BINARY_DIR}/build.xml @ONLY)
|
||||
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/project.properties.cmake
|
||||
${CMAKE_CURRENT_BINARY_DIR}/project.properties @ONLY)
|
||||
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/ant.properties.cmake
|
||||
${CMAKE_CURRENT_BINARY_DIR}/ant.properties @ONLY)
|
||||
|
||||
file(COPY res DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
|
||||
file(COPY assets DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
if (ANDROID_SDK)
|
||||
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/local.properties.cmake ${CMAKE_CURRENT_SOURCE_DIR}/local.properties @ONLY)
|
||||
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/local.properties.cmake
|
||||
${CMAKE_CURRENT_BINARY_DIR}/local.properties @ONLY)
|
||||
endif()
|
||||
|
||||
if(ANDROID_BUILD_JAVA)
|
||||
if(ANDROID_BUILD_JAVA_DEBUG)
|
||||
set(APK "${ANDROID_SOURCE_DIR}/bin/${ANDROID_PACKAGE_NAME}-release-unsigned.apk")
|
||||
if(NOT ANDROID_BUILD_JAVA_DEBUG)
|
||||
set(APK "${ANDROID_BINARY_DIR}/bin/${ANDROID_PACKAGE_NAME}-release-unsigned.apk")
|
||||
else()
|
||||
set(APK "${ANDROID_SOURCE_DIR}/bin/${ANDROID_PACKAGE_NAME}-debug.apk")
|
||||
set(APK "${ANDROID_BINARY_DIR}/bin/${ANDROID_PACKAGE_NAME}-debug.apk")
|
||||
endif()
|
||||
|
||||
# command to create the android package
|
||||
add_custom_command(
|
||||
OUTPUT "${APK}"
|
||||
COMMAND ${ANT_COMMAND} ${ANDROID_BUILD_TYPE}
|
||||
WORKING_DIRECTORY "${ANDROID_SOURCE_DIR}"
|
||||
WORKING_DIRECTORY "${ANDROID_BINARY_DIR}"
|
||||
MAIN_DEPENDENCY AndroidManifest.xml
|
||||
DEPENDS freerdp-android local.properties #android-lib
|
||||
DEPENDS freerdp-android
|
||||
${CMAKE_CURRENT_BINARY_DIR}/local.properties
|
||||
)
|
||||
add_custom_target(android-package ALL SOURCES "${APK}")
|
||||
SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "gen;bin")
|
||||
|
20
client/Android/aFreeRDP/ant.properties.cmake
Normal file
20
client/Android/aFreeRDP/ant.properties.cmake
Normal file
@ -0,0 +1,20 @@
|
||||
# This file is used to override default values used by the Ant build system.
|
||||
#
|
||||
# This file must be checked into Version Control Systems, as it is
|
||||
# integral to the build system of your project.
|
||||
|
||||
# This file is only used by the Ant script.
|
||||
|
||||
# You can use this to override default values such as
|
||||
# 'source.dir' for the location of your java source folder and
|
||||
# 'out.dir' for the location of your output folder.
|
||||
|
||||
# You can also use it define how the release builds are signed by declaring
|
||||
# the following properties:
|
||||
# 'key.store' for the location of your keystore and
|
||||
# 'key.alias' for the name of the key to use.
|
||||
# The password will be asked during the build when you use the 'release' target.
|
||||
build.dir=@CMAKE_CURRENT_BINARY_DIR@
|
||||
source.dir=@CMAKE_CURRENT_SOURCE_DIR@/src
|
||||
out.dir=@CMAKE_CURRENT_BINARY_DIR@/bin
|
||||
|
@ -8,6 +8,6 @@
|
||||
# project structure.
|
||||
|
||||
# Project target.
|
||||
target=android-11
|
||||
target=android-@ANDROID_APP_TARGET_SDK@
|
||||
android.library.reference.1=../FreeRDPCore
|
||||
manifestmerger.enabled=true
|
@ -15,6 +15,16 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set(JAVA_DEBUG_DEFAULT "off")
|
||||
if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
|
||||
set(JAVA_DEBUG_DEFAULT "on")
|
||||
endif()
|
||||
|
||||
option(WITH_DEBUG_ANDROID_JNI "Enable debug output for android jni bindings" ${DEFAULT_DEBUG_OPTION})
|
||||
option(ANDROID_BUILD_JAVA "Automatically android java code - build type depends on CMAKE_BUILD_TYPE" ON)
|
||||
option(ANDROID_BUILD_JAVA_DEBUG "Create a android debug package" ON)
|
||||
option(ANDROID_BUILD_JAVA_DEBUG "Create a android debug package" ${JAVA_DEBUG_DEFAULT})
|
||||
|
||||
set(ANDROID_APP_TARGET_SDK 11 CACHE STRING "Application target android SDK")
|
||||
set(ANDROID_APP_MIN_SDK 8 CACHE STRING "Application minimum android SDK requirement")
|
||||
set(ANDROID_APP_GOOGLE_TARGET_SDK "16" CACHE STRING "Application target google SDK")
|
||||
|
||||
|
@ -156,3 +156,10 @@ Java classes:
|
||||
After that you need to implement the functionality in client/Android/jni/android_freerdp.c and add
|
||||
the call to client/Android/jni/generated/android_freerdp_jni.c.
|
||||
After that FreeRDP and the Android package need to be rebuilt to include the latest libfreerdp-android in the package.
|
||||
|
||||
Android CMake related Variables
|
||||
-------------------------------
|
||||
|
||||
ANDROID_APP_TARGET_SDK ... specifies the desired android target SDK, currently 11
|
||||
ANDROID_APP_MIN_SDK ... specifies the minimum android SDK version supported, currently 8
|
||||
ANDROID_APP_GOOGLE_TARGET_SDK ... specifies the minimum google SDK requirement, currently 16
|
||||
|
Loading…
Reference in New Issue
Block a user