-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCMakeLists.txt
241 lines (210 loc) · 8.07 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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
CMAKE_MINIMUM_REQUIRED(VERSION 2.4)
PROJECT(dbt5 CXX)
#
# Defining binaries so to minimized typoes.
#
SET(DBT5_BROKERAGE_HOUSE bin/BrokerageHouseMain)
SET(DBT5_DRIVER bin/DriverMain)
SET(DBT5_MARKET_EXCHANGE bin/MarketExchangeMain)
SET(DBT5_TEST_TXN bin/TestTxn)
#
# Check for large file support by using 'getconf'.
#
FIND_PROGRAM(GETCONF getconf)
IF (GETCONF)
SET(GETCONF_FOUND TRUE)
ENDIF (GETCONF)
IF (GETCONF_FOUND)
EXECUTE_PROCESS(COMMAND ${GETCONF} LFS_CFLAGS COMMAND ${GETCONF}
LFS64_CFLAGS OUTPUT_VARIABLE LFS_CFLAGS
OUTPUT_STRIP_TRAILING_WHITESPACE)
ENDIF (GETCONF_FOUND)
IF (DBMS STREQUAL "pgsql")
#
# Create PostgreSQL specific configuration.
#
FIND_PROGRAM(PG_CONFIG pg_config)
IF (PG_CONFIG)
SET(PG_CONFIG_FOUND TRUE)
ENDIF (PG_CONFIG)
IF (PG_CONFIG_FOUND)
MESSAGE(STATUS "Found pg_config for PostgreSQL: ${PG_CONFIG}")
EXECUTE_PROCESS(COMMAND ${PG_CONFIG} --includedir OUTPUT_VARIABLE
PG_INCLUDEDIR OUTPUT_STRIP_TRAILING_WHITESPACE)
EXECUTE_PROCESS(COMMAND ${PG_CONFIG} --libdir OUTPUT_VARIABLE
PG_LIBDIR OUTPUT_STRIP_TRAILING_WHITESPACE)
SET(DBCFLAGS "-DLIBPQ -I${PG_INCLUDEDIR}")
SET(DB_LIBS "-L${PG_LIBDIR} -L/usr/local/pgsql/lib -L/usr/lib/x86_64-linux-gnu/ -lpq -l:libcurl.so.3")
SET(DB_SCRIPTS scripts/pgsql/dbt5-pgsql-start-db
scripts/pgsql/dbt5-pgsql-create-indexes
scripts/pgsql/dbt5-pgsql-create-tables
scripts/pgsql/dbt5-pgsql-drop-tables
scripts/pgsql/dbt5-pgsql-restore-db
scripts/pgsql/dbt5-pgsql-load-stored-procs
scripts/pgsql/dbt5-pgsql-backup-db
scripts/pgsql/dbt5-pgsql-db-plans
scripts/pgsql/dbt5-pgsql-drop-db
scripts/pgsql/dbt5-pgsql-check-db
scripts/pgsql/dbt5-pgsql-db-stat
scripts/pgsql/dbt5-pgsql-stop-db
scripts/pgsql/dbt5-pgsql-create-db
scripts/pgsql/dbt5-pgsql-build-db)
ENDIF (PG_CONFIG_FOUND)
ELSE (NOT DEFINED DBMS)
MESSAGE(FATAL_ERROR "Need to specify -DDBMS=pgsql")
ENDIF (DBMS STREQUAL "pgsql")
#
# Defining commonly used paths.
#
SET(EGENINC egen/inc)
SET(EGENSRC egen/src)
SET(TXN src/transactions)
SET(INTF src/interfaces)
SET(BH src/BrokerageHouse)
SET(CE src/Driver)
SET(ME src/MarketExchange)
#
# Defining common groups of source files.
#
SET(TXN_SOURCE ${TXN}/${DBMS}/DBConnection.cpp
${TXN}/TxnBaseDB.cpp
${TXN}/TxnRestDB.cpp
${TXN}/jsoncpp.cpp
${TXN}/MarketFeedDB.cpp
${TXN}/TradeCleanupDB.cpp
${TXN}/DataMaintenanceDB.cpp
${TXN}/MarketWatchDB.cpp
${TXN}/SecurityDetailDB.cpp
${TXN}/BrokerVolumeDB.cpp
${TXN}/CustomerPositionDB.cpp
${TXN}/TradeUpdateDB.cpp
${TXN}/TradeLookupDB.cpp
${TXN}/TradeResultDB.cpp
${TXN}/TradeOrderDB.cpp
${TXN}/TradeStatusDB.cpp)
#
# Files to build.
#
ADD_EXECUTABLE(${DBT5_BROKERAGE_HOUSE}
${EGENSRC}/DateTime
${EGENSRC}/locking.cpp
${INTF}/CSocket.cpp
${INTF}/TxnHarnessSendToMarket.cpp
${TXN_SOURCE}
${BH}/BrokerageHouseMain.cpp
${BH}/BrokerageHouse.cpp)
ADD_EXECUTABLE(${DBT5_DRIVER}
${CE}/Driver.cpp
${CE}/DriverMain.cpp
src/Customer/Customer.cpp
${EGENSRC}/BaseLogger.cpp
${EGENSRC}/EGenLogFormatterTab.cpp
${EGENSRC}/CETxnMixGenerator.cpp
${EGENSRC}/CETxnInputGenerator.cpp
${EGENSRC}/ReadRowFunctions.cpp
${EGENSRC}/InputFlatFilesStructure.cpp
${EGENSRC}/error.cpp
${EGENSRC}/AddressTable.cpp
${EGENSRC}/EGenVersion.cpp
${EGENSRC}/CustomerTable.cpp
${EGENSRC}/CustomerSelection.cpp
${EGENSRC}/Random.cpp
${EGENSRC}/Person.cpp
${EGENSRC}/DateTime.cpp
${EGENSRC}/CE.cpp
${EGENSRC}/DM.cpp
${EGENSRC}/locking.cpp
${EGENSRC}/MEE.cpp
${EGENSRC}/MEETradingFloor.cpp
${EGENSRC}/MEETickerTape.cpp
${EGENSRC}/MEEPriceBoard.cpp
${EGENSRC}/WheelTime.cpp
${EGENSRC}/MEESecurity.cpp
${INTF}/CESUT.cpp
${INTF}/CSocket.cpp
${INTF}/DMSUT.cpp
${INTF}/BaseInterface.cpp)
ADD_EXECUTABLE(${DBT5_MARKET_EXCHANGE}
${EGENSRC}/ReadRowFunctions.cpp
${EGENSRC}/BaseLogger.cpp
${EGENSRC}/EGenLogFormatterTab.cpp
${EGENSRC}/EGenVersion.cpp
${EGENSRC}/error.cpp
${INTF}/CSocket.cpp
${EGENSRC}/Random.cpp
${EGENSRC}/DateTime.cpp
${EGENSRC}/WheelTime.cpp
${EGENSRC}/MEESecurity.cpp
${EGENSRC}/MEEPriceBoard.cpp
${EGENSRC}/MEETickerTape.cpp
${EGENSRC}/MEETradingFloor.cpp
${EGENSRC}/MEE.cpp
${EGENSRC}/locking.cpp
${EGENSRC}/InputFlatFilesStructure.cpp
${INTF}/MEESUT.cpp
${INTF}/BaseInterface.cpp
${ME}/MarketExchange.cpp
${ME}/MarketExchangeMain.cpp)
ADD_EXECUTABLE(${DBT5_TEST_TXN}
${EGENSRC}/ReadRowFunctions.cpp
${EGENSRC}/BaseLogger.cpp
${EGENSRC}/EGenLogFormatterTab.cpp
${EGENSRC}/InputFlatFilesStructure.cpp
${EGENSRC}/error.cpp
${EGENSRC}/EGenVersion.cpp
${EGENSRC}/AddressTable.cpp
${EGENSRC}/CustomerTable.cpp
${EGENSRC}/CustomerSelection.cpp
${EGENSRC}/Random.cpp
${EGENSRC}/Person.cpp
${EGENSRC}/DateTime.cpp
${EGENSRC}/CETxnInputGenerator.cpp
${EGENSRC}/DM.cpp
${EGENSRC}/WheelTime.cpp
${EGENSRC}/MEESecurity.cpp
${EGENSRC}/MEEPriceBoard.cpp
${EGENSRC}/MEETickerTape.cpp
${EGENSRC}/MEETradingFloor.cpp
${EGENSRC}/MEE.cpp
${EGENSRC}/locking.cpp
${INTF}/MEESUTtest.cpp
${INTF}/DMSUTtest.cpp
${TXN_SOURCE}
${INTF}/BaseInterface.cpp
${INTF}/CESUT.cpp
${INTF}/CSocket.cpp
${INTF}/TxnHarnessSendToMarketTest.cpp
${INTF}/TxnHarnessSendToMarket.cpp
${BH}/BrokerageHouse.cpp
src/TestTransactions/TestTxn.cpp)
#
# Set compiler flags.
#
SET(CMAKE_CXX_FLAGS "-g -pthread -I${EGENINC} -Isrc/include ${LFS_CFLAGS} -L/usr/local/pgsql/lib -I/usr/local/pgsql/include/")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__STDC_FORMAT_MACROS")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__STDC_CONSTANT_MACROS")
# FIXME: How to set this for just ${TXN}/${DBMS}/DBConnection.cpp?
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${DBCFLAGS}")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DJSON_IS_AMALGAMATION")
#
# Set linker flags.
#
target_link_libraries(${DBT5_BROKERAGE_HOUSE} -lpq -lcurl)
target_link_libraries(${DBT5_DRIVER})
target_link_libraries(${DBT5_MARKET_EXCHANGE})
target_link_libraries(${DBT5_TEST_TXN} -lpq -lcurl)
#
# Install rules.
#
INSTALL(PROGRAMS ${DBT5_BROKERAGE_HOUSE}
${DBT5_DRIVER}
${DBT5_MARKET_EXCHANGE}
${DBT5_TEST_TXN}
scripts/dbt5-post-process
scripts/dbt5-sysstats
scripts/dbt5-get-os-info
scripts/dbt5-run-workload
scripts/dbt5-plot-transaction-rate
scripts/dbt5-generate-report
${DB_SCRIPTS}
DESTINATION "/bin")