-
Notifications
You must be signed in to change notification settings - Fork 32
/
CMakeLists.txt
161 lines (136 loc) · 6.29 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
INCLUDE(CheckFunctionExists)
INCLUDE(CheckIncludeFile)
INCLUDE(CheckIncludeFiles)
INCLUDE(CheckLibraryExists)
INCLUDE(CheckSymbolExists)
INCLUDE(CheckTypeSize)
INCLUDE_DIRECTORIES(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/include
${CMAKE_CURRENT_SOURCE_DIR}/src
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/../platform/include
${CMAKE_INSTALL_PREFIX}/include)
INCLUDE_DIRECTORIES(AFTER ${ICU_INCLUDE_DIR}
${V8_INCLUDE_DIR}
${SNAPPY_INCLUDE_DIR})
CHECK_INCLUDE_FILES("netinet/in.h" HAVE_NETINET_IN_H)
CHECK_INCLUDE_FILES("inttypes.h" HAVE_INTTYPES_H)
CHECK_INCLUDE_FILES("unistd.h" HAVE_UNISTD_H)
CHECK_SYMBOL_EXISTS(fdatasync "unistd.h" HAVE_FDATASYNC)
CHECK_SYMBOL_EXISTS(qsort_r "stdlib.h" HAVE_QSORT_R)
IF (WIN32)
SET(COUCHSTORE_FILE_OPS "src/os_win.c")
ELSE(WIN32)
SET(COUCHSTORE_FILE_OPS "src/os.c")
ENDIF(WIN32)
SET(COUCHSTORE_SOURCES src/arena.cc src/bitfield.c src/btree_modify.cc
src/btree_read.cc src/couch_db.cc src/couch_file_read.cc
src/couch_file_write.cc src/couch_save.cc src/crc32.c
src/db_compact.cc src/file_merger.cc src/file_name_utils.c
src/file_sorter.cc src/iobuffer.cc src/llmsort.cc
src/mergesort.cc src/node_types.cc src/reduces.cc
src/rfc1321/md5c.c src/strerror.cc src/tree_writer.cc
src/util.cc src/views/bitmap.c src/views/collate_json.c
src/views/file_merger.c src/views/file_sorter.c
src/views/index_header.c src/views/keys.c
src/views/mapreduce/mapreduce.cc
src/views/mapreduce/mapreduce_c.cc src/views/reducers.c
src/views/reductions.c src/views/sorted_list.c
src/views/spatial.c src/views/util.c src/views/values.c
src/views/view_group.c src/views/purgers.c
src/views/compaction.c src/quicksort.c ${COUCHSTORE_FILE_OPS})
SET(COUCHSTORE_LIBRARIES ${V8_LIBRARIES} ${ICU_LIBRARIES} ${SNAPPY_LIBRARIES} platform)
ADD_LIBRARY(couchstore SHARED ${COUCHSTORE_SOURCES})
SET_TARGET_PROPERTIES(couchstore PROPERTIES COMPILE_FLAGS "-DLIBCOUCHSTORE_INTERNAL=1 -DLIBMAPREDUCE_INTERNAL=1")
TARGET_LINK_LIBRARIES(couchstore ${COUCHSTORE_LIBRARIES})
ADD_EXECUTABLE(couch_dbdump src/dbdump.c)
TARGET_LINK_LIBRARIES(couch_dbdump couchstore)
ADD_EXECUTABLE(couch_dbinfo src/dbinfo.c)
TARGET_LINK_LIBRARIES(couch_dbinfo couchstore)
ADD_EXECUTABLE(couch_compact src/compactor.c)
TARGET_LINK_LIBRARIES(couch_compact couchstore)
ADD_EXECUTABLE(couch_view_file_sorter src/views/bin/couch_view_file_sorter.c)
TARGET_LINK_LIBRARIES(couch_view_file_sorter couchstore)
ADD_EXECUTABLE(couch_view_file_merger src/views/bin/couch_view_file_merger.c)
TARGET_LINK_LIBRARIES(couch_view_file_merger couchstore)
ADD_EXECUTABLE(couch_view_index_builder src/views/bin/couch_view_index_builder.c src/views/bin/util.c)
TARGET_LINK_LIBRARIES(couch_view_index_builder couchstore)
ADD_EXECUTABLE(couch_view_group_cleanup src/views/bin/couch_view_group_cleanup.c src/views/bin/util.c)
TARGET_LINK_LIBRARIES(couch_view_group_cleanup couchstore)
ADD_EXECUTABLE(couch_view_index_updater src/views/bin/couch_view_index_updater.c src/views/bin/util.c)
TARGET_LINK_LIBRARIES(couch_view_index_updater couchstore)
ADD_EXECUTABLE(couch_view_group_compactor src/views/bin/couch_view_group_compactor.c src/views/bin/util.c)
TARGET_LINK_LIBRARIES(couch_view_group_compactor couchstore)
IF (INSTALL_HEADER_FILES)
INSTALL(FILES
include/libcouchstore/couch_db.h
include/libcouchstore/couch_index.h
include/libcouchstore/couch_common.h
include/libcouchstore/error.h
include/libcouchstore/file_ops.h
include/libcouchstore/visibility.h
DESTINATION include/libcouchstore)
ENDIF(INSTALL_HEADER_FILES)
INSTALL(TARGETS couchstore
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
INSTALL(TARGETS couch_dbdump
couch_dbinfo
couch_compact
couch_view_file_sorter
couch_view_file_merger
couch_view_index_builder
couch_view_group_cleanup
couch_view_index_updater
couch_view_group_compactor
RUNTIME DESTINATION bin)
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.cmake.h.in
${CMAKE_CURRENT_BINARY_DIR}/config.h)
# Tests:
IF (LUA_FOUND)
ADD_EXECUTABLE(couchscript src/couchscript.cc)
SET_TARGET_PROPERTIES(couchscript PROPERTIES COMPILE_FLAGS -I${LUA_INCLUDE_DIR})
TARGET_LINK_LIBRARIES(couchscript couchstore ${LUA_LIBRARIES})
ADD_TEST(couchstore-localdoc couchscript tests/localdoc.lua)
ADD_TEST(couchstore-corrupt couchscript tests/corrupt.lua)
ADD_TEST(couchstore-bulk couchscript tests/bulk.lua)
ADD_TEST(couchstore-changes-since-filter couchscript tests/changessincefilter.lua)
ADD_TEST(couchstore-compact couchscript tests/compact.lua)
ADD_TEST(couchstore-dropdel couchscript tests/dropdel.lua)
ADD_TEST(couchstore-largefile couchscript tests/largefile.lua)
ADD_TEST(couchstore-large couchscript tests/large.lua)
ENDIF(LUA_FOUND)
MACRO (M_ADD_PYTHON_TEST name pyfile)
ADD_TEST(${name} python ${pyfile})
SET_PROPERTY(TEST ${name} PROPERTY ENVIRONMENT
"PYTHONPATH=${CMAKE_CURRENT_SOURCE_DIR}/python"
"LD_LIBRARY_PATH=${CMAKE_CURRENT_BINARY_DIR}")
ENDMACRO()
M_ADD_PYTHON_TEST(couchstore-purge tests/purge.py)
M_ADD_PYTHON_TEST(couchstore-rewind tests/rewind.py)
M_ADD_PYTHON_TEST(couchstore-changecount tests/changecount.py)
ADD_EXECUTABLE(couchstore_testapp tests/testapp.c
tests/file_merger_tests.c
tests/file_sorter_tests.c
tests/mapreduce/tests.c
tests/mapreduce/map.c
tests/mapreduce/reduce.c
tests/mapreduce/builtin.c
tests/views/tests.c
tests/views/collate_json_test.c
tests/views/index_headers.c
tests/views/bitmaps.c
tests/views/sorted_lists.c
tests/views/reductions.c
tests/views/keys.c
tests/views/values.c
tests/views/reducers.c
tests/views/cleanup.c
tests/views/spatial.c
tests/btree_purge/purge_tests.h
tests/btree_purge/tests.c
tests/btree_purge/purge.c
${COUCHSTORE_SOURCES} )
SET_TARGET_PROPERTIES(couchstore_testapp PROPERTIES COMPILE_FLAGS "-DLIBCOUCHSTORE_NO_VISIBILITY=1")
TARGET_LINK_LIBRARIES(couchstore_testapp ${COUCHSTORE_LIBRARIES})
ADD_TEST(couchstore-testapp couchstore_testapp)