(Android) Fixed some CMake issues when building ARM and x86 at the same time

This commit is contained in:
Leon Styhre 2024-01-15 17:39:25 +01:00
parent 1232d703c4
commit 3964cb2bcf
3 changed files with 20 additions and 4 deletions

View file

@ -613,11 +613,15 @@ else()
endif() endif()
if(NOT WIN32) if(NOT WIN32)
# SVG rendering library LunaSVG. # SVG rendering library LunaSVG and Lottie animation library rlottie.
if(ANDROID)
set(COMMON_LIBRARIES ${COMMON_LIBRARIES} ${PROJECT_SOURCE_DIR}/android_${ANDROID_ABI}/liblunasvg.a)
set(COMMON_LIBRARIES ${COMMON_LIBRARIES} ${PROJECT_SOURCE_DIR}/android_${ANDROID_ABI}/librlottie.a)
else()
set(COMMON_LIBRARIES ${COMMON_LIBRARIES} ${PROJECT_SOURCE_DIR}/liblunasvg.a) set(COMMON_LIBRARIES ${COMMON_LIBRARIES} ${PROJECT_SOURCE_DIR}/liblunasvg.a)
# Lottie animation library rlottie.
set(COMMON_LIBRARIES ${COMMON_LIBRARIES} ${PROJECT_SOURCE_DIR}/librlottie.a) set(COMMON_LIBRARIES ${COMMON_LIBRARIES} ${PROJECT_SOURCE_DIR}/librlottie.a)
endif() endif()
endif()
if(APPLE) if(APPLE)
# See es-app/CMakeLists.txt for an explation for why an extra "Resources" directory # See es-app/CMakeLists.txt for an explation for why an extra "Resources" directory

View file

@ -182,3 +182,7 @@ endif()
include_directories(${COMMON_INCLUDE_DIRS}) include_directories(${COMMON_INCLUDE_DIRS})
add_library(es-core STATIC ${CORE_SOURCES} ${CORE_HEADERS}) add_library(es-core STATIC ${CORE_SOURCES} ${CORE_HEADERS})
target_link_libraries(es-core ${COMMON_LIBRARIES}) target_link_libraries(es-core ${COMMON_LIBRARIES})
if(ANDROID)
set_target_properties(es-core PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/android_${ANDROID_ABI})
endif()

View file

@ -40,6 +40,10 @@ if(CMAKE_CXX_COMPILER_ID MATCHES MSVC)
target_compile_options(lunasvg PRIVATE "/wd4251" "/wd4267") target_compile_options(lunasvg PRIVATE "/wd4251" "/wd4267")
endif() endif()
if(ANDROID)
set_target_properties(lunasvg PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/android_${ANDROID_ABI})
endif()
# Disable threading support for rlottie as this functionality actually leads to far worse # Disable threading support for rlottie as this functionality actually leads to far worse
# performance. As well there is a bug on Windows that makes rlottie hang forever on application # performance. As well there is a bug on Windows that makes rlottie hang forever on application
# shutdown if compiled using MinGW with threading support enabled. # shutdown if compiled using MinGW with threading support enabled.
@ -60,5 +64,9 @@ else()
target_compile_options(rlottie PRIVATE "-w") target_compile_options(rlottie PRIVATE "-w")
endif() endif()
if(ANDROID)
set_target_properties(rlottie PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/android_${ANDROID_ABI})
endif()
# Build LunaSVG before rlottie. # Build LunaSVG before rlottie.
add_dependencies(rlottie lunasvg) add_dependencies(rlottie lunasvg)