Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[build] Link atomic on armv7 platforms #2114

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ option(ATOMIC_USE_SRT_SYNC_MUTEX "Use srt::sync::Mutex to Implement Atomics" OFF
if (ATOMIC_USE_SRT_SYNC_MUTEX)
add_definitions(-DATOMIC_USE_SRT_SYNC_MUTEX=1)
endif()
message(STATUS "ATOMIC_USE_SRT_SYNC_MUTEX: ${ATOMIC_USE_SRT_SYNC_MUTEX}")

set(TARGET_srt "srt" CACHE STRING "The name for the SRT library")

Expand Down Expand Up @@ -536,6 +537,10 @@ if (FORCE_CXX_STANDARD)
endif()
endif()

if (NOT ATOMIC_USE_SRT_SYNC_MUTEX AND ${CMAKE_SYSTEM_PROCESSOR} MATCHES "armv7l")
set(WITH_EXTRALIBS "${WITH_EXTRALIBS} -latomic")
endif()

# add extra warning flags for gccish compilers
if (HAVE_COMPILER_GNU_COMPAT)
set (SRT_GCC_WARN "-Wall -Wextra")
Expand All @@ -560,6 +565,7 @@ endif()
# but may help in several corner cases in unusual platforms.
if (WITH_EXTRALIBS)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${WITH_EXTRALIBS}")
message(STATUS "WITH_EXTRALIBS: ${WITH_EXTRALIBS}")
endif()

# CMake has only discovered in 3.3 version that some set-finder is
Expand Down Expand Up @@ -877,8 +883,6 @@ if (srt_libspec_shared)
target_link_libraries(${TARGET_srt}_shared PRIVATE wsock32.lib ws2_32.lib)
elseif (APPLE)
set_property(TARGET ${TARGET_srt}_shared PROPERTY MACOSX_RPATH ON)
elseif (ANDROID)
target_link_libraries(${TARGET_srt}_shared PRIVATE atomic)
endif()
if (USE_GNUSTL)
target_link_libraries(${TARGET_srt}_shared PRIVATE ${GNUSTL_LIBRARIES} ${GNUSTL_LDFLAGS})
Expand Down Expand Up @@ -913,8 +917,6 @@ if (srt_libspec_static)
endif()
elseif (MINGW)
target_link_libraries(${TARGET_srt}_static PRIVATE wsock32 ws2_32)
elseif (ANDROID)
target_link_libraries(${TARGET_srt}_static PUBLIC atomic)
endif()
if (USE_GNUSTL)
target_link_libraries(${TARGET_srt}_static PRIVATE ${GNUSTL_LIBRARIES} ${GNUSTL_LDFLAGS})
Expand Down