Fixed Fontconfig not linking on Android

This commit is contained in:
pelya
2021-02-05 23:18:42 +02:00
parent 8368912214
commit 40f573cb91
2 changed files with 29 additions and 25 deletions
+8 -5
View File
@@ -214,11 +214,6 @@ if(IPO_FOUND)
endif()
set_target_properties(openttd PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/bin")
process_compile_flags()
if(ANDROID)
# A bug in Android NDK r22: https://github.com/android/ndk/issues/1418
#get_source_file_property(TMP_CFLAGS ${CMAKE_SOURCE_DIR}/src/settings.cpp COMPILE_FLAGS)
set_source_files_properties(${CMAKE_SOURCE_DIR}/src/settings.cpp PROPERTIES COMPILE_FLAGS "-O1")
endif()
include(LinkPackage)
link_package(PNG TARGET PNG::PNG ENCOURAGED)
@@ -238,6 +233,14 @@ if(NOT OPTION_DEDICATED)
link_package(ICU_i18n)
endif()
if(ANDROID)
target_link_libraries(openttd
${EXPAT_LIBRARY}
)
# A bug in Android NDK r22: https://github.com/android/ndk/issues/1418
set_source_files_properties(${CMAKE_SOURCE_DIR}/src/settings.cpp PROPERTIES COMPILE_FLAGS "-O1")
endif(ANDROID)
if(APPLE)
link_package(Iconv TARGET Iconv::Iconv)
+21 -20
View File
@@ -32,28 +32,29 @@ This will define the following variables in your project:
#]=======================================================================]
if(NOT ANDROID)
# use pkg-config to get the directories and then use these values
# in the FIND_PATH() and FIND_LIBRARY() calls
find_package(PkgConfig QUIET)
pkg_check_modules(PKG_FONTCONFIG QUIET fontconfig)
set(Fontconfig_COMPILE_OPTIONS ${PKG_FONTCONFIG_CFLAGS_OTHER})
set(Fontconfig_VERSION ${PKG_FONTCONFIG_VERSION})
# use pkg-config to get the directories and then use these values
# in the FIND_PATH() and FIND_LIBRARY() calls
find_package(PkgConfig QUIET)
pkg_check_modules(PKG_FONTCONFIG QUIET fontconfig)
set(Fontconfig_COMPILE_OPTIONS ${PKG_FONTCONFIG_CFLAGS_OTHER})
set(Fontconfig_VERSION ${PKG_FONTCONFIG_VERSION})
find_path( Fontconfig_INCLUDE_DIR
NAMES
fontconfig/fontconfig.h
HINTS
${PKG_FONTCONFIG_INCLUDE_DIRS}
/usr/X11/include
)
find_path( Fontconfig_INCLUDE_DIR
NAMES
fontconfig/fontconfig.h
HINTS
${PKG_FONTCONFIG_INCLUDE_DIRS}
/usr/X11/include
)
find_library( Fontconfig_LIBRARY
NAMES
fontconfig
PATHS
${PKG_FONTCONFIG_LIBRARY_DIRS}
)
find_library( Fontconfig_LIBRARY
NAMES
fontconfig
PATHS
${PKG_FONTCONFIG_LIBRARY_DIRS}
)
endif (NOT ANDROID)
if(Fontconfig_INCLUDE_DIR AND NOT Fontconfig_VERSION)
file(STRINGS ${Fontconfig_INCLUDE_DIR}/fontconfig/fontconfig.h _contents REGEX "^#define[ \t]+FC_[A-Z]+[ \t]+[0-9]+$")