Skip to content

Commit

Permalink
chore: add patch to fix riscv64
Browse files Browse the repository at this point in the history
  • Loading branch information
ernado committed Jan 19, 2024
1 parent 2c5fa07 commit 24fc51c
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions riscv64.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 909cfe39a..5f0b375ab 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -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})
@@ -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 24fc51c

Please sign in to comment.