Skip to content

Commit

Permalink
cmake: build tests as library on Android
Browse files Browse the repository at this point in the history
  • Loading branch information
madebr committed Mar 27, 2023
1 parent b8b852a commit 1259a60
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .github/workflows/android.yml
Expand Up @@ -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 }} \
Expand Down
9 changes: 8 additions & 1 deletion test/CMakeLists.txt
Expand Up @@ -73,7 +73,11 @@ macro(add_sdl_test_executable TARGET)
if(AST_NEEDS_RESOURCES)
list(APPEND AST_SOURCES ${RESOURCE_FILES})
endif()
add_executable(${TARGET} ${AST_SOURCES})
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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 1259a60

Please sign in to comment.