This repository has been archived by the owner on Apr 12, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCMakeLists.txt
78 lines (57 loc) · 1.81 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
cmake_minimum_required(VERSION 3.10)
project(cogment_orchestrator)
set(Protobuf_USE_STATIC_LIBS ON)
find_package(protobuf)
find_package(gRPC)
find_package(prometheus-cpp REQUIRED)
find_package(spdlog REQUIRED)
add_subdirectory(third_party/slt_concur)
add_subdirectory(third_party/slt_setting)
find_program(CLANG_TIDY "clang-tidy")
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
add_subdirectory(lib)
SET(ORCHESTRATOR_SRC
main.cpp
)
add_executable(orchestrator ${ORCHESTRATOR_SRC})
IF(CLANG_TIDY)
set_target_properties(orchestrator PROPERTIES CXX_CLANG_TIDY "clang-tidy;--format-style=file")
ENDIF()
target_include_directories(orchestrator PRIVATE .)
target_link_libraries(orchestrator
debug -rdynamic
orchestrator_lib
prometheus-cpp::pull
gRPC::grpc
)
set_target_properties(orchestrator PROPERTIES DEBUG_POSTFIX _debug)
install(TARGETS orchestrator
DESTINATION bin)
############################ code format ############################
if(NOT DEFINED CLANG_FORMAT_BIN)
find_program(CLANG_FORMAT_BIN NAMES clang-format)
endif()
file(GLOB_RECURSE ALL_SOURCE_FILES *.cpp *.h *.cxx *.hxx *.hpp *.cc *.ipp)
set(CLANG_FORMAT_EXCLUDE_PATTERNS ${CLANG_FORMAT_EXCLUDE_PATTERNS}
"/CMakeFiles/"
"cmake"
"third_party"
)
foreach (SOURCE_FILE ${ALL_SOURCE_FILES})
foreach (EXCLUDE_PATTERN ${CLANG_FORMAT_EXCLUDE_PATTERNS})
string(FIND ${SOURCE_FILE} ${EXCLUDE_PATTERN} EXCLUDE_FOUND)
if (NOT ${EXCLUDE_FOUND} EQUAL -1)
list(REMOVE_ITEM ALL_SOURCE_FILES ${SOURCE_FILE})
endif ()
endforeach ()
endforeach ()
add_custom_target(format
COMMENT "Running clang-format to change files"
COMMAND ${CLANG_FORMAT_BIN}
-style=file
-i
${ALL_SOURCE_FILES}
)
#############################################################