Do not link to pthread when targeting Android

I had issues compiling this for Android, and as it turns out, pthread functionality
is part of Bionic itself and linking is not required.
This commit is contained in:
aabajyan 2024-03-19 23:46:32 +04:00 committed by Saúl Ibarra Corretgé
parent 8db7d24f98
commit 48cb3ac410
2 changed files with 3 additions and 2 deletions

View file

@ -543,7 +543,7 @@ jobs:
run: |
mkdir build
cd build
$ANDROID_HOME/cmake/3.22.1/bin/cmake -DCMAKE_TOOLCHAIN_FILE=$ANDROID_HOME/ndk/26.0.10792818/build/cmake/android.toolchain.cmake -DCMAKE_BUILD_TYPE=Release -DANDROID_ABI="arm64-v8a" -DANDROID_PLATFORM=android-24 ..
$ANDROID_HOME/cmake/3.22.1/bin/cmake -DCMAKE_TOOLCHAIN_FILE=$ANDROID_HOME/ndk/26.0.10792818/build/cmake/android.toolchain.cmake -DCMAKE_BUILD_TYPE=Release -DANDROID_ABI="arm64-v8a" -DANDROID_PLATFORM=android-24 -DBUILD_QJS_LIBC=ON ..
- name: Build android arm64
run: |
$ANDROID_HOME/cmake/3.22.1/bin/cmake --build build --target qjs

View file

@ -155,7 +155,8 @@ endif()
list(APPEND qjs_defines _GNU_SOURCE)
list(APPEND qjs_libs qjs ${CMAKE_DL_LIBS})
if(NOT MSVC)
list(APPEND qjs_libs m pthread)
find_package(Threads)
list(APPEND qjs_libs ${CMAKE_THREAD_LIBS_INIT} m)
endif()
add_library(qjs ${qjs_sources})