Fixed android build issues.

This commit is contained in:
Armin Novak 2016-02-01 15:21:07 +01:00
parent cd05ea7452
commit 61633a1c66
8 changed files with 78 additions and 80 deletions

View File

@ -81,17 +81,27 @@ else()
endif()
set(FREERDP_INCLUDE_DIR "include/freerdp${FREERDP_VERSION_MAJOR}/")
# Make paths absolute
if (CMAKE_INSTALL_PREFIX)
get_filename_component(CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}" ABSOLUTE)
endif()
if (FREERDP_EXTERNAL_PATH)
get_filename_component (FREERDP_EXTERNAL_PATH "${FREERDP_EXTERNAL_PATH}" ABSOLUTE)
endif()
# Allow to search the host machine for git
if(ANDROID OR IOS)
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH)
endif(ANDROID OR IOS)
include(GetGitRevisionDescription)
git_get_exact_tag(GIT_REVISION --tags --always)
if (${GIT_REVISION} STREQUAL "n/a")
git_rev_parse(GIT_REVISION --short)
git_rev_parse (GIT_REVISION --short)
endif()
if(ANDROID OR IOS)
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY)
SET (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY)
endif(ANDROID OR IOS)
message(STATUS "Git Revision ${GIT_REVISION}")
@ -105,7 +115,7 @@ if(NOT CMAKE_BUILD_TYPE)
endif()
if(NOT DEFINED BUILD_SHARED_LIBS)
if(ANDROID OR IOS OR APPLE)
if(IOS OR APPLE)
set(BUILD_SHARED_LIBS OFF)
else()
set(BUILD_SHARED_LIBS ON)
@ -299,11 +309,11 @@ if(MSVC)
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR})
set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR})
if(CMAKE_BUILD_TYPE STREQUAL "Release")
else()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Zi")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zi")
endif()
if(CMAKE_BUILD_TYPE STREQUAL "Release")
else()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Zi")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zi")
endif()
endif()
@ -406,9 +416,9 @@ if(APPLE)
# Temporarily disabled, causes the cmake script to be reexecuted, causing the compilation to fail.
# Workaround: specify the parameter in the command-line
# if(WITH_CLANG)
# set(CMAKE_C_COMPILER "clang")
# endif()
# if(WITH_CLANG)
# set(CMAKE_C_COMPILER "clang")
# endif()
if (WITH_VERBOSE)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -v")
@ -420,14 +430,18 @@ endif(APPLE)
if(OPENBSD)
set(WITH_MANPAGES "ON")
set(WITH_ALSA "OFF")
set(WITH_PULSE "OFF")
set(WITH_OSS "ON")
set(WITH_PULSE "OFF")
set(WITH_OSS "ON")
set(WITH_WAYLAND "OFF")
endif()
# Android
if(ANDROID)
set(WITH_LIBRARY_VERSIONING "OFF")
set(WITH_LIBRARY_VERSIONING "OFF")
if (${ANDROID_ABI} STREQUAL "armeabi")
set (WITH_NEON OFF)
endif()
if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
add_definitions(-DNDK_DEBUG=1)
@ -439,40 +453,23 @@ if(ANDROID)
endif()
set(CMAKE_C_LINK_FLAGS "${CMAKE_C_LINK_FLAGS} -llog")
if (NOT FREERDP_EXTERNAL_JPEG_PATH)
if(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/external/jpeg8d")
set(FREERDP_EXTERNAL_JPEG_PATH "${CMAKE_CURRENT_SOURCE_DIR}/external/jpeg8d")
if (NOT FREERDP_EXTERNAL_PATH)
if (IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/external/")
set (FREERDP_EXTERNAL_PATH "${CMAKE_CURRENT_SOURCE_DIR}/external/")
else()
message(STATUS "FREERDP_EXTERNAL_SSL_PATH not set! - Needs to be set if openssl is not found in the android NDK (which usually isn't)")
message(STATUS "FREERDP_EXTERNAL_PATH not set!")
endif()
endif()
if (NOT FREERDP_EXTERNAL_SSL_PATH)
if(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/external/openssl")
set(FREERDP_EXTERNAL_SSL_PATH "${CMAKE_CURRENT_SOURCE_DIR}/external/openssl")
else()
message(STATUS "FREERDP_EXTERNAL_SSL_PATH not set! - Needs to be set if openssl is not found in the android NDK (which usually isn't)")
endif()
if(WITH_GPROF)
if (NOT FREERDP_EXTERNAL_PROFILER_PATH)
if(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/external/android-ndk-profiler")
set(FREERDP_EXTERNAL_PROFILER_PATH
"${CMAKE_CURRENT_SOURCE_DIR}/external/android-ndk-profiler")
else()
message(STATUS "FREERDP_EXTERNAL_PROFILER_PATH not set!")
endif()
endif()
endif()
endif()
set(CMAKE_FIND_ROOT_PATH ${CMAKE_FIND_ROOT_PATH} ${FREERDP_EXTERNAL_SSL_PATH} ${FREERDP_EXTERNAL_JPEG_PATH})
set(CMAKE_FIND_ROOT_PATH ${CMAKE_FIND_ROOT_PATH} ${FREERDP_EXTERNAL_PROFILER_PATH})
set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/client/Android/FreeRDPCore/jni/${ANDROID_ABI})
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/scripts/regenerate_jni_headers.sh.cmake
${CMAKE_BINARY_DIR}/scripts/regenerate_jni_headers.sh @ONLY)
list (APPEND CMAKE_INCLUDE_PATH ${FREERDP_EXTERNAL_PATH}/include)
list (APPEND CMAKE_LIBRARY_PATH ${FREERDP_EXTERNAL_PATH}/${ANDROID_ABI}/ )
set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH )
set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH )
if (WITH_GPROF)
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/scripts/gprof_generate.sh.cmake ${CMAKE_BINARY_DIR}/scripts/gprof_generate.sh @ONLY)
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/scripts/gprof_generate.sh.cmake
${CMAKE_BINARY_DIR}/scripts/gprof_generate.sh @ONLY)
endif(WITH_GPROF)
endif()
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
@ -486,9 +483,9 @@ if(NOT WIN32)
endif()
if(WITH_VALGRIND_MEMCHECK)
check_include_files(valgrind/memcheck.h HAVE_VALGRIND_MEMCHECK_H)
check_include_files(valgrind/memcheck.h HAVE_VALGRIND_MEMCHECK_H)
else()
unset(HAVE_VALGRIND_MEMCHECK_H CACHE)
unset(HAVE_VALGRIND_MEMCHECK_H CACHE)
endif()
if(UNIX OR CYGWIN)
@ -626,6 +623,21 @@ if(APPLE)
set(OPENSLES_FEATURE_TYPE "DISABLED")
endif()
if(UNIX AND NOT ANDROID)
set(WLOG_SYSTEMD_JOURNAL_FEATURE_TYPE "RECOMMENDED")
set(WLOG_SYSTEMD_JOURNAL_FEATURE_PURPOSE "systemd journal appender")
set(WLOG_SYSTEMD_JOURNAL_FEATURE_DESCRIPTION "allows to export wLog to systemd journal")
#include(Findlibsystemd)
find_feature(libsystemd ${WLOG_SYSTEMD_JOURNAL_FEATURE_TYPE} ${WLOG_SYSTEMD_JOURNAL_FEATURE_PURPOSE} ${WLOG_SYSTEMD_JOURNAL_FEATURE_DESCRIPTION})
if(LIBSYSTEMD_FOUND)
set(HAVE_JOURNALD_H TRUE)
else()
unset(HAVE_JOURNALD_H)
endif()
endif(UNIX AND NOT ANDROID)
if(ANDROID)
set(X11_FEATURE_TYPE "DISABLED")
set(WAYLAND_FEATURE_TYPE "DISABLED")
@ -641,21 +653,6 @@ if(ANDROID)
set(OPENSLES_FEATURE_TYPE "REQUIRED")
endif()
if(UNIX)
set(WLOG_SYSTEMD_JOURNAL_FEATURE_TYPE "RECOMMENDED")
set(WLOG_SYSTEMD_JOURNAL_FEATURE_PURPOSE "systemd journal appender")
set(WLOG_SYSTEMD_JOURNAL_FEATURE_DESCRIPTION "allows to export wLog to systemd journal")
#include(Findlibsystemd)
find_feature(libsystemd ${WLOG_SYSTEMD_JOURNAL_FEATURE_TYPE} ${WLOG_SYSTEMD_JOURNAL_FEATURE_PURPOSE} ${WLOG_SYSTEMD_JOURNAL_FEATURE_DESCRIPTION})
if(LIBSYSTEMD_FOUND)
set(HAVE_JOURNALD_H TRUE)
else()
unset(HAVE_JOURNALD_H)
endif()
endif(UNIX)
find_feature(X11 ${X11_FEATURE_TYPE} ${X11_FEATURE_PURPOSE} ${X11_FEATURE_DESCRIPTION})
find_feature(Wayland ${WAYLAND_FEATURE_TYPE} ${WAYLAND_FEATURE_PURPOSE} ${WAYLAND_FEATURE_DESCRIPTION})
find_feature(DirectFB ${DIRECTFB_FEATURE_TYPE} ${DIRECTFB_FEATURE_PURPOSE} ${DIRECTFB_FEATURE_DESCRIPTION})
@ -728,8 +725,8 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DI
# RPATH configuration
if(CMAKE_SKIP_RPATH)
set(CMAKE_SKIP_RPATH FALSE)
set(CMAKE_SKIP_INSTALL_RPATH TRUE)
set(CMAKE_SKIP_RPATH FALSE)
set(CMAKE_SKIP_INSTALL_RPATH TRUE)
endif()
set(CMAKE_SKIP_BUILD_RPATH FALSE)
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)

View File

@ -1627,7 +1627,7 @@ if(NOT _CMAKE_IN_TRY_COMPILE)
else()
set( EXECUTABLE_OUTPUT_PATH "${LIBRARY_OUTPUT_PATH_ROOT}/bin" CACHE PATH "Output directory for applications" )
endif()
set( LIBRARY_OUTPUT_PATH "${LIBRARY_OUTPUT_PATH_ROOT}/libs/${ANDROID_NDK_OUTPUT_ABI_NAME}" CACHE PATH "path for android libs" )
set( CMAKE_INSTALL_LIBDIR "${ANDROID_NDK_OUTPUT_ABI_NAME}" CACHE PATH "path for android libs" )
endif()
# copy shaed stl library to build directory

View File

@ -15,19 +15,8 @@
# 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(WITH_ANDROID_DEBUG_MENU "Enable debug output for android jni bindings" ${DEFAULT_DEBUG_OPTION})
option(WITH_OPENSLES "Enable sound and microphone redirection using OpenSLES" ON)
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" ${JAVA_DEBUG_DEFAULT})
set(ANDROID_APP_VERSION 3 CACHE STRING "Application version")
set(ANDROID_APP_TARGET_SDK 21 CACHE STRING "Application target android SDK")
set(ANDROID_APP_MIN_SDK 14 CACHE STRING "Application minimum android SDK requirement")
set(ANDROID_APP_GOOGLE_TARGET_SDK "16" CACHE STRING "Application target google SDK")

View File

@ -89,6 +89,5 @@
#cmakedefine WITH_DEBUG_X11_CLIPRDR
#cmakedefine WITH_DEBUG_X11_LOCAL_MOVESIZE
#cmakedefine WITH_DEBUG_XV
#cmakedefine WITH_DEBUG_ANDROID_JNI
#cmakedefine WITH_DEBUG_RINGBUFFER
#endif

View File

@ -73,6 +73,10 @@ macro (winpr_definition_add)
set (WINPR_DEFINITIONS ${WINPR_DEFINITIONS} PARENT_SCOPE)
endmacro()
if (ANDROID)
winpr_library_add(log)
endif()
# Level "1" API as defined for MinCore.lib
set(WINPR_CORE synch locale library file comm pipe interlocked security
environment crypto registry credentials path io memory input shell

View File

@ -76,11 +76,6 @@ static char* GetPath_HOME(void)
#ifdef _WIN32
path = GetEnvAlloc("UserProfile");
#elif defined(ANDROID)
path = malloc(2);
if (!path)
return NULL;
strcpy(path, "/");
#else
path = GetEnvAlloc("HOME");
#endif

View File

@ -15,4 +15,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
winpr_module_add(shell.c)
if (NOT ANDROID)
winpr_module_add(shell.c)
endif()

View File

@ -146,6 +146,9 @@ static int g_DataId = 0;
static BOOL WLog_ConsoleAppender_WriteDataMessage(wLog* log, wLogAppender* appender, wLogMessage* message)
{
#if defined(ANDROID)
return FALSE;
#else
int DataId;
char* FullFileName;
@ -157,12 +160,16 @@ static BOOL WLog_ConsoleAppender_WriteDataMessage(wLog* log, wLogAppender* appen
free(FullFileName);
return TRUE;
#endif
}
static int g_ImageId = 0;
static BOOL WLog_ConsoleAppender_WriteImageMessage(wLog* log, wLogAppender* appender, wLogMessage* message)
{
#if defined(ANDROID)
return FALSE;
#else
int ImageId;
char* FullFileName;
@ -175,12 +182,16 @@ static BOOL WLog_ConsoleAppender_WriteImageMessage(wLog* log, wLogAppender* appe
free(FullFileName);
return TRUE;
#endif
}
static int g_PacketId = 0;
static BOOL WLog_ConsoleAppender_WritePacketMessage(wLog* log, wLogAppender* appender, wLogMessage* message)
{
#if defined(ANDROID)
return FALSE;
#else
int PacketId;
char* FullFileName;
@ -198,6 +209,7 @@ static BOOL WLog_ConsoleAppender_WritePacketMessage(wLog* log, wLogAppender* app
message->PacketData, message->PacketLength, message->PacketFlags);
return TRUE;
#endif
}
static BOOL WLog_ConsoleAppender_Set(wLogAppender* appender, const char *setting, void *value)
{