Android build system fixes (OpenSLES, CMAKE_PREFIX_PATH, debug symbols)

This commit is contained in:
Marc-André Moreau 2021-05-27 11:51:21 -04:00 committed by akallabeth
parent a7ce6699e3
commit 0029f6cc1d
2 changed files with 21 additions and 14 deletions

View File

@ -471,6 +471,14 @@ if(MSVC)
endif()
if(ANDROID)
# workaround for https://github.com/android-ndk/ndk/issues/243
string(REPLACE "-g " "" CMAKE_C_FLAGS ${CMAKE_C_FLAGS})
string(REPLACE "-g " "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -g")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g")
endif()
if(WIN32)
add_definitions(-DUNICODE -D_UNICODE)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
@ -600,6 +608,11 @@ if(ANDROID)
endif()
set(CMAKE_C_LINK_FLAGS "${CMAKE_C_LINK_FLAGS} -llog")
# CMAKE_PREFIX_PATH detection is broken in most Android toolchain files
# Append it to CMAKE_FIND_ROOT_PATH and avoid potential duplicates
list(APPEND CMAKE_FIND_ROOT_PATH ${CMAKE_PREFIX_PATH})
list(REMOVE_DUPLICATES CMAKE_FIND_ROOT_PATH)
if (NOT FREERDP_EXTERNAL_PATH)
if (IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/external/")
set (FREERDP_EXTERNAL_PATH "${CMAKE_CURRENT_SOURCE_DIR}/external/")

View File

@ -5,27 +5,19 @@
# OPENSLES_LIBRARIES - List of libraries when using dsound.
# OPENSLES_FOUND - True if dsound found.
if(OPENSLES_INCLUDE_DIR)
# Already in cache, be silent
set(OPENSLES_FIND_QUIETLY TRUE)
else()
find_package(PkgConfig)
pkg_check_modules(PC_OPENSLES QUIET OpenSLES)
endif(OPENSLES_INCLUDE_DIR)
find_path(OPENSLES_INCLUDE_DIR SLES/OpenSLES.h
HINTS ${PC_OPENSLES_INCLUDE_DIR})
get_property(_FIND_LIBRARY_USE_LIB64_PATHS GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS)
set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS 1)
find_library(OPENSLES_LIBRARY NAMES OpenSLES
HINTS ${PC_OPENSLES_LIBDIR} ${PC_OPENSLES_LIBRARY_DIRS})
find_path(OPENSLES_INCLUDE_DIR SLES/OpenSLES.h)
find_library(OPENSLES_LIBRARY NAMES OpenSLES)
# Handle the QUIETLY and REQUIRED arguments and set OPENSL_FOUND to TRUE if
# all listed variables are TRUE.
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(OPENSLES DEFAULT_MSG
OPENSLES_INCLUDE_DIR OPENSLES_LIBRARY)
if(OPENSLES_FOUND)
set(OPENSLES_INCLUDE_DIRS ${OPENSLES_INCLUDE_DIR})
set(OPENSLES_LIBRARIES ${OPENSLES_LIBRARY})
else(OPENSLES_FOUND)
if (OpenSLES_FIND_REQUIRED)
@ -34,3 +26,5 @@ else(OPENSLES_FOUND)
endif(OPENSLES_FOUND)
mark_as_advanced(OPENSLES_INCLUDE_DIR OPENSLES_LIBRARY)
set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS ${_FIND_LIBRARY_USE_LIB64_PATHS})