-
Notifications
You must be signed in to change notification settings - Fork 6
/
CMakeLists.txt
163 lines (116 loc) · 5.89 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
cmake_minimum_required(VERSION 3.7.2)
#cmake_policy(SET CMP0002 OLD)
set(CMAKE_POLICY_DEFAULT_CMP0079 NEW)
set(CMAKE_MACOSX_RPATH 1)
include(TargetArch.cmake)
project(RabbitmqFmuProject)
set(CMAKE_PROJECT_VERSION "1.0.0")
set(CMAKE_PROJECT_VERSION_MAJOR "")
set(CMAKE_PROJECT_VERSION_MINOR "")
set(CMAKE_PROJECT_VERSION_PATCH "")
set(CMAKE_INSTALL_PREFIX "${CMAKE_CURRENT_SOURCE_DIR}/build/install" )
message("#########################################")
message("${CMAKE_CURRENT_SOURCE_DIR}/build/install")
message("#########################################")
#get_filename_component(PARENT_DIR "${CMAKE_CURRENT_SOURCE_DIR}" PATH)
#set(CMAKE_INSTALL_PREFIX "${PARENT_DIR}/build/install" )
message("FMU will be installed to: ${CMAKE_INSTALL_PREFIX}")
#include(toolchains/clang-format.cmake)
# You can tweak some common (for all subprojects) stuff here. For example:
#set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)
set(CMAKE_DISABLE_SOURCE_CHANGES ON)
enable_testing()
#if ("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
# message(SEND_ERROR "In-source builds are not allowed.")
#endif ()
set(CMAKE_VERBOSE_MAKEFILE ON)
set(CMAKE_COLOR_MAKEFILE ON)
# Remove 'lib' prefix for shared libraries on Windows
if (WIN32)
set(CMAKE_SHARED_LIBRARY_PREFIX "")
endif ()
#set_property(GLOBAL PROPERTY GLOBAL_DEPENDS_DEBUG_MODE 1)
target_architecture(arch)
message(${arch})
if (NOT DEFINED THIRD_PARTY_LIBRARIES_ROOT)
set(THIRD_PARTY_LIBRARIES_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/build/external")
if (UNIX)
if (APPLE)
set(THIRD_PARTY_LIBRARIES_ROOT ${THIRD_PARTY_LIBRARIES_ROOT}/darwin)
set(XercesC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/build/external/darwin-${arch}/xerces-c/lib/cmake/XercesC")
set(OPENSSL_LIBRARIES ${CMAKE_CURRENT_SOURCE_DIR}/build/external/darwin-${arch}/openssl/lib)
set(OPENSSL_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/build/external/darwin-${arch}/openssl/include)
set(OPENSSL_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/build/external/darwin-${arch}/openssl/lib)
ELSE ()
set(THIRD_PARTY_LIBRARIES_ROOT ${THIRD_PARTY_LIBRARIES_ROOT}/linux)
set(XercesC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/build/external/linux-${arch}/xerces-c/lib/cmake/XercesC")
set(OPENSSL_LIBRARIES ${CMAKE_CURRENT_SOURCE_DIR}/build/external/linux-${arch}/openssl/lib64)
set(OPENSSL_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/build/external/linux-${arch}/openssl/include)
set(OPENSSL_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/build/external/linux-${arch}/openssl/lib64)
ENDIF ()
set(THIRD_PARTY_LIBRARIES_ROOT ${THIRD_PARTY_LIBRARIES_ROOT}-${arch})
message("Thirdparty libraries root:")
message(${THIRD_PARTY_LIBRARIES_ROOT})
ELSEIF (WIN32)
set(XercesC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/build/external/win-${arch}/xerces-c/cmake")
set(OPENSSL_LIBRARIES ${CMAKE_CURRENT_SOURCE_DIR}/build/external/win-${arch}/openssl/lib64)
set(OPENSSL_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/build/external/win-${arch}/openssl/include)
set(OPENSSL_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/build/external/win-${arch}/openssl/lib64)
ENDIF ()
endif ()
message("Third parties libraries will use search path: ${THIRD_PARTY_LIBRARIES_ROOT}")
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
# When done tweaking common stuff, configure the components (subprojects).
# NOTE: The order matters! The most independent ones should go first.
# set(USE_RBMQ_FMU_THREAD OFF CACHE BOOL "" FORCE)
# set(USE_RBMQ_FMU_PROF OFF CACHE BOOL "" FORCE)
set(ENABLE_RBMQ_FMU_TESTS ON CACHE BOOL "" FORCE)
option(USE_RBMQ_FMU_PRIORITY_QUEUE "Use RBMQ priority queue (incoming)" OFF)
message("USE_RBMQ_FMU_PRIORITY_QUEUE: ${USE_RBMQ_FMU_PRIORITY_QUEUE}")
if (USE_RBMQ_FMU_PRIORITY_QUEUE)
add_definitions(-DUSE_RBMQ_FMU_PRIORITY_QUEUE)
set(ENABLE_RBMQ_FMU_TESTS OFF CACHE BOOL "" FORCE)
endif ()
option(USE_RBMQ_FMU_THREAD "Use RBMQ consumer thread" ON)
message("USE_RBMQ_FMU_THREAD: ${USE_RBMQ_FMU_THREAD}")
if (USE_RBMQ_FMU_THREAD)
add_definitions(-DUSE_RBMQ_FMU_THREAD)
endif ()
option(USE_RBMQ_FMU_HEALTH_THREAD "Use RBMQ health thread" ON)
message("USE_RBMQ_FMU_HEALTH_THREAD: ${USE_RBMQ_FMU_HEALTH_THREAD}")
if (USE_RBMQ_FMU_HEALTH_THREAD)
add_definitions(-DUSE_RBMQ_FMU_HEALTH_THREAD)
endif ()
option(USE_RBMQ_FMU_PROF "Use RBMQ profiling of step function" OFF)
message("USE_RBMQ_FMU_PROF: ${USE_RBMQ_FMU_PROF}")
if (USE_RBMQ_FMU_PROF)
add_definitions(-DUSE_RBMQ_FMU_PROF)
endif ()
message("ENABLE_RBMQ_FMU_TESTS: ${ENABLE_RBMQ_FMU_TESTS}")
set(RAPIDJSON_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
set(RAPIDJSON_BUILD_DOC OFF CACHE BOOL "" FORCE)
set(RAPIDJSON_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
set(RAPIDJSON_BUILD_TESTS OFF CACHE BOOL "" FORCE)
add_subdirectory(thirdparty/rapidjson)
#add_subdirectory(thirdparty/amqp-cpp)
#### Comment line 118 to build locally.
add_subdirectory(thirdparty/googletest)
#execute_process(COMMAND ${CMAKE_EXECUTABLE} thirdparty/rapidjson -DCMAKE_INSTALL_PREFIX="${CMAKE_CURRENT_SOURCE_DIR}/build/install/thirdparty/rapidjson" WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/build/thirdparty/rapidjson")
#execute_process(COMMAND ${CMAKE_EXECUTABLE} --build "${CMAKE_CURRENT_SOURCE_DIR}/build/thirdparty/rapidjson" --target install)
#add_subdirectory(thirdparty/xerces-c)
#set(BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
#set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE)
#set(BUILD_STATIC_LIBS ON CACHE BOOL "" FORCE)
#set(BUILD_TESTS OFF CACHE BOOL "" FORCE)
#set(BUILD_TOOLS OFF CACHE BOOL "" FORCE)
#set(BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
set(ENABLE_SSL_SUPPORT ON CACHE BOOL "" FORCE)
set(OPENSSL_USE_STATIC_LIBS ON CACHE BOOL "" FORCE)
#set(BUILD_TOOLS_DOCS OFF CACHE BOOL "" FORCE)
add_subdirectory(thirdparty/rabbitmq-c)
add_subdirectory(thirdparty/date)
add_subdirectory(rabbitmq-core)
if (UNIX AND ENABLE_RBMQ_FMU_TESTS)
add_subdirectory(rabbitmq-tla-tester)
endif()
add_subdirectory(rabbitmq-fmu)