forked from library-data-platform/ldp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
146 lines (120 loc) · 2.65 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
#
# To build a release version:
#
# mkdir -p build
# cd build
# cmake ..
# make
#
# For debugging:
#
# cmake -DDEBUG=ON -DOPTIMIZE=OFF ..
#
# For gprof:
#
# cmake -DGPROF=ON -DDEBUG=ON -DOPTIMIZE=OFF ..
#
cmake_minimum_required (VERSION 3.7.2)
project (LDP)
#SET(CMAKE_VERBOSE_MAKEFILE ON)
set(RapidJSON_DIR "${CMAKE_SOURCE_DIR}/cmake")
#add_subdirectory (src)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -pedantic -Wall")
IF(CMAKE_COMPILER_IS_GNUCXX)
#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -pedantic -Wall")
set(FSLIB "-lstdc++fs")
ENDIF(CMAKE_COMPILER_IS_GNUCXX)
OPTION(OPTIMIZE
"Build the project with compiler optimization"
ON)
IF(OPTIMIZE)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -DNDEBUG")
ENDIF(OPTIMIZE)
OPTION(DEBUG
"Build the project in debugging mode"
OFF)
IF(DEBUG)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -Og -DDEBUG -DPERF")
ENDIF(DEBUG)
OPTION(GPROF
"Build the project for gprof (requires DEBUG)"
OFF)
IF(GPROF)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg -DGPROF")
set(GPROFFLAG "-pg")
ENDIF(GPROF)
#set(CURL_LIBRARY "-lcurl")
find_package(CURL REQUIRED)
include_directories(${CURL_INCLUDE_DIR})
find_package(ODBC REQUIRED)
find_package(PostgreSQL REQUIRED)
include_directories(${PostgreSQL_INCLUDE_DIR})
#set(LIBS ${LIBS} ${PostgreSQL_LIBRARY})
#find_package(SQLite3 REQUIRED)
find_package(RapidJSON REQUIRED)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
add_library(ldp_obj OBJECT
etymoncpp/src/curl.cpp
etymoncpp/src/mallocptr.cpp
etymoncpp/src/odbc.cpp
etymoncpp/src/postgres.cpp
etymoncpp/src/util.cpp
src/anonymize.cpp
src/camelcase.cpp
src/config.cpp
src/dbtype.cpp
src/dbup1.cpp
src/extract.cpp
src/init.cpp
src/initutil.cpp
src/ldp.cpp
src/log.cpp
src/merge.cpp
src/names.cpp
src/options.cpp
src/paging.cpp
src/schema.cpp
src/stage.cpp
src/timer.cpp
src/update.cpp
src/util.cpp
)
add_executable(ldp
$<TARGET_OBJECTS:ldp_obj>
src/main.cpp
)
target_link_libraries(ldp
${GPROFFLAG}
${CURL_LIBRARIES}
${ODBC_LIBRARY}
${PostgreSQL_LIBRARY}
#${SQLite3_LIBRARY}
${FSLIB}
)
# add_executable(ldp_test
# $<TARGET_OBJECTS:ldp_obj>
# test/camelcase_test.cpp
# test/main_test.cpp
# )
# target_link_libraries(ldp_test
# ${GPROFFLAG}
# ${CURL_LIBRARIES}
# ${ODBC_LIBRARY}
# ${PostgreSQL_LIBRARY}
# #${SQLite3_LIBRARY}
# ${FSLIB}
# )
# add_executable(ldp_testint
# $<TARGET_OBJECTS:ldp_obj>
# testint/main_testint.cpp
# testint/server_testint.cpp
# )
# target_link_libraries(ldp_testint
# ${GPROFFLAG}
# ${CURL_LIBRARIES}
# ${ODBC_LIBRARY}
# ${PostgreSQL_LIBRARY}
# #${SQLite3_LIBRARY}
# ${FSLIB}
# )
#INSTALL(PROGRAMS ldp DESTINATION /usr/local/bin)