-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
79 lines (65 loc) · 2.49 KB
/
Copy pathCMakeLists.txt
File metadata and controls
79 lines (65 loc) · 2.49 KB
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
cmake_minimum_required(VERSION 3.15)
project(GramsNetworkConnection)
set(CMAKE_CXX_STANDARD 17)
#set(CMAKE_BUILD_TYPE Debug)
# Try to catch any potential problems at compile time
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -pedantic)
endif()
# The networking is built on top of the ASIO header library
# note it does not require BOOST
file(GLOB ASIO_SEARCH_CUSTOM_PATH "$ENV{HOME}/asio*/include")
find_path(ASIO_INCLUDE_DIR asio.hpp
HINTS ${ASIO_SEARCH_CUSTOM_PATH} NO_DEFAULT_PATH)
if (ASIO_INCLUDE_DIR)
message(STATUS "[networking] Found ASIO: ${ASIO_INCLUDE_DIR}")
include_directories("${ASIO_INCLUDE_DIR}")
else()
message(FATAL_ERROR "ASIO not found")
endif()
# Standalone Client
message(STATUS "Compiling Client")
add_executable(GramsReadoutClient client.cpp
tcp_connection.cpp
tcp_connection.h
tcp_protocol.h
tcp_protocol.cpp)
target_compile_definitions(GramsReadoutClient PRIVATE ASIO_STANDALONE)
target_include_directories(GramsReadoutClient PRIVATE ${ASIO_INCLUDE_DIR})
target_link_libraries(GramsReadoutClient PRIVATE pthread)
## TCP/IP Connection
message(STATUS "Compiling Server")
add_executable(GramsReadoutConnect server.cpp
tcp_connection.cpp
tcp_connection.h
tcp_protocol.h
tcp_protocol.cpp)
target_compile_definitions(GramsReadoutConnect PRIVATE ASIO_STANDALONE)
target_include_directories(GramsReadoutConnect PRIVATE ${ASIO_INCLUDE_DIR})
target_link_libraries(GramsReadoutConnect PRIVATE pthread)
########################################
# pGRAMS Connection Configuration
# Client
message(STATUS "Compiling pGRAMS Client")
add_executable(pgrams_client unit_test/client_grams_setup.cpp
tcp_connection.cpp
tcp_connection.h
tcp_protocol.h
tcp_protocol.cpp)
target_compile_definitions(pgrams_client PRIVATE ASIO_STANDALONE)
target_include_directories(pgrams_client PRIVATE ${ASIO_INCLUDE_DIR})
target_link_libraries(pgrams_client PRIVATE pthread)
## Server
message(STATUS "Compiling pGRAMS Server")
add_executable(pgrams_server unit_test/server_grams_setup.cpp
tcp_connection.cpp
tcp_connection.h
tcp_protocol.h
tcp_protocol.cpp)
target_compile_definitions(pgrams_server PRIVATE ASIO_STANDALONE)
target_include_directories(pgrams_server PRIVATE ${ASIO_INCLUDE_DIR})
target_link_libraries(pgrams_server PRIVATE pthread)
set(COMPILE_UNIT_TESTS FALSE)
if(COMPILE_UNIT_TESTS)
add_subdirectory(unit_test)
endif()