-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCMakeLists.txt
65 lines (55 loc) · 1.94 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
cmake_minimum_required(VERSION 3.16.3)
project(hl_communication)
include(FindProtobuf)
find_package(Protobuf REQUIRED)
find_package(OpenCV 4.2.0 REQUIRED)
find_package(jsoncpp REQUIRED)
#Enable C++17
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -std=c++17")
# Protobuf generate files with unused parameters
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-parameter")
protobuf_generate_cpp(PROTO_SOURCES PROTO_HEADERS ${PROTOBUF_MESSAGES}
proto/camera.proto
proto/capabilities.proto
proto/captain.proto
proto/game_controller.proto
proto/intention.proto
proto/labelling.proto
proto/perception.proto
proto/position.proto
proto/robot_estimation.proto
proto/team_play.proto
proto/wrapper.proto
)
set_source_files_properties(${PROTO_SOURCES} ${PROTO_HEADERS} PROPERTIES GENERATED TRUE)
set(SOURCES_DIRECTORIES
src/hl_communication
)
#Include Sources sub sources
foreach (DIRECTORY ${SOURCES_DIRECTORIES})
include (${DIRECTORY}/Sources.cmake)
set (PREFIXED_SOURCES)
foreach (SOURCE ${SOURCES})
set (PREFIXED_SOURCES ${PREFIXED_SOURCES} ${DIRECTORY}/${SOURCE})
endforeach (SOURCE)
set (ALL_SOURCES ${ALL_SOURCES} ${PREFIXED_SOURCES})
endforeach (DIRECTORY)
add_library (${PROJECT_NAME} SHARED
${PROTO_SOURCES}
${PROTO_HEADERS}
${ALL_SOURCES}
)
target_link_libraries(${PROJECT_NAME} PUBLIC jsoncpp_lib Eigen3::Eigen protobuf::libprotobuf ${OpenCV_LIBS})
target_include_directories(${PROJECT_NAME} PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
${OpenCV_INCLUDE_DIRS}
${PROTOBUF_INCLUDE_DIR}
${CMAKE_CURRENT_BINARY_DIR}/..
)
option(BUILD_HL_COMMUNICATION_EXAMPLES "Building hl_communication examples" OFF)
if (BUILD_HL_COMMUNICATION_EXAMPLES)
add_executable(server_example examples/server_example.cpp)
target_link_libraries(server_example ${PROJECT_NAME} )
add_executable(client_example examples/client_example.cpp)
target_link_libraries(client_example ${PROJECT_NAME} )
endif()