dnet_send_cmd_raw() must always wait for ack
[elliptics.git] / CMakeLists.txt
blob41e3f2ce7ab0e1f713e24b507fc7d46f9a2087ad
1 cmake_minimum_required (VERSION 2.6 FATAL_ERROR)
2 cmake_policy (VERSION 2.6.0)
4 set(CMAKE_SKIP_RPATH FALSE)
5 set(CMAKE_SKIP_BUILD_RPATH  FALSE)
7 project (elliptics)
8 set(ELLIPTICS_VERSION_ABI "2.17")
9 set(ELLIPTICS_VERSION_MINOR "0.1")
11 option(WITH_PYTHON "Build python bindings" ON)
12 option(WITH_COCAINE "Build with cocaine support" ON)
13 option(WITH_EXAMPLES "Build example applications" ON)
14 option(WITH_SMACK "Build ioserv with smack backend" ON)
16 set(ELLIPTICS_VERSION "${ELLIPTICS_VERSION_ABI}.${ELLIPTICS_VERSION_MINOR}")
18 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
19 include(CheckLargefile)
20 include(CheckAtomic)
21 include(CheckSendfile)
22 include(CheckIoprio)
23 include(TestBigEndian)
24 include(CheckProcStats)
25 include(CreateStdint)
27 create_stdint(${CMAKE_BINARY_DIR}/include/elliptics/typedefs.h)
28 include_directories(${CMAKE_BINARY_DIR}/include/)
30 # Set id_size
31 if (NOT ID_SIZE)
32     set(ID_SIZE 64)
33 endif()
34 add_definitions(-DCONFIG_ID_SIZE=${ID_SIZE})
36 # Test endianess
37 test_big_endian(HAVE_BIG_ENDIAN)
38 if(HAVE_BIG_ENDIAN)
39     add_definitions(-DBYTEORDER=4321)
40     add_definitions(-DWORDS_BIGENDIAN=1)
41 else()
42     add_definitions(-DBYTEORDER=1234)
43 endif()
45 if (UNIX OR MINGW)
46     add_definitions(-W -Wall -Wextra -fstack-protector-all -fno-strict-aliasing -g)
47 endif()
49 # Check for threads
50 if (UNIX AND BSD)
51     set(CMAKE_THREAD_LIBS -pthread)
52     set(CMAKE_USE_PTHREADS ON)
53     set(CMAKE_EXE_LINKER_FLAGS -pthread -Wl,--as-needed)
54 endif()
56 set(CMAKE_THREAD_PREFER_PTHREAD ON)
57 find_package(Threads REQUIRED)
59 if(WITH_COCAINE)
60     find_package(ZMQ REQUIRED)
61     include_directories(${ZMQ_INCLUDE_DIRS})
63     # Find some cocaine
64     find_package(Cocaine REQUIRED)
65     include_directories(${COCAINE_INCLUDE_DIRS})
66     add_definitions(${COCAINE_CFLAGS})
67 endif()
69 # Find eblob
70 find_package(Eblob REQUIRED)
71 include_directories(${EBLOB_INCLUDE_DIRS})
73 if(WITH_SMACK)
74     # Find smack
75     find_package(Smack REQUIRED)
76     include_directories(${SMACK_INCLUDE_DIRS})
77 endif()
79 # Collect all libraries together
80 set(ELLIPTICS_LIBRARIES
81     ${SENDFILE_LIBRARIES}
82     ${Boost_LIBRARIES}
83     ${EBLOB_LIBRARIES}
84     ${ZMQ_LIBRARIES}
85     ${COCAINE_LIBRARIES}
86     ${CMAKE_THREAD_LIBS_INIT}
87     )
89 # Build parts
90 add_subdirectory(srw)
91 add_subdirectory(cache)
92 add_subdirectory(library)
93 add_subdirectory(bindings)
94 if(WITH_EXAMPLES)
95     add_subdirectory(example)
96 endif()
98 install(FILES
99         include/elliptics/core.h
100         include/elliptics/cppdef.h
101         include/elliptics/interface.h
102         include/elliptics/packet.h
103         include/elliptics/srw.h
104         ${CMAKE_BINARY_DIR}/include/elliptics/typedefs.h
105         DESTINATION include/elliptics/
106         )