xref: /6.0.3/couchdb/CMakeLists.txt (revision 5bbf5880)
1PROJECT(CouchDB)
2CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
3ADD_ERLANG_INCLUDE_DIR(${CMAKE_CURRENT_SOURCE_DIR}/src/couchdb)
4
5SET(COUCHDB_RUNTEST ${CMAKE_CURRENT_SOURCE_DIR}/test/etap/runtest.py)
6SET(COUCHDB_BIN_PATH ${CMAKE_CURRENT_BINARY_DIR})
7SET(COUCHSTORE_BIN_PATH ${CMAKE_BINARY_DIR}/couchstore)
8SET(abs_top_srcdir ${CMAKE_CURRENT_SOURCE_DIR})
9SET(abs_top_builddir ${CMAKE_CURRENT_BINARY_DIR})
10
11ADD_CUSTOM_TARGET(check COMMAND ${CMAKE_CTEST_COMMAND} -j4
12                  DEPENDS dialyzer)
13
14IF(WIN32)
15  ADD_DEFINITIONS(-D__WIN32__)
16ELSEIF (NOT "${CMAKE_SYSTEM_NAME}" STREQUAL "SunOS")
17  SET(COUCHBASE_UNRESOLVED -Wl,-undefined -Wl,dynamic_lookup)
18ENDIF(WIN32)
19
20SET(ERLANG_COMPILE_FLAGS +debug_info -Werror
21  +nowarn_deprecated_function +nowarn_deprecated_type)
22
23
24EXECUTE_PROCESS(COMMAND git describe
25                WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
26                OUTPUT_VARIABLE COUCHDB_VERSION
27                ERROR_QUIET
28                OUTPUT_STRIP_TRAILING_WHITESPACE)
29
30CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/test/python/set_view/run.py.tpl
31               ${CMAKE_CURRENT_BINARY_DIR}/test/python/set_view/run.py)
32
33SET(CMAKE_ERL_LIB_INSTALL_PREFIX "lib/couchdb/erlang/lib" CACHE STRING
34  "Installation prefix for CouchDB libs")
35MARK_AS_ADVANCED(CMAKE_ERL_LIB_INSTALL_PREFIX)
36
37ADD_SUBDIRECTORY(bin)
38ADD_SUBDIRECTORY(etc)
39ADD_SUBDIRECTORY(src)
40
41# Build the directory layout
42FILE(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/tmp/lib
43                    ${CMAKE_CURRENT_BINARY_DIR}/tmp/log
44                    ${CMAKE_CURRENT_BINARY_DIR}/tmp/run/couchdb)
45
46ADD_SUBDIRECTORY(test)
47
48
49SET(COUCHDB_PLT_FILE ${CMAKE_CURRENT_BINARY_DIR}/couchdb.plt)
50ADD_CUSTOM_TARGET(couchdb-check-plt
51       COMMAND
52           ${CMAKE_COMMAND}
53               -DPLT_FILE=${COUCHDB_PLT_FILE}
54               -P ${CMAKE_MODULE_PATH}/ErlangCheckPlt.cmake)
55
56ADD_CUSTOM_COMMAND(OUTPUT ${COUCHDB_PLT_FILE}
57       COMMAND
58          ${DIALYZER_EXECUTABLE} --output_plt ${COUCHDB_PLT_FILE}
59                   --build_plt
60                   -pa src/lhttpc
61                   -pa src/couchdb
62                   -pa src/couch_set_view
63                   -pa src/couch_index_merger
64                   -pa src/couch_view_parser
65                   -pa src/mapreduce
66                   -pa src/couch_dcp
67                   --apps
68                        compiler
69                        crypto
70                        erts
71                        inets
72                        kernel
73                        os_mon
74                        sasl
75                        ssl
76                        stdlib
77                        xmerl
78                        syntax_tools
79                        public_key
80                        tools
81                        hipe
82                        runtime_tools
83                   -r
84                        src/erlang-oauth
85                        src/etap
86                        src/mochiweb
87                        src/snappy
88                  VERBATIM )
89
90ADD_CUSTOM_TARGET(dialyzer
91       COMMAND
92          ${DIALYZER_EXECUTABLE} --plt ${COUCHDB_PLT_FILE}
93                   --verbose
94                   -Wno_improper_lists
95                   -pa src/couchdb
96                   -pa src/couch_set_view
97                   -pa src/couch_index_merger
98                   -pa src/couch_view_parser
99                   -pa src/mapreduce
100                   -pa src/lhttpc
101                   -pa src/snappy
102                   -pa src/couch_dcp
103                   -r
104                        src/couchdb
105                        src/couch_set_view
106                        src/couch_index_merger/ebin
107                        src/couch_view_parser
108                        src/snappy
109                        src/lhttpc
110                        src/mapreduce
111                        src/couch_dcp
112       DEPENDS
113          couchdb-check-plt
114          ${COUCHDB_PLT_FILE})
115