xref: /6.0.3/couchdb/CMakeLists.txt (revision ffc45950)
1PROJECT(CouchDB)
2CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
3SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}")
4ADD_ERLANG_INCLUDE_DIR(${CMAKE_MODULE_PATH}/src/couchdb)
5
6SET(COUCHDB_RUNTEST ${CMAKE_CURRENT_SOURCE_DIR}/test/etap/runtest.py)
7SET(COUCHDB_BIN_PATH ${CMAKE_CURRENT_BINARY_DIR})
8SET(COUCHSTORE_BIN_PATH ${CMAKE_BINARY_DIR}/couchstore)
9SET(abs_top_srcdir ${CMAKE_CURRENT_SOURCE_DIR})
10SET(abs_top_builddir ${CMAKE_CURRENT_BINARY_DIR})
11
12ADD_CUSTOM_TARGET(check COMMAND ${CMAKE_CTEST_COMMAND} -j4
13                  DEPENDS dialyzer)
14
15IF(WIN32)
16  ADD_DEFINITIONS(-D__WIN32__)
17ELSEIF (NOT "${CMAKE_SYSTEM_NAME}" STREQUAL "SunOS")
18  SET(COUCHBASE_UNRESOLVED -Wl,-undefined -Wl,dynamic_lookup)
19ENDIF(WIN32)
20
21SET(ERLANG_COMPILE_FLAGS +debug_info -Werror +nowarn_deprecated_function)
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")
34
35ADD_SUBDIRECTORY(bin)
36ADD_SUBDIRECTORY(etc)
37ADD_SUBDIRECTORY(src)
38ADD_SUBDIRECTORY(share)
39
40# Build the directory layout
41FILE(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/tmp/lib
42                    ${CMAKE_CURRENT_BINARY_DIR}/tmp/log
43                    ${CMAKE_CURRENT_BINARY_DIR}/tmp/run/couchdb)
44
45ADD_SUBDIRECTORY(test)
46
47ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/couchdb.plt
48       COMMAND
49          dialyzer --output_plt ${CMAKE_CURRENT_BINARY_DIR}/couchdb.plt
50                   --build_plt
51                   -pa src/lhttpc
52                   -pa src/couchdb
53                   -pa src/couch_set_view
54                   -pa src/couch_index_merger
55                   -pa src/couch_view_parser
56                   -pa src/mapreduce
57                   --apps
58                        compiler
59                        crypto
60                        erts
61                        inets
62                        kernel
63                        os_mon
64                        sasl
65                        ssl
66                        stdlib
67                        xmerl
68                        syntax_tools
69                        public_key
70                        tools
71                        hipe
72                        runtime_tools
73                   -r
74                        src/erlang-oauth
75                        src/etap
76                        src/mochiweb
77                        src/snappy
78                  VERBATIM )
79
80ADD_CUSTOM_TARGET(dialyzer
81       COMMAND
82          dialyzer --plt ${CMAKE_CURRENT_BINARY_DIR}/couchdb.plt
83                   --verbose
84                   -Wno_improper_lists
85                   -pa src/couchdb
86                   -pa src/couch_set_view
87                   -pa src/couch_index_merger
88                   -pa src/couch_view_parser
89                   -pa src/mapreduce
90                   -pa src/lhttpc
91                   -pa src/snappy
92                   -r
93                        src/couchdb
94                        src/couch_set_view
95                        src/couch_index_merger/ebin
96                        src/couch_view_parser
97                        src/snappy
98                        src/lhttpc
99                        src/mapreduce
100                  DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/couchdb.plt)
101