Added debugging settings to allow android debugging.
This commit is contained in:
parent
9f705055bb
commit
e03305f18c
@ -206,7 +206,6 @@ endif()
|
||||
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWINPR_EXPORTS")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DFREERDP_EXPORTS")
|
||||
|
||||
# Include files
|
||||
if(NOT IOS)
|
||||
check_include_files(fcntl.h HAVE_FCNTL_H)
|
||||
@ -270,7 +269,9 @@ endif()
|
||||
if(ANDROID)
|
||||
if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
|
||||
add_definitions(-DNDK_DEBUG=1)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_DEBUG}")
|
||||
endif()
|
||||
set(CMAKE_C_LINK_FLAGS "${CMAKE_C_LINK_FLAGS} -llog")
|
||||
if (NOT FREERDP_ANDROID_EXTERNAL_SSL_PATH)
|
||||
if(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/external/openssl")
|
||||
set(FREERDP_ANDROID_EXTERNAL_SSL_PATH "${CMAKE_CURRENT_SOURCE_DIR}/external/openssl")
|
||||
|
@ -15,6 +15,8 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set(ANDROID_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/aFreeRDP")
|
||||
|
||||
if(ANDROID_BUILD_JAVA)
|
||||
if (NOT ANDROID_SDK)
|
||||
message(FATAL_ERROR "ANDROID_SDK not set but required for building the java gui (ANDROID_BUILD_JAVA)")
|
||||
|
@ -16,8 +16,8 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set(ANDROID_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
|
||||
set(ANDROID_PACKAGE_NAME "aFreeRDPCore")
|
||||
file(MAKE_DIRECTORY ${ANDROID_BINARY_DIR})
|
||||
|
||||
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/AndroidManifest.xml.cmake
|
||||
${CMAKE_CURRENT_BINARY_DIR}/AndroidManifest.xml @ONLY)
|
||||
@ -39,6 +39,7 @@ add_subdirectory(jni)
|
||||
|
||||
|
||||
if(ANDROID_BUILD_JAVA)
|
||||
file(MAKE_DIRECTORY "${ANDROID_BINARY_DIR}/bin")
|
||||
set(ANDROIDLIB "${ANDROID_BINARY_DIR}/bin/classes.jar")
|
||||
|
||||
# command to create the android package
|
||||
|
@ -72,3 +72,12 @@ set_target_properties(${MODULE_NAME}
|
||||
PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${ANDROID_BINARY_DIR}/libs/${ANDROID_ABI}")
|
||||
|
||||
set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Client/Android")
|
||||
|
||||
get_property(LIB_ABSNAME TARGET ${MODULE_NAME} PROPERTY LOCATION)
|
||||
file(MAKE_DIRECTORY ${ANDROID_BINARY_DIR}/obj/local/${ANDROID_NDK_ABI_NAME})
|
||||
|
||||
add_custom_command(TARGET ${MODULE_NAME} POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${LIB_ABSNAME}
|
||||
${ANDROID_BINARY_DIR}/obj/local/${ANDROID_NDK_ABI_NAME}/)
|
||||
|
||||
|
||||
|
@ -16,7 +16,6 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set(ANDROID_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
|
||||
set(ANDROID_PACKAGE_NAME "aFreeRDP")
|
||||
|
||||
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/AndroidManifest.xml.cmake
|
||||
@ -36,6 +35,32 @@ if (ANDROID_SDK)
|
||||
${CMAKE_CURRENT_BINARY_DIR}/local.properties @ONLY)
|
||||
endif()
|
||||
|
||||
if("${ANDROID_DEBUG_ENABLE}" STREQUAL "true")
|
||||
# 1. generate Android.mk
|
||||
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/jni/Android.mk
|
||||
"APP_ABI := ${ANDROID_NDK_ABI_NAME}\n")
|
||||
|
||||
# 2. generate gdb.setup
|
||||
get_directory_property(INCLUDE_DIRECTORIES DIRECTORY . INCLUDE_DIRECTORIES)
|
||||
string(REGEX REPLACE ";" " " INCLUDE_DIRECTORIES "${INCLUDE_DIRECTORIES}")
|
||||
set(LIB_DIRECTORIES "${ANDROID_NDK}/platforms/android-${ANDROID_NATIVE_API_LEVEL}/arch-${ANDROID_ARCH_NAME}")
|
||||
file(WRITE ${ANDROID_BINARY_DIR}/libs/${ANDROID_NDK_ABI_NAME}/gdb.setup
|
||||
"set solib-search-path ${CMAKE_CURRENT_BINARY_DIR}/obj/local/${ANDROID_NDK_ABI_NAME}\n")
|
||||
file(APPEND ${ANDROID_BINARY_DIR}/libs/${ANDROID_NDK_ABI_NAME}/gdb.setup
|
||||
"directory ${INCLUDE_DIRECTORIES} ${LIB_DIRECTORIES}\n")
|
||||
|
||||
# 3. copy gdbserver executable
|
||||
file(COPY ${ANDROID_NDK}/prebuilt/android-${ANDROID_ARCH_NAME}/gdbserver/gdbserver
|
||||
DESTINATION ${ANDROID_BINARY_DIR}/libs/${ANDROID_NDK_ABI_NAME}/)
|
||||
|
||||
# 4. Convenience target to launch debugger.
|
||||
add_custom_target(debug-ndk
|
||||
COMMAND adb install -r bin/aFreeRDP-debug.apk
|
||||
COMMAND ndk-gdb --start --verbose --force
|
||||
WORKING_DIRECTORY ${CURRENT_BINARY_DIR}
|
||||
)
|
||||
endif()
|
||||
|
||||
if(ANDROID_BUILD_JAVA)
|
||||
if(NOT ANDROID_BUILD_JAVA_DEBUG)
|
||||
set(APK "${ANDROID_BINARY_DIR}/bin/${ANDROID_PACKAGE_NAME}-release-unsigned.apk")
|
||||
|
Loading…
Reference in New Issue
Block a user