Skip to content

Commit 919d480

Browse files
committed
make shared memory optional
1 parent c0a6b8b commit 919d480

4 files changed

Lines changed: 19 additions & 6 deletions

File tree

.github/workflows/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ jobs:
7676

7777
- name: Configure and build
7878
run: |
79-
cmake . -B build -DSIMPLE_SOCKET_BUILD_TESTS=ON -DSIMPLE_SOCKET_WITH_TLS=OFF -DSIMPLE_SOCKET_WITH_MQTT=OFF -DSIMPLE_SOCKET_WITH_MODBUS=OFF -DCMAKE_BUILD_TYPE="Release"
79+
cmake . -B build -DSIMPLE_SOCKET_BUILD_TESTS=ON -DSIMPLE_SOCKET_WITH_TLS=OFF -DSIMPLE_SOCKET_WITH_MQTT=OFF -DSIMPLE_SOCKET_WITH_MODBUS=OFF -DSIMPLE_SOCKET_WITH_MEMORY=OFF -DCMAKE_BUILD_TYPE="Release"
8080
cmake --build build
8181
8282
- name: Test

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ option(SIMPLE_SOCKET_BUILD_TESTS OFF)
55
option(SIMPLE_SOCKET_WITH_TLS "Enable TLS (OpenSSL) for WSS" OFF)
66
option(SIMPLE_SOCKET_WITH_MQTT "Enable MQTT support" ON)
77
option(SIMPLE_SOCKET_WITH_MODBUS "Enable Modbus support" ON)
8+
option(SIMPLE_SOCKET_WITH_MEMORY "Enable in-memory transport support" ON)
89

910
set(CMAKE_CXX_STANDARD 20)
1011

src/CMakeLists.txt

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ set(publicHeaderDir "${PROJECT_SOURCE_DIR}/include")
22

33
set(publicHeaders
44

5-
"simple_socket/SharedMemoryConnection.hpp"
65
"simple_socket/SimpleConnection.hpp"
76
"simple_socket/SimpleHttpFetcher.hpp"
87
"simple_socket/SocketContext.hpp"
@@ -27,7 +26,6 @@ set(privateHeaders
2726
)
2827

2928
set(sources
30-
"simple_socket/SharedMemoryConnection.cpp"
3129
"simple_socket/SimpleHttpFetcher.cpp"
3230
"simple_socket/SocketContext.cpp"
3331
"simple_socket/TCPSocket.cpp"
@@ -40,6 +38,17 @@ set(sources
4038
"simple_socket/ws/WebSocketClient.cpp"
4139
)
4240

41+
if (SIMPLE_SOCKET_WITH_MEMORY)
42+
43+
list(APPEND publicHeaders
44+
"simple_socket/SharedMemoryConnection.hpp"
45+
)
46+
47+
list(APPEND sources
48+
"simple_socket/SharedMemoryConnection.cpp"
49+
)
50+
endif ()
51+
4352
if (SIMPLE_SOCKET_WITH_MODBUS)
4453

4554
list(APPEND publicHeaders

tests/CMakeLists.txt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,12 @@ add_executable(test_port_query test_port_query.cpp)
3535
add_test(NAME test_port_query COMMAND test_port_query)
3636
target_link_libraries(test_port_query PRIVATE simple_socket Catch2::Catch2WithMain)
3737

38-
add_executable(test_shared_memory test_shared_memory.cpp)
39-
target_link_libraries(test_shared_memory PRIVATE simple_socket Catch2::Catch2WithMain)
40-
add_test(NAME test_shared_memory COMMAND test_shared_memory)
38+
39+
if (SIMPLE_SOCKET_WITH_MEMORY)
40+
add_executable(test_shared_memory test_shared_memory.cpp)
41+
target_link_libraries(test_shared_memory PRIVATE simple_socket Catch2::Catch2WithMain)
42+
add_test(NAME test_shared_memory COMMAND test_shared_memory)
43+
endif ()
4144

4245

4346
if (UNIX)

0 commit comments

Comments
 (0)