Fixed Android compilation with CMake

This commit is contained in:
pelya
2021-01-25 01:04:03 +02:00
parent 306bf73bbf
commit 3f828e860a
3 changed files with 16 additions and 3 deletions

View File

@@ -101,6 +101,10 @@ if(OPTION_TOOLS_ONLY)
return()
endif()
if(ANDROID)
include(AndroidSDL)
endif()
# Prefer -pthread over -lpthread, which is often the better option of the two.
set(CMAKE_THREAD_PREFER_PTHREAD YES)
# Make sure we have Threads available.
@@ -176,7 +180,13 @@ include_directories(${CMAKE_SOURCE_DIR}/src/3rdparty/squirrel/include)
include(MSVCFilters)
if(ANDROID)
add_library(openttd SHARED ${GENERATED_SOURCE_FILES})
target_link_libraries(openttd log z)
else()
add_executable(openttd WIN32 ${GENERATED_SOURCE_FILES})
endif()
set_target_properties(openttd PROPERTIES OUTPUT_NAME "${BINARY_NAME}")
# All other files are added via target_sources()

View File

@@ -38,11 +38,13 @@ foreach(MOD_NAME IN LISTS ICU_FIND_COMPONENTS)
unset(PC_LIBRARIES)
foreach(LIBRARY IN LISTS PC_ICU_${MOD_NAME}_LIBRARIES)
unset(PC_LIBRARY CACHE)
find_library(PC_LIBRARY NAMES ${LIBRARY})
if(NOT PC_LIBRARY)
if(NOT PC_ICU_${MOD_NAME}_LIBRARY)
find_library(PC_ICU_${MOD_NAME}_LIBRARY NAMES ${LIBRARY})
endif()
if(NOT PC_ICU_${MOD_NAME}_LIBRARY)
unset(PC_ICU_${MOD_NAME}_FOUND)
endif()
list(APPEND PC_LIBRARIES ${PC_LIBRARY})
list(APPEND PC_LIBRARIES ${PC_ICU_${MOD_NAME}_LIBRARY})
endforeach()
unset(PC_LIBRARY CACHE)

View File

@@ -21,6 +21,7 @@ install(TARGETS openttd
RUNTIME
DESTINATION ${BINARY_DESTINATION_DIR}
COMPONENT Runtime
LIBRARY DESTINATION ${BINARY_DESTINATION_DIR}
)
install(DIRECTORY