-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
109 lines (93 loc) · 3.4 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
cmake_minimum_required (VERSION 3.13)
project( TrainUtils VERSION 0.1.0)
include( CTest )
include( GNUInstallDirs )
option (BUILD_CABBUS_SNIFFER
"Build the CabBus sniffer project"
ON)
option (BUILD_LOCONET_SNIFFER
"Build the LocoNet sniffer project"
ON)
option (BUILD_CAB2LOCONET_COMPUTER
"Build the Cab2Loconet program for use with a computer"
OFF)
option (BUILD_GUI
"Build the Train GUI"
OFF)
option (BUILD_DCC_UTIL "Build the DCC utility library" OFF)
# Request C++20, if available
# This *should* fallback to an older standard if it is not available
if( NOT "${CMAKE_CXX_STANDARD}")
set(CMAKE_CXX_STANDARD 20)
endif()
IF( NOT UNIX )
SET(CSERIAL_INCLUDE_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE STRING "Directory with CSerial include files")
SET(CSERIAL_LIBRARIES "${CMAKE_INSTALL_PREFIX}/lib/cserial.lib" CACHE STRING "CSerial library to link with")
ENDIF( NOT UNIX )
IF( UNIX )
include( FindPkgConfig )
pkg_check_modules( CSERIAL REQUIRED cserial )
ENDIF( UNIX )
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wstrict-prototypes -Wmissing-prototypes")
endif()
#set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} \
# -fsanitize=address \
# -fsanitize=null \
# -fsanitize=return \
# -fsanitize=object-size \
# -fsanitize=bool \
# -fsanitize=enum" )
#set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} \
# -fsanitize=address \
# -fsanitize=null \
# -fsanitize=return \
# -fsanitize=object-size \
# -fsanitize=bool \
# -fsanitize=enum" )
add_subdirectory(CabBusCommunications)
add_subdirectory(CabBusSniffer)
add_subdirectory(LocoNetCommunications)
add_subdirectory(LoconetSniffer)
add_subdirectory(LoconetTCPUtil)
add_subdirectory(LCC)
if(BUILD_GUI)
add_subdirectory(GUI)
endif()
if(BUILD_DCC_UTIL)
add_subdirectory(DCC)
endif()
IF( BUILD_CAB2LOCONET_COMPUTER )
IF( UNIX )
pkg_check_modules( POPT REQUIRED popt )
ENDIF( UNIX )
include_directories( LocoNetCommunications CabBusCommunications )
add_executable( Cab2Loconet CabBusToLoconetComputer/CabBusToLoconet.c CabBusToLoconetComputer/main_linux.c )
target_link_libraries( Cab2Loconet PRIVATE cabbus_utils loconet_utils ${POPT_LIBRARIES} ${CSERIAL_LIBRARIES} )
ENDIF( BUILD_CAB2LOCONET_COMPUTER )
if(UNIX)
install(FILES udev-rules/50-digitrax.rules
DESTINATION ${CMAKE_INSTALL_LIBDIR}/udev/rules.d)
endif(UNIX)
set(CPACK_PACKAGE_VENDOR "Robert Middleton")
set(CPACK_STRIP_FILES True)
set(CPACK_GENERATOR "ZIP")
include(InstallRequiredSystemLibraries)
include(CPack)
#
# Output configuration information
#
message(STATUS "")
message(STATUS "")
message(STATUS "Train Utils configuration summary:")
message(STATUS "")
message(STATUS " C++ standard: ................... : ${CMAKE_CXX_STANDARD}")
message(STATUS " Build Cabbus comms: ............. : ON")
message(STATUS " Build Cabbus sniffer: ........... : ${BUILD_CABBUS_SNIFFER}")
message(STATUS " Build Loconet comms: ............ : ON")
message(STATUS " Build Loconet sniffer: .......... : ${BUILD_LOCONET_SNIFFER}")
message(STATUS " Build Loconet TCP util: ......... : ON")
message(STATUS " Build Cab2Loconet(Computer): .... : ${BUILD_CAB2LOCONET_COMPUTER}")
message(STATUS " Build liblcc: ................... : ON")
message(STATUS " Build GUI: ...................... : ${BUILD_GUI}")
message(STATUS " Build DCC utility: .............. : ${BUILD_DCC_UTIL}")