Skip to content

Commit

Permalink
ci: fix build on riscv64
Browse files Browse the repository at this point in the history
  • Loading branch information
ernado committed Jan 19, 2024
1 parent 24fc51c commit e71c08b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ if (NOT MSVC)
return static_cast<int>(std::atomic<int64_t>{});
}
" protobuf_HAVE_BUILTIN_ATOMICS)
if (NOT protobuf_HAVE_BUILTIN_ATOMICS)
if (NOT protobuf_HAVE_BUILTIN_ATOMICS OR ${CMAKE_SYSTEM_PROCESSOR} MATCHES "riscv")
set(protobuf_LINK_LIBATOMIC true)
endif (NOT protobuf_HAVE_BUILTIN_ATOMICS)
set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
Expand Down Expand Up @@ -405,3 +405,8 @@ endif (protobuf_BUILD_EXAMPLES)
if(protobuf_VERBOSE)
message(STATUS "Protocol Buffers Configuring done")
endif(protobuf_VERBOSE)

if(CMAKE_SYSTEM_PROCESSOR STREQUAL "riscv64")
string(APPEND CMAKE_C_STANDARD_LIBRARIES " -latomic")
string(APPEND CMAKE_CXX_STANDARD_LIBRARIES " -latomic")
endif()

0 comments on commit e71c08b

Please sign in to comment.