From 31bbd368fecb57940648addcedf44f8f21b8b429 Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Tue, 17 Sep 2013 15:57:48 +0200 Subject: [PATCH 1/7] Added configuration options for android SDK Now activating JAVA_DEBUG only for CMake Debug configuration by default. --- cmake/ConfigOptionsAndroid.cmake | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/cmake/ConfigOptionsAndroid.cmake b/cmake/ConfigOptionsAndroid.cmake index 535092f73..a2f3e48c0 100644 --- a/cmake/ConfigOptionsAndroid.cmake +++ b/cmake/ConfigOptionsAndroid.cmake @@ -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") + From 64d4dda20b41ed03069d2c2e64e287e924009a2e Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Tue, 17 Sep 2013 15:58:32 +0200 Subject: [PATCH 2/7] Added documentation for android SDK variables. --- docs/README.android | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/README.android b/docs/README.android index e83af9107..08920db5b 100644 --- a/docs/README.android +++ b/docs/README.android @@ -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 From b58942b0ccbca617d22f158d6c38ebe81a770cf6 Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Tue, 17 Sep 2013 16:07:52 +0200 Subject: [PATCH 3/7] Fixed out of source build. --- .../FreeRDPCore/AndroidManifest.xml.cmake | 4 +- client/Android/FreeRDPCore/CMakeLists.txt | 23 +++-- client/Android/FreeRDPCore/ant.properties | 16 ---- client/Android/FreeRDPCore/build.xml | 92 ------------------- client/Android/FreeRDPCore/jni/CMakeLists.txt | 3 +- ...ct.properties => project.properties.cmake} | 2 +- 6 files changed, 22 insertions(+), 118 deletions(-) delete mode 100644 client/Android/FreeRDPCore/ant.properties delete mode 100644 client/Android/FreeRDPCore/build.xml rename client/Android/FreeRDPCore/{project.properties => project.properties.cmake} (93%) diff --git a/client/Android/FreeRDPCore/AndroidManifest.xml.cmake b/client/Android/FreeRDPCore/AndroidManifest.xml.cmake index 161f5c061..f21e53c74 100644 --- a/client/Android/FreeRDPCore/AndroidManifest.xml.cmake +++ b/client/Android/FreeRDPCore/AndroidManifest.xml.cmake @@ -3,10 +3,10 @@ - + diff --git a/client/Android/FreeRDPCore/CMakeLists.txt b/client/Android/FreeRDPCore/CMakeLists.txt index 005e90d45..6f256af64 100644 --- a/client/Android/FreeRDPCore/CMakeLists.txt +++ b/client/Android/FreeRDPCore/CMakeLists.txt @@ -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") diff --git a/client/Android/FreeRDPCore/ant.properties b/client/Android/FreeRDPCore/ant.properties deleted file mode 100644 index 73031c7a7..000000000 --- a/client/Android/FreeRDPCore/ant.properties +++ /dev/null @@ -1,16 +0,0 @@ -# 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. diff --git a/client/Android/FreeRDPCore/build.xml b/client/Android/FreeRDPCore/build.xml deleted file mode 100644 index f07d7de42..000000000 --- a/client/Android/FreeRDPCore/build.xml +++ /dev/null @@ -1,92 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/client/Android/FreeRDPCore/jni/CMakeLists.txt b/client/Android/FreeRDPCore/jni/CMakeLists.txt index 5aec24ef1..05e6e1ff5 100644 --- a/client/Android/FreeRDPCore/jni/CMakeLists.txt +++ b/client/Android/FreeRDPCore/jni/CMakeLists.txt @@ -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") diff --git a/client/Android/FreeRDPCore/project.properties b/client/Android/FreeRDPCore/project.properties.cmake similarity index 93% rename from client/Android/FreeRDPCore/project.properties rename to client/Android/FreeRDPCore/project.properties.cmake index b4af3b428..72b842609 100644 --- a/client/Android/FreeRDPCore/project.properties +++ b/client/Android/FreeRDPCore/project.properties.cmake @@ -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 From ef3f534825c82d116aa75e705670517a19d67b5b Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Tue, 17 Sep 2013 16:09:04 +0200 Subject: [PATCH 4/7] Fixed out of source build. --- .../Android/FreeRDPCore/ant.properties.cmake | 20 ++++ client/Android/FreeRDPCore/build.xml.cmake | 92 +++++++++++++++++++ 2 files changed, 112 insertions(+) create mode 100644 client/Android/FreeRDPCore/ant.properties.cmake create mode 100644 client/Android/FreeRDPCore/build.xml.cmake diff --git a/client/Android/FreeRDPCore/ant.properties.cmake b/client/Android/FreeRDPCore/ant.properties.cmake new file mode 100644 index 000000000..13e49ee77 --- /dev/null +++ b/client/Android/FreeRDPCore/ant.properties.cmake @@ -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 + diff --git a/client/Android/FreeRDPCore/build.xml.cmake b/client/Android/FreeRDPCore/build.xml.cmake new file mode 100644 index 000000000..f07d7de42 --- /dev/null +++ b/client/Android/FreeRDPCore/build.xml.cmake @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From d8db198a510d52f1fe7a6db60a26c80b150ca1af Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Tue, 17 Sep 2013 16:09:31 +0200 Subject: [PATCH 5/7] Fixed out of source build. --- client/Android/aFreeRDP/CMakeLists.txt | 28 +++++++++++++------ client/Android/aFreeRDP/ant.properties.cmake | 20 +++++++++++++ .../aFreeRDP/{build.xml => build.xml.cmake} | 0 ...ct.properties => project.properties.cmake} | 2 +- 4 files changed, 41 insertions(+), 9 deletions(-) create mode 100644 client/Android/aFreeRDP/ant.properties.cmake rename client/Android/aFreeRDP/{build.xml => build.xml.cmake} (100%) rename client/Android/aFreeRDP/{project.properties => project.properties.cmake} (91%) diff --git a/client/Android/aFreeRDP/CMakeLists.txt b/client/Android/aFreeRDP/CMakeLists.txt index d17533b75..f4261b2ad 100644 --- a/client/Android/aFreeRDP/CMakeLists.txt +++ b/client/Android/aFreeRDP/CMakeLists.txt @@ -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") diff --git a/client/Android/aFreeRDP/ant.properties.cmake b/client/Android/aFreeRDP/ant.properties.cmake new file mode 100644 index 000000000..13e49ee77 --- /dev/null +++ b/client/Android/aFreeRDP/ant.properties.cmake @@ -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 + diff --git a/client/Android/aFreeRDP/build.xml b/client/Android/aFreeRDP/build.xml.cmake similarity index 100% rename from client/Android/aFreeRDP/build.xml rename to client/Android/aFreeRDP/build.xml.cmake diff --git a/client/Android/aFreeRDP/project.properties b/client/Android/aFreeRDP/project.properties.cmake similarity index 91% rename from client/Android/aFreeRDP/project.properties rename to client/Android/aFreeRDP/project.properties.cmake index 4507b1846..7d04de0f2 100644 --- a/client/Android/aFreeRDP/project.properties +++ b/client/Android/aFreeRDP/project.properties.cmake @@ -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 From 135ba71c46d49b4638651c66b98cc3cdbc7607d5 Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Tue, 17 Sep 2013 16:09:45 +0200 Subject: [PATCH 6/7] Fixed typo in config options for android. --- cmake/ConfigOptionsAndroid.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/ConfigOptionsAndroid.cmake b/cmake/ConfigOptionsAndroid.cmake index a2f3e48c0..aa00fac5b 100644 --- a/cmake/ConfigOptionsAndroid.cmake +++ b/cmake/ConfigOptionsAndroid.cmake @@ -16,7 +16,7 @@ # limitations under the License. set(JAVA_DEBUG_DEFAULT "off") -if("${CMAKE_BUILD_TYPE STREQUAL "Debug") +if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") set(JAVA_DEBUG_DEFAULT "on") endif() From 5fb9cacd5cbe98b6f16a1a707c8c76e94d3249e6 Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Tue, 17 Sep 2013 16:16:02 +0200 Subject: [PATCH 7/7] Fixed android SDK version, now using variable. --- client/Android/aFreeRDP/AndroidManifest.xml.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/Android/aFreeRDP/AndroidManifest.xml.cmake b/client/Android/aFreeRDP/AndroidManifest.xml.cmake index 3f481cb6a..d27c71052 100644 --- a/client/Android/aFreeRDP/AndroidManifest.xml.cmake +++ b/client/Android/aFreeRDP/AndroidManifest.xml.cmake @@ -6,7 +6,7 @@ android:versionCode="3" android:versionName="@GIT_REVISION@" > - +