Skip to content

Commit

Permalink
Add pthread flags explicitly (#16)
Browse files Browse the repository at this point in the history
Summary:
This is needed for the PyTorch host build because it includes libgtest.a
but doesn't provide any indication that it depends on pthreads.  Should
be totally safe on Android.
Pull Request resolved: #16

Test Plan: CI.  Not sure how to test the OSS Android build.

Reviewed By: passy

Differential Revision: D18056874

Pulled By: dreiss

fbshipit-source-id: 5c8044a4285f991c46cbc9665c901e0f6e9a17d0
  • Loading branch information
dreiss authored and facebook-github-bot committed Oct 22, 2019
1 parent a99eebc commit 3e3f9ad
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ project(fbjni CXX)
set(FBJNI_COMPILE_OPTIONS
-Wall
-std=c++11
-pthread
-fno-omit-frame-pointer
-fexceptions
-frtti
Expand Down
4 changes: 4 additions & 0 deletions test/jni/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

enable_testing()
include(GoogleTest)
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)

set(TEST_COMPILE_OPTIONS
"${FBJNI_COMPILE_OPTIONS}"
Expand Down Expand Up @@ -64,6 +66,7 @@ target_compile_options(modified_utf8_test PRIVATE ${TEST_COMPILE_OPTIONS})
target_link_libraries(modified_utf8_test
fbjni
gtest
Threads::Threads
dl
)
gtest_add_tests(TARGET modified_utf8_test)
Expand All @@ -75,6 +78,7 @@ target_compile_options(utf16toUTF8_test PRIVATE ${TEST_COMPILE_OPTIONS})
target_link_libraries(utf16toUTF8_test
fbjni
gtest
Threads::Threads
dl
)
gtest_add_tests(TARGET utf16toUTF8_test)

0 comments on commit 3e3f9ad

Please sign in to comment.