File tree 5 files changed +29
-9
lines changed
5 files changed +29
-9
lines changed Original file line number Diff line number Diff line change 30
30
- os : ubuntu-latest
31
31
c_compiler : clang
32
32
cpp_compiler : clang++
33
- exclude :
34
33
- os : windows-latest
35
34
c_compiler : cl
35
+ cpp_compiler : cl
36
+ exclude :
36
37
- os : windows-latest
37
38
c_compiler : gcc
38
39
- os : windows-latest
67
68
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
68
69
-DMODBUS_EXAMPLE=ON
69
70
-DMODBUS_TESTS=ON
70
- -DMODBUS_COMMUNICATION=${{ matrix.os == 'windows-latest' && 'OFF' || matrix.os == 'ubuntu-latest' && 'ON' }}
71
+ -DMODBUS_TCP_COMMUNICATION=${{ matrix.os == 'windows-latest' && 'OFF' || matrix.os == 'ubuntu-latest' && 'ON' }}
72
+ -DMODBUS_SERIAL_COMMUNICATION=${{ matrix.os == 'windows-latest' && 'OFF' || matrix.os == 'ubuntu-latest' && 'ON' }}
71
73
-S ${{ github.workspace }}
72
74
73
75
- name : Build
Original file line number Diff line number Diff line change 30
30
* .exe
31
31
* .out
32
32
* .app
33
-
34
33
build
35
34
35
+ # Windows specific
36
+ out
37
+ .vs
38
+
36
39
# Gtags
37
40
GTAGS
38
41
GRTAGS
Original file line number Diff line number Diff line change 1
1
cmake_minimum_required (VERSION 3.13)
2
- project (protocolConverter )
2
+ project (modbus )
3
3
4
4
set (CMAKE_CXX_STANDARD 17)
5
5
@@ -11,7 +11,14 @@ endif()
11
11
12
12
option (MODBUS_EXAMPLE "Build example program" OFF )
13
13
option (MODBUS_TESTS "Build tests" OFF )
14
- option (MODBUS_COMMUNICATION "Use Modbus communication library" ON )
14
+ option (MODBUS_TCP_COMMUNICATION "Use Modbus TCP communication library" ON )
15
+
16
+ if (NOT win32 )
17
+ # Serial not supported on Windows
18
+ option (MODBUS_SERIAL_COMMUNICATION "Use Modbus serial communication library" OFF ) # not supported by windows platform
19
+ else ()
20
+ message (STATUS "Modbus Serial not supported on Windows." )
21
+ endif ()
15
22
16
23
add_subdirectory (src)
17
24
Original file line number Diff line number Diff line change @@ -23,10 +23,14 @@ target_include_directories(Modbus_Core PUBLIC ${PROJECT_SOURCE_DIR}/include PRIV
23
23
add_library (Modbus)
24
24
target_link_libraries (Modbus Modbus_Core)
25
25
26
+ if (MODBUS_SERIAL_COMMUNICATION)
27
+ message (STATUS "Enabling Modbus Serial" )
28
+ add_subdirectory (Serial)
29
+ target_link_libraries (Modbus Modbus_Serial)
30
+ endif ()
26
31
27
- if (MODBUS_COMMUNICATION )
28
- message (" Modbus communication is experimental " )
32
+ if (MODBUS_TCP_COMMUNICATION )
33
+ message (STATUS "Enabling Modbus Serial " )
29
34
add_subdirectory (TCP)
30
- add_subdirectory (Serial)
31
- target_link_libraries (Modbus Modbus_TCP Modbus_Serial)
35
+ target_link_libraries (Modbus Modbus_TCP)
32
36
endif ()
Original file line number Diff line number Diff line change @@ -2,6 +2,10 @@ project(Google_tests)
2
2
add_subdirectory (googletest)
3
3
include_directories (${gtest_SOURCE_DIR} /include ${gtest_SOURCE_DIR} )
4
4
5
+ if (MSVC )
6
+ set (gtest_force_shared_crt on )
7
+ endif ()
8
+
5
9
set (TestFiles MB/ModbusRequestTests.cpp
6
10
MB/ModbusResponseTests.cpp
7
11
MB/ModbusExceptionTests.cpp
You can’t perform that action at this time.
0 commit comments