feat: Adjust project structure
This commit is contained in:
parent
517b74f00d
commit
217eb0564a
@ -5,23 +5,42 @@ set(CMAKE_CXX_STANDARD 20)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
if (WIN32)
|
||||
set(PLATFORM_SOURCES src/win32/handle.cpp)
|
||||
set(PLATFORM_HEADERS include/shmcpp/detail/win32/handle.hpp
|
||||
include/shmcpp/detail/win32/native_api.hpp
|
||||
include/shmcpp/detail/win32/utils.hpp
|
||||
set(PLATFORM_SOURCES
|
||||
src/handle/win32/handle.cpp
|
||||
src/containers/win32/spsc_ring_buffer.cpp
|
||||
src/containers/win32/mpsc_ring_buffer.cpp
|
||||
)
|
||||
set(PLATFORM_HEADERS
|
||||
include/shmcpp/detail/handle/win32/handle.hpp
|
||||
include/shmcpp/detail/handle/win32/native_api.hpp
|
||||
include/shmcpp/detail/handle/win32/utils.hpp
|
||||
include/shmcpp/detail/containers/win32/spsc_ring_buffer.hpp
|
||||
include/shmcpp/detail/containers/win32/mpsc_ring_buffer.hpp
|
||||
)
|
||||
else ()
|
||||
set(PLATFORM_SOURCES src/posix/handle.cpp)
|
||||
set(PLATFORM_HEADERS include/shmcpp/detail/posix/handle.hpp)
|
||||
set(PLATFORM_SOURCES
|
||||
src/handle/posix/handle.cpp
|
||||
src/containers/posix/spsc_ring_buffer.cpp
|
||||
src/containers/posix/mpsc_ring_buffer.cpp
|
||||
)
|
||||
set(PLATFORM_HEADERS
|
||||
include/shmcpp/detail/handle/posix/handle.hpp
|
||||
include/shmcpp/detail/containers/posix/spsc_ring_buffer.hpp
|
||||
include/shmcpp/detail/containers/posix/mpsc_ring_buffer.hpp
|
||||
)
|
||||
endif ()
|
||||
|
||||
add_library(shmcpp STATIC
|
||||
src/shared_memory.cpp
|
||||
src/mapped_view.cpp
|
||||
src/containers/spsc_ring_buffer.cpp
|
||||
src/containers/mpsc_ring_buffer.cpp
|
||||
${PLATFORM_SOURCES}
|
||||
include/shmcpp/shared_memory.hpp
|
||||
include/shmcpp/mapped_view.hpp
|
||||
include/shmcpp/detail/handle_concept.hpp
|
||||
include/shmcpp/containers/spsc_ring_buffer.hpp
|
||||
include/shmcpp/containers/mpsc_ring_buffer.hpp
|
||||
include/shmcpp/detail/handle/handle_concept.hpp
|
||||
${PLATFORM_HEADERS}
|
||||
)
|
||||
|
||||
|
||||
8
include/shmcpp/containers/mpsc_ring_buffer.hpp
Normal file
8
include/shmcpp/containers/mpsc_ring_buffer.hpp
Normal file
@ -0,0 +1,8 @@
|
||||
//
|
||||
// Created by DaLaw2 on 2026/1/11.
|
||||
//
|
||||
|
||||
#ifndef SHMCPP_MPSC_RING_BUFFER_HPP
|
||||
#define SHMCPP_MPSC_RING_BUFFER_HPP
|
||||
|
||||
#endif //SHMCPP_MPSC_RING_BUFFER_HPP
|
||||
8
include/shmcpp/containers/spsc_ring_buffer.hpp
Normal file
8
include/shmcpp/containers/spsc_ring_buffer.hpp
Normal file
@ -0,0 +1,8 @@
|
||||
//
|
||||
// Created by DaLaw2 on 2026/1/11.
|
||||
//
|
||||
|
||||
#ifndef SHMCPP_SPSC_RING_BUFFER_HPP
|
||||
#define SHMCPP_SPSC_RING_BUFFER_HPP
|
||||
|
||||
#endif //SHMCPP_SPSC_RING_BUFFER_HPP
|
||||
@ -0,0 +1,8 @@
|
||||
//
|
||||
// Created by DaLaw2 on 2026/1/11.
|
||||
//
|
||||
|
||||
#ifndef SHMCPP_MPSC_RING_BUFFER_HPP
|
||||
#define SHMCPP_MPSC_RING_BUFFER_HPP
|
||||
|
||||
#endif //SHMCPP_MPSC_RING_BUFFER_HPP
|
||||
@ -0,0 +1,8 @@
|
||||
//
|
||||
// Created by DaLaw2 on 2026/1/11.
|
||||
//
|
||||
|
||||
#ifndef SHMCPP_SPSC_RING_BUFFER_HPP
|
||||
#define SHMCPP_SPSC_RING_BUFFER_HPP
|
||||
|
||||
#endif //SHMCPP_SPSC_RING_BUFFER_HPP
|
||||
@ -0,0 +1,8 @@
|
||||
//
|
||||
// Created by DaLaw2 on 2026/1/11.
|
||||
//
|
||||
|
||||
#ifndef SHMCPP_MPSC_RING_BUFFER_HPP
|
||||
#define SHMCPP_MPSC_RING_BUFFER_HPP
|
||||
|
||||
#endif //SHMCPP_MPSC_RING_BUFFER_HPP
|
||||
@ -0,0 +1,8 @@
|
||||
//
|
||||
// Created by DaLaw2 on 2026/1/11.
|
||||
//
|
||||
|
||||
#ifndef SHMCPP_SPSC_RING_BUFFER_HPP
|
||||
#define SHMCPP_SPSC_RING_BUFFER_HPP
|
||||
|
||||
#endif //SHMCPP_SPSC_RING_BUFFER_HPP
|
||||
@ -5,7 +5,7 @@
|
||||
#ifndef SHMCPP_POSIX_HANDLE_HPP
|
||||
#define SHMCPP_POSIX_HANDLE_HPP
|
||||
|
||||
#include <shmcpp/detail/handle_concept.hpp>
|
||||
#include <shmcpp/detail/handle/handle_concept.hpp>
|
||||
|
||||
namespace shmcpp::detail {
|
||||
class PosixHandle {
|
||||
@ -8,7 +8,7 @@
|
||||
#include <string>
|
||||
#include <cstddef>
|
||||
#include <windows.h>
|
||||
#include <shmcpp/detail/handle_concept.hpp>
|
||||
#include <shmcpp/detail/handle/handle_concept.hpp>
|
||||
|
||||
namespace shmcpp::detail {
|
||||
class Win32Handle {
|
||||
@ -8,9 +8,9 @@
|
||||
#include <string>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <shmcpp/detail/win32/handle.hpp>
|
||||
#include <shmcpp/detail/handle/win32/handle.hpp>
|
||||
#else
|
||||
#include <shmcpp/detail/posix/handle.hpp>
|
||||
#include <shmcpp/detail/handle/posix/handle.hpp>
|
||||
#endif
|
||||
#include <shmcpp/mapped_view.hpp>
|
||||
|
||||
|
||||
3
src/containers/mpsc_ring_buffer.cpp
Normal file
3
src/containers/mpsc_ring_buffer.cpp
Normal file
@ -0,0 +1,3 @@
|
||||
//
|
||||
// Created by DaLaw2 on 2026/1/11.
|
||||
//
|
||||
3
src/containers/posix/mpsc_ring_buffer.cpp
Normal file
3
src/containers/posix/mpsc_ring_buffer.cpp
Normal file
@ -0,0 +1,3 @@
|
||||
//
|
||||
// Created by DaLaw2 on 2026/1/11.
|
||||
//
|
||||
3
src/containers/posix/spsc_ring_buffer.cpp
Normal file
3
src/containers/posix/spsc_ring_buffer.cpp
Normal file
@ -0,0 +1,3 @@
|
||||
//
|
||||
// Created by DaLaw2 on 2026/1/11.
|
||||
//
|
||||
3
src/containers/spsc_ring_buffer.cpp
Normal file
3
src/containers/spsc_ring_buffer.cpp
Normal file
@ -0,0 +1,3 @@
|
||||
//
|
||||
// Created by DaLaw2 on 2026/1/11.
|
||||
//
|
||||
3
src/containers/win32/mpsc_ring_buffer.cpp
Normal file
3
src/containers/win32/mpsc_ring_buffer.cpp
Normal file
@ -0,0 +1,3 @@
|
||||
//
|
||||
// Created by DaLaw2 on 2026/1/11.
|
||||
//
|
||||
3
src/containers/win32/spsc_ring_buffer.cpp
Normal file
3
src/containers/win32/spsc_ring_buffer.cpp
Normal file
@ -0,0 +1,3 @@
|
||||
//
|
||||
// Created by DaLaw2 on 2026/1/11.
|
||||
//
|
||||
@ -10,7 +10,7 @@
|
||||
#include <sys/mman.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include "shmcpp/detail/posix/handle.hpp"
|
||||
#include "shmcpp/detail/handle/posix/handle.hpp"
|
||||
|
||||
namespace shmcpp::detail {
|
||||
PosixHandle::PosixHandle(int fd, std::size_t size, const std::string& name)
|
||||
@ -5,9 +5,9 @@
|
||||
#include <format>
|
||||
#include <stdexcept>
|
||||
|
||||
#include "shmcpp/detail/win32/handle.hpp"
|
||||
#include "shmcpp/detail/win32/native_api.hpp"
|
||||
#include "shmcpp/detail/win32/utils.hpp"
|
||||
#include "shmcpp/detail/handle/win32/handle.hpp"
|
||||
#include "shmcpp/detail/handle/win32/native_api.hpp"
|
||||
#include "shmcpp/detail/handle/win32/utils.hpp"
|
||||
|
||||
namespace shmcpp::detail {
|
||||
Win32Handle::Win32Handle(const HANDLE handle, const std::size_t size, const std::string& name) noexcept
|
||||
Loading…
x
Reference in New Issue
Block a user