forked from aviggiano/redis-roaring
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
54 lines (44 loc) · 1.66 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
cmake_minimum_required(VERSION 3.0)
project(redis-roaring)
set(CMAKE_VERBOSE_MAKEFILE on)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -Wall -Werror")
set(SRC_PATH ${CMAKE_CURRENT_SOURCE_DIR}/src)
set(DEPS_PATH ${CMAKE_CURRENT_SOURCE_DIR}/deps)
set(TEST_PATH ${CMAKE_CURRENT_SOURCE_DIR}/tests)
set(CROARING_PATH ${DEPS_PATH}/CRoaring)
set(HIREDIS_PATH ${DEPS_PATH}/hiredis)
set(SDS_PATH ${DEPS_PATH}/sds)
set(CROARING_BUILD_PATH ${DEPS_PATH}/CRoaring/build)
#set(CMAKE_C_FLAGS_RELEASE "") # removes -NDEBUG
set(CMAKE_BUILD_TYPE Debug)
link_directories(${CROARING_BUILD_PATH})
link_directories(${HIREDIS_PATH})
include_directories(${CROARING_PATH})
include_directories(${HIREDIS_PATH})
include_directories(${SDS_PATH})
include_directories(${SRC_PATH})
enable_testing()
####### unit tests #######
message(STATUS "Compiling unit tests")
set(UNIT_FILES
${SRC_PATH}/data-structure.c
${TEST_PATH}/unit.c)
add_executable(unit ${UNIT_FILES})
target_link_libraries(unit roaring)
add_test(NAME unit_tests COMMAND unit)
####### performance tests #######
message(STATUS "Compiling performance tests")
set(PERFORMANCE_FILES ${TEST_PATH}/performance.c)
add_executable(performance ${PERFORMANCE_FILES})
target_link_libraries(performance libhiredis.a)
target_link_libraries(performance m)
add_test(NAME performance_tests COMMAND performance)
####### redis module #######
message(STATUS "Compiling redis module")
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(SOURCE_FILES ${SRC_PATH}/redis-roaring.c
${SRC_PATH}/type.c
${SRC_PATH}/data-structure.c
${SDS_PATH}/sds.c)
add_library(redis-roaring SHARED ${SOURCE_FILES})
target_link_libraries(redis-roaring roaring)