-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
66 lines (55 loc) · 1.7 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
cmake_minimum_required(VERSION 2.8)
project(async_redis_client)
if (CMAKE_BUILD_TYPE)
else()
set(CMAKE_BUILD_TYPE RELEASE)
endif()
# libgo
if (WIN32)
include_directories(${PROJECT_SOURCE_DIR}/libgo/include/libgo/windows)
set(LIBGO_LIB ${PROJECT_SOURCE_DIR}/libgo/lib/win32)
endif ()
include_directories(${PROJECT_SOURCE_DIR}/libgo/include)
include_directories(${PROJECT_SOURCE_DIR}/libgo/include/libgo)
link_directories(${LIBGO_LIB})
set(libgo_link libgo)
# end libgo
# python
if (WIN32)
set(PYTHON_INC ${PYTHON_ROOT}/include)
set(PYTHON_LIB ${PYTHON_ROOT}/libs)
set(python_link python27)
endif ()
include_directories(${PYTHON_INC})
link_directories(${PYTHON_LIB})
# end python
# cflags
if (WIN32)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd /EHsc")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT /EHsc")
endif ()
# end cflags
message("------------ info -------------")
message(" CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
message(" Libgo include dir: ${PROJECT_SOURCE_DIR}/libgo/include}")
message(" Libgo lib dir: ${LIBGO_LIB}")
message(" Libgo link: ${libgo_link}")
message(" Python include dir: ${PYTHON_INC}")
message(" Python lib dir: ${PYTHON_LIB}")
message(" Python link: ${python_link}")
message(" CMAKE_CXX_FLAGS_DEBUG: ${CMAKE_CXX_FLAGS_DEBUG}")
message(" CMAKE_CXX_FLAGS_RELEASE: ${CMAKE_CXX_FLAGS_RELEASE}")
message("----------------------------------")
# hiredis
add_subdirectory(hiredis)
# end hiredis
set(PYTHON_BINDING_SRCS
python/redis.cpp
)
add_library(redis MODULE ${PYTHON_BINDING_SRCS})
if(WIN32)
set_target_properties(redis PROPERTIES SUFFIX ".pyd")
target_link_libraries(redis ${python_link} ${libgo_link} ws2_32)
endif()
# test
add_subdirectory(tests)