Skip to content
Closed
Show file tree
Hide file tree
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
67 changes: 67 additions & 0 deletions ports/atomic-queue/001_install.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c9dc427..456c99b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -12,6 +12,11 @@ OPTION( ATOMIC_QUEUE_BUILD_EXAMPLES
OFF
)

+OPTION( ATOMIC_QUEUE_ENABLE_INSTALL
+ "If the install target should be enabled."
+ OFF
+)
+
if ( PROJECT_IS_TOP_LEVEL )
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED)
@@ -26,5 +31,3 @@ endif()
if ( ATOMIC_QUEUE_BUILD_TESTS OR ATOMIC_QUEUE_BUILD_EXAMPLES)
add_subdirectory( src )
endif()
-
-add_library(max0x7ba::atomic_queue ALIAS atomic_queue)
\ No newline at end of file
diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt
index 7ca376d..4d44523 100644
--- a/include/CMakeLists.txt
+++ b/include/CMakeLists.txt
@@ -1,17 +1,25 @@
CMAKE_MINIMUM_REQUIRED( VERSION 3.25 )

-add_library(
- atomic_queue
- INTERFACE
- ${CMAKE_CURRENT_SOURCE_DIR}/atomic_queue/atomic_queue.h
- ${CMAKE_CURRENT_SOURCE_DIR}/atomic_queue/atomic_queue_mutex.h
- ${CMAKE_CURRENT_SOURCE_DIR}/atomic_queue/barrier.h
- ${CMAKE_CURRENT_SOURCE_DIR}/atomic_queue/defs.h
- ${CMAKE_CURRENT_SOURCE_DIR}/atomic_queue/spinlock.h
+include(GNUInstallDirs)
+
+add_library(atomic_queue INTERFACE)
+target_include_directories(atomic_queue INTERFACE
+ "$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}>"
+ "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
)

-target_include_directories(
- atomic_queue
- INTERFACE
- ${CMAKE_CURRENT_SOURCE_DIR}
-)
\ No newline at end of file
+add_library(atomic_queue::atomic_queue ALIAS atomic_queue)
+
+if ( ATOMIC_QUEUE_ENABLE_INSTALL )
+ install(TARGETS atomic_queue EXPORT atomic_queue)
+ install(
+ DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/atomic_queue"
+ DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
+ )
+ install(
+ EXPORT atomic_queue
+ FILE atomic_queue-config.cmake
+ DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/atomic_queue"
+ NAMESPACE atomic_queue::
+ )
+endif ()
31 changes: 31 additions & 0 deletions ports/atomic-queue/002_fix_nil_conflict.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
diff --git a/include/atomic_queue/atomic_queue.h b/include/atomic_queue/atomic_queue.h
index 05540d3..9010b62 100644
--- a/include/atomic_queue/atomic_queue.h
+++ b/include/atomic_queue/atomic_queue.h
@@ -117,7 +117,7 @@ ATOMIC_QUEUE_INLINE static constexpr uint64_t round_up_to_power_of_2(uint64_t a)
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

template<class T>
-constexpr T nil() noexcept {
+constexpr T nil_value() noexcept {
#if __cpp_lib_atomic_is_always_lock_free // Better compile-time error message requires C++17.
static_assert(std::atomic<T>::is_always_lock_free, "Queue element type T is not atomic. Use AtomicQueue2/AtomicQueueB2 for such element types.");
#endif
@@ -359,7 +359,7 @@ public:

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

-template<class T, unsigned SIZE, T NIL = details::nil<T>(), bool MINIMIZE_CONTENTION = true, bool MAXIMIZE_THROUGHPUT = true, bool TOTAL_ORDER = false, bool SPSC = false>
+template<class T, unsigned SIZE, T NIL = details::nil_value<T>(), bool MINIMIZE_CONTENTION = true, bool MAXIMIZE_THROUGHPUT = true, bool TOTAL_ORDER = false, bool SPSC = false>
class AtomicQueue : public AtomicQueueCommon<AtomicQueue<T, SIZE, NIL, MINIMIZE_CONTENTION, MAXIMIZE_THROUGHPUT, TOTAL_ORDER, SPSC>> {
using Base = AtomicQueueCommon<AtomicQueue<T, SIZE, NIL, MINIMIZE_CONTENTION, MAXIMIZE_THROUGHPUT, TOTAL_ORDER, SPSC>>;
friend Base;
@@ -433,7 +433,7 @@ public:

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

-template<class T, class A = std::allocator<T>, T NIL = details::nil<T>(), bool MAXIMIZE_THROUGHPUT = true, bool TOTAL_ORDER = false, bool SPSC = false>
+template<class T, class A = std::allocator<T>, T NIL = details::nil_value<T>(), bool MAXIMIZE_THROUGHPUT = true, bool TOTAL_ORDER = false, bool SPSC = false>
class AtomicQueueB : private std::allocator_traits<A>::template rebind_alloc<std::atomic<T>>,
public AtomicQueueCommon<AtomicQueueB<T, A, NIL, MAXIMIZE_THROUGHPUT, TOTAL_ORDER, SPSC>> {
using AllocatorElements = typename std::allocator_traits<A>::template rebind_alloc<std::atomic<T>>;
20 changes: 11 additions & 9 deletions ports/atomic-queue/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,21 @@ vcpkg_from_github(
REF "v${VERSION}"
SHA512 94dcb32fa812b684e1d713b860e5f22f053a3e9f39aa619ca217cfbc0b88643b0ccf87c0a6016eb929f5766d3bf2d046c6d4dbeb128d96f7e29437a95331301c
HEAD_REF master
PATCHES
001_install.patch
002_fix_nil_conflict.patch
)

set(VCPKG_BUILD_TYPE release) # header-only port

file(
COPY
"${SOURCE_PATH}/include/atomic_queue/atomic_queue.h"
"${SOURCE_PATH}/include/atomic_queue/atomic_queue_mutex.h"
"${SOURCE_PATH}/include/atomic_queue/barrier.h"
"${SOURCE_PATH}/include/atomic_queue/defs.h"
"${SOURCE_PATH}/include/atomic_queue/spinlock.h"
DESTINATION
"${CURRENT_PACKAGES_DIR}/include/atomic_queue"
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
-DATOMIC_QUEUE_ENABLE_INSTALL=ON
)
vcpkg_cmake_install()
vcpkg_cmake_config_fixup(PACKAGE_NAME atomic_queue)

file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/lib")

vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
13 changes: 12 additions & 1 deletion ports/atomic-queue/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
{
"name": "atomic-queue",
"version": "1.7.1",
"port-version": 1,
"description": "Minimalistic header-only thread-safe ultra-low-latency multiple-producer-multiple-consumer lockless queues based on circular buffer with std::atomic.",
"homepage": "https://github.com/max0x7ba/atomic_queue",
"license": "MIT"
"license": "MIT",
"dependencies": [
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
]
}
5 changes: 5 additions & 0 deletions versions/a-/atomic-queue.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "af05ff651972c08c33a71fb03688871e7394048a",
"version": "1.7.1",
"port-version": 1
},
{
"git-tree": "e97b5dcafeb90882b25f52ab4c8bef1ae97d7c43",
"version": "1.7.1",
Expand Down
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@
},
"atomic-queue": {
"baseline": "1.7.1",
"port-version": 0
"port-version": 1
},
"attr": {
"baseline": "2.5.2",
Expand Down