cmake: build tests as library on Android

This commit is contained in:
Anonymous Maarten 2023-03-28 00:38:07 +02:00
parent b8b852a55b
commit 1259a60731
2 changed files with 10 additions and 1 deletions

View File

@ -40,6 +40,8 @@ jobs:
-Wdeprecated -Wdev -Werror \
-DCMAKE_TOOLCHAIN_FILE=${{ steps.setup_ndk.outputs.ndk-path }}/build/cmake/android.toolchain.cmake \
-DSDL_WERROR=ON \
-DSDL_TESTS=ON \
-DSDL_INSTALL_TESTS=ON \
-DSDL_CLANG_TIDY=ON \
-DANDROID_PLATFORM=${{ matrix.platform.android_platform }} \
-DANDROID_ABI=${{ matrix.platform.android_abi }} \

View File

@ -73,7 +73,11 @@ macro(add_sdl_test_executable TARGET)
if(AST_NEEDS_RESOURCES)
list(APPEND AST_SOURCES ${RESOURCE_FILES})
endif()
if(ANDROID)
add_library(${TARGET} SHARED ${AST_SOURCES})
else()
add_executable(${TARGET} ${AST_SOURCES})
endif()
target_link_libraries(${TARGET} PRIVATE SDL3::SDL3_test SDL3::${sdl_name_component})
if(AST_TESTUTILS)
target_link_libraries(${TARGET} PRIVATE sdltests_utils)
@ -204,6 +208,9 @@ add_sdl_test_executable(testgamepad NEEDS_RESOURCES TESTUTILS SOURCES testgamepa
add_sdl_test_executable(testgeometry TESTUTILS SOURCES testgeometry.c)
add_sdl_test_executable(testgl SOURCES testgl.c)
add_sdl_test_executable(testgles SOURCES testgles.c)
if(ANDROID)
target_link_libraries(testgles PRIVATE GLESv1_CM)
endif()
add_sdl_test_executable(testgles2 SOURCES testgles2.c)
add_sdl_test_executable(testgles2_sdf TESTUTILS SOURCES testgles2_sdf.c)
add_sdl_test_executable(testhaptic SOURCES testhaptic.c)