-
Notifications
You must be signed in to change notification settings - Fork 55
/
CMakeLists.txt
133 lines (118 loc) · 4.68 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
PROJECT(CouchDB)
CMAKE_MINIMUM_REQUIRED(VERSION 3.13)
ADD_ERLANG_INCLUDE_DIR(${CMAKE_CURRENT_SOURCE_DIR}/src/couchdb)
SET(COUCHDB_RUNTEST ${CMAKE_CURRENT_SOURCE_DIR}/test/etap/runtest.py)
SET(COUCHDB_BIN_PATH ${CMAKE_CURRENT_BINARY_DIR})
SET(COUCHSTORE_BIN_PATH ${CMAKE_BINARY_DIR}/couchstore)
SET(abs_top_srcdir ${CMAKE_CURRENT_SOURCE_DIR})
SET(abs_top_builddir ${CMAKE_CURRENT_BINARY_DIR})
FILE(GLOB_RECURSE COUCHDB_ALL_ERLANG_HEADERS
FOLLOW_SYMLINKS ${CMAKE_CURRENT_SOURCE_DIR}/src/*.hrl)
IF(WIN32)
ADD_CUSTOM_TARGET(check
COMMAND ${CMAKE_COMMAND} -E echo "Running unit tests with ipv4 bind address"
COMMAND ${CMAKE_COMMAND} -E env ipv6=false ${CMAKE_CTEST_COMMAND} --output-on-failure
COMMAND ${CMAKE_COMMAND} -E echo "Running unit tests with ipv6 bind address"
COMMAND ${CMAKE_COMMAND} -E env ipv6=true ${CMAKE_CTEST_COMMAND} --output-on-failure
DEPENDS dialyzer
)
ELSE(WIN32)
ADD_CUSTOM_TARGET(check
COMMAND ${CMAKE_COMMAND} -E echo "Running unit tests with ipv4 bind address"
COMMAND ${CMAKE_COMMAND} -E env ipv6=false ${CMAKE_CTEST_COMMAND} --output-on-failure -j4
COMMAND ${CMAKE_COMMAND} -E echo "Running unit tests with ipv6 bind address"
COMMAND ${CMAKE_COMMAND} -E env ipv6=true ${CMAKE_CTEST_COMMAND} --output-on-failure -j4
DEPENDS dialyzer
)
ENDIF(WIN32)
IF(WIN32)
ADD_DEFINITIONS(-D__WIN32__)
ELSEIF (NOT "${CMAKE_SYSTEM_NAME}" STREQUAL "SunOS")
SET(COUCHBASE_UNRESOLVED -Wl,-undefined -Wl,dynamic_lookup)
ENDIF(WIN32)
SET(ERLANG_COMPILE_FLAGS +debug_info -Werror
+nowarn_deprecated_function +nowarn_deprecated_type)
EXECUTE_PROCESS(COMMAND git describe
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE COUCHDB_VERSION
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/test/python/set_view/run.py.tpl
${CMAKE_CURRENT_BINARY_DIR}/test/python/set_view/run.py)
SET(CMAKE_ERL_LIB_INSTALL_PREFIX "lib/couchdb/erlang/lib" CACHE STRING
"Installation prefix for CouchDB libs")
MARK_AS_ADVANCED(CMAKE_ERL_LIB_INSTALL_PREFIX)
ADD_SUBDIRECTORY(bin)
ADD_SUBDIRECTORY(etc)
ADD_SUBDIRECTORY(src)
# Build the directory layout
FILE(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/tmp/lib
${CMAKE_CURRENT_BINARY_DIR}/tmp/log
${CMAKE_CURRENT_BINARY_DIR}/tmp/run/couchdb)
ADD_SUBDIRECTORY(test)
SET(COUCHDB_PLT_FILE ${CMAKE_CURRENT_BINARY_DIR}/couchdb.plt)
ADD_CUSTOM_TARGET(couchdb-check-plt
COMMAND
${CMAKE_COMMAND}
-DPLT_FILE=${COUCHDB_PLT_FILE}
-P ${CMAKE_MODULE_PATH}/ErlangCheckPlt.cmake)
ADD_CUSTOM_COMMAND(OUTPUT ${COUCHDB_PLT_FILE}
COMMAND
${DIALYZER_EXECUTABLE} --output_plt ${COUCHDB_PLT_FILE}
--build_plt
-pa src/lhttpc
-pa src/couchdb
-pa src/couch_set_view
-pa src/couch_index_merger
-pa src/couch_view_parser
-pa src/mapreduce
-pa src/couch_dcp
-pa src/couch_audit
--apps
compiler
crypto
erts
inets
kernel
os_mon
sasl
ssl
stdlib
xmerl
syntax_tools
public_key
tools
hipe
runtime_tools
-r
src/erlang-oauth
src/etap
src/mochiweb
src/snappy
VERBATIM )
ADD_CUSTOM_TARGET(dialyzer
COMMAND
${DIALYZER_EXECUTABLE} --plt ${COUCHDB_PLT_FILE}
--verbose
-Wno_improper_lists
-pa src/couchdb
-pa src/couch_set_view
-pa src/couch_index_merger
-pa src/couch_view_parser
-pa src/mapreduce
-pa src/lhttpc
-pa src/snappy
-pa src/couch_dcp
-pa src/couch_audit
-r
src/couchdb
src/couch_set_view
src/couch_index_merger/ebin
src/couch_view_parser
src/snappy
src/lhttpc
src/mapreduce
src/couch_dcp
DEPENDS
couchdb-check-plt
${COUCHDB_PLT_FILE})