-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
77 lines (63 loc) · 2.76 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
PROJECT(gdatabus)
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
#set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-Bsymbolic")
MESSAGE("CMAKE_SHARED_LINKER_FLAGS: ${CMAKE_SHARED_LINKER_FLAGS}")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")
SET(CMAKE_CXX_FLAGS_DEBUG "$ENV{CXXFLAGS} -O0 -Wall -g -ggdb -std=c++17 -fno-strict-aliasing -Wno-register")
SET(CMAKE_CXX_FLAGS_RELEASE "$ENV{CXXFLAGS} -O3 -Wall -std=c++17 -fno-strict-aliasing -Wno-register")
SET(CMAKE_BUILD_TYPE "Release")
#set(CMAKE_BUILD_TYPE "Debug")
find_package(Boost REQUIRED COMPONENTS log)
if(NOT Boost_FOUND)
message("Can not find Boost")
endif()
message(STATUS "Found Boost IncPath ${Boost_INCLUDE_DIRS}")
message(STATUS "Found Boost LibPath ${Boost_LIBRARY_DIRS}")
message(STATUS "CMAKE_SOURCE_DIR: ${CMAKE_SOURCE_DIR}")
message(STATUS "CMAKE_CURRENT_BINARY_DIR:${CMAKE_CURRENT_BINARY_DIR}")
message(STATUS "CMAKE_BINARY_DIR:${CMAKE_BINARY_DIR}")
add_definitions(-DBOOST_SPIRIT_THREADSAFE)
add_definitions(-DBOOST_ALL_DYN_LINK)
#add_definitions(-D_DEBUG)
include_directories(${Boost_INCLUDE_DIRS})
link_directories(${Boost_LIBRARY_DIRS})
INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/common/util/include")
INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/common/include")
INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/gformat/include")
INCLUDE_DIRECTORIES("${PROJECT_SOURCE_DIR}/include")
INCLUDE_DIRECTORIES("${PROJECT_SOURCE_DIR}/loader")
INCLUDE_DIRECTORIES("${CMAKE_BINARY_DIR}")
INCLUDE_DIRECTORIES("${CMAKE_BINARY_DIR}/common")
INCLUDE_DIRECTORIES("${CMAKE_BINARY_DIR}/loader")
INCLUDE_DIRECTORIES("${CMAKE_BINARY_DIR}/common/dbschema")
FIND_PACKAGE(Protobuf REQUIRED)
INCLUDE_DIRECTORIES(${Protobuf_INCLUDE_DIRS})
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
EXECUTE_PROCESS(COMMAND protoc
-I=${CMAKE_SOURCE_DIR}
--cpp_out=${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/common/dbschema/freyja/databus_event.proto)
EXECUTE_PROCESS(COMMAND protoc
-I=${CMAKE_SOURCE_DIR}
--cpp_out=${CMAKE_BINARY_DIR}
${PROJECT_SOURCE_DIR}/loader/ignore.proto)
IF (NOT TARGET common)
ADD_SUBDIRECTORY(common)
ENDIF()
IF (NOT TARGET gformat)
ADD_SUBDIRECTORY(gformat)
ENDIF()
SET(LOADER_SRCS
"${CMAKE_BINARY_DIR}/common/dbschema/freyja/databus_event.pb.cc"
"${CMAKE_CURRENT_BINARY_DIR}/loader/ignore.pb.cc"
"${PROJECT_SOURCE_DIR}/test/loader_main.cpp"
)
ADD_EXECUTABLE(gdatabus_test_loader ${LOADER_SRCS})
target_link_libraries(gdatabus_test_loader ${Protobuf_LIBRARIES} common gformat boost_log-mt)
SET(GENERATOR_SRCS
"${CMAKE_BINARY_DIR}/common/dbschema/freyja/databus_event.pb.cc"
"${PROJECT_SOURCE_DIR}/test/generator_main.cpp"
)
ADD_EXECUTABLE(gdatabus_test_generator ${GENERATOR_SRCS})
target_link_libraries(gdatabus_test_generator ${Protobuf_LIBRARIES} common gformat boost_log-mt)