shmcpp/CMakeLists.txt
2026-01-11 13:27:05 +08:00

50 lines
1.6 KiB
CMake

cmake_minimum_required(VERSION 4.0)
project(shmcpp)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if (WIN32)
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/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/containers/spsc_ring_buffer.hpp
include/shmcpp/containers/mpsc_ring_buffer.hpp
include/shmcpp/detail/handle/handle_concept.hpp
${PLATFORM_HEADERS}
)
target_include_directories(shmcpp PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/include
)