-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
51 lines (38 loc) · 1.63 KB
/
CMakeLists.txt
File metadata and controls
51 lines (38 loc) · 1.63 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
cmake_minimum_required(VERSION 3.12)
project(andromeda-linux-cpp)
# 設置默認構建類型為 Debug
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build." FORCE)
endif()
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED True)
# 設置 Debug 模式下的編譯標誌
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g -O0")
set(BUILD_ROOT ${CMAKE_SOURCE_DIR})
include_directories(${BUILD_ROOT}/_include)
include_directories(${BUILD_ROOT}/generated)
add_subdirectory(${BUILD_ROOT}/signal)
add_subdirectory(${BUILD_ROOT}/proc)
add_subdirectory(${BUILD_ROOT}/net)
add_subdirectory(${BUILD_ROOT}/misc)
add_subdirectory(${BUILD_ROOT}/generated)
add_subdirectory(${BUILD_ROOT}/business)
add_subdirectory(${BUILD_ROOT}/app)
add_executable(andromeda app/andromeda.cxx)
target_link_libraries(andromeda app signal business proc net misc generated protobuf)
configure_file(${CMAKE_SOURCE_DIR}/andromeda.conf ${CMAKE_BINARY_DIR}/andromeda.conf COPYONLY)
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/logs)
add_custom_target(clear
COMMAND ${CMAKE_COMMAND} -E remove "andromeda"
COMMAND ${CMAKE_COMMAND} -E remove_directory "${BUILD_ROOT}/log.txt"
)
add_custom_target(memcheck
COMMAND valgrind --tool=memcheck --leak-check=full --show-reachable=yes --trace-children=yes --log-file=./valgrind.log ./andromeda
)
add_custom_target(protoc
COMMAND protoc -I=/projects/andromeda-linux-cpp/proto --cpp_out=./generated /projects/andromeda-linux-cpp/proto/*.proto
)
add_custom_target(kill
COMMAND ${CMAKE_COMMAND} -E remove "logs/error.log"
COMMAND pgrep andromeda | xargs kill -9
)