1
+ # The MIT License (MIT)
2
+ #
3
+ # Copyright (c) 2015-2017 Simon Ninon <[email protected] >
4
+ #
5
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ # of this software and associated documentation files (the "Software"), to deal
7
+ # in the Software without restriction, including without limitation the rights
8
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ # copies of the Software, and to permit persons to whom the Software is
10
+ # furnished to do so, subject to the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be included in all
13
+ # copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ # SOFTWARE.
22
+
1
23
###
2
24
# config
3
25
###
@@ -23,6 +45,13 @@ project(${PROJECT} CXX)
23
45
###
24
46
IF (WIN32 )
25
47
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W3 /O2" )
48
+
49
+ # was causing conflics with gtest build
50
+ string (REPLACE "/RTC1" "" CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG} )
51
+ foreach (flag_var CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE )
52
+ string (REPLACE "/MD" "-MT" ${flag_var} "${${flag_var} }" )
53
+ endforeach ()
54
+
26
55
add_definitions (-D_UNICODE)
27
56
add_definitions (-DUNICODE)
28
57
add_definitions (-DWIN32_LEAN_AND_MEAN)
@@ -34,40 +63,34 @@ ENDIF (WIN32)
34
63
###
35
64
# variables
36
65
###
37
- set (DEPS_FOLDER ${PROJECT_SOURCE_DIR} /deps/ build )
38
- set (GTEST_INCLUDES ${DEPS_FOLDER} /gtest /include )
39
- set (GTEST_LIBS ${DEPS_FOLDER} /gtest/lib)
66
+ # gtest
67
+ set (GTEST_INCLUDES ${PROJECT_SOURCE_DIR} /deps/src/googletest/googletest /include )
68
+ # cpp_redis
40
69
set (CPP_REDIS_INCLUDES ${PROJECT_SOURCE_DIR} /includes)
70
+ # tacopie
71
+ set (TACOPIE_FOLDER ${PROJECT_SOURCE_DIR} /tacopie)
72
+ set (TACOPIE_INCLUDES ${TACOPIE_FOLDER} /includes)
41
73
42
74
43
75
###
44
76
# includes
45
77
###
46
- include_directories (${CPP_REDIS_INCLUDES} )
47
-
48
-
49
- ###
50
- # link
51
- ###
52
- link_directories (${GTEST_LIBS} )
78
+ include_directories (${CPP_REDIS_INCLUDES}
79
+ ${TACOPIE_INCLUDES} )
53
80
54
81
55
82
###
56
83
# sources
57
84
###
58
- set (SRC_DIRS "sources" "sources/network" "sources/builders" )
59
-
60
- IF (WIN32 )
61
- set (SRC_DIRS ${SRC_DIRS} "sources/network/windows_impl" )
62
- ELSE ()
63
- set (SRC_DIRS ${SRC_DIRS} "sources/network/unix_impl" )
64
- ENDIF (WIN32 )
65
-
85
+ set (SRC_DIRS "sources" "sources/network" "sources/builders" "includes/cpp_redis" "includes/cpp_redis/builders" "includes/cpp_redis/network" )
66
86
foreach (dir ${SRC_DIRS} )
67
- # get directory sources
87
+ # get directory sources and headers
68
88
file (GLOB s_${dir} "${dir} /*.cpp" )
89
+ file (GLOB h_${dir} "${dir} /*.hpp" )
90
+ file (GLOB i_${dir} "${dir} /*.ipp" )
91
+
69
92
# set sources
70
- set (SOURCES ${SOURCES} ${s_${dir} })
93
+ set (SOURCES ${SOURCES} ${s_${dir} } ${h_ ${dir} } ${i_ ${dir} } )
71
94
endforeach ()
72
95
73
96
@@ -90,31 +113,21 @@ configure_file("cpp_redis.pc.in" "${CMAKE_PKGCONFIG_OUTPUT_DIRECTORY}/cpp_redis.
90
113
add_library (${PROJECT} STATIC ${SOURCES} )
91
114
92
115
IF (WIN32 )
93
- target_link_libraries (${PROJECT} ws2_32)
116
+ target_link_libraries (${PROJECT} ws2_32 tacopie )
94
117
ELSE ()
95
- target_link_libraries (${PROJECT} pthread)
118
+ target_link_libraries (${PROJECT} pthread tacopie )
96
119
ENDIF (WIN32 )
97
120
98
121
# __CPP_REDIS_READ_SIZE
99
122
IF (READ_SIZE)
100
- set_target_properties (${PROJECT} PROPERTIES COMPILE_DEFINITIONS "__CPP_REDIS_READ_SIZE=${READ_SIZE} " )
123
+ set_target_properties (${PROJECT} PROPERTIES COMPILE_DEFINITIONS "__CPP_REDIS_READ_SIZE=${READ_SIZE} " )
101
124
ENDIF (READ_SIZE)
102
125
103
126
# __CPP_REDIS_LOGGING_ENABLED
104
127
IF (LOGGING_ENABLED)
105
- set_target_properties (${PROJECT} PROPERTIES COMPILE_DEFINITIONS "__CPP_REDIS_LOGGING_ENABLED=${LOGGING_ENABLED} " )
128
+ set_target_properties (${PROJECT} PROPERTIES COMPILE_DEFINITIONS "__CPP_REDIS_LOGGING_ENABLED=${LOGGING_ENABLED} " )
106
129
ENDIF (LOGGING_ENABLED)
107
130
108
- # _CPP_REDIS_MAX_NB_FDS
109
- IF (MAX_NB_FDS)
110
- set_target_properties (${PROJECT} PROPERTIES COMPILE_DEFINITIONS "_CPP_REDIS_MAX_NB_FDS=${MAX_NB_FDS} " )
111
- ENDIF (MAX_NB_FDS)
112
-
113
- # __CPP_REDIS_DEFAULT_NB_IO_SERVICE_WORKERS
114
- IF (DEFAULT_NB_IO_SERVICE_WORKERS)
115
- set_target_properties (${PROJECT} PROPERTIES COMPILE_DEFINITIONS "__CPP_REDIS_DEFAULT_NB_IO_SERVICE_WORKERS=${DEFAULT_NB_IO_SERVICE_WORKERS} " )
116
- ENDIF (DEFAULT_NB_IO_SERVICE_WORKERS)
117
-
118
131
119
132
###
120
133
# install
@@ -128,17 +141,25 @@ install (DIRECTORY ${CMAKE_BINARY_DIR}/bin/ DESTINATION bin USE_SOURCE_PERMISSIO
128
141
install (DIRECTORY ${CPP_REDIS_INCLUDES} / DESTINATION include USE_SOURCE_PERMISSIONS)
129
142
130
143
144
+ ###
145
+ # tacopie
146
+ ###
147
+ add_subdirectory (tacopie)
148
+
149
+
131
150
###
132
151
# examples
133
152
###
134
153
IF (BUILD_EXAMPLES)
135
154
add_subdirectory (examples)
136
155
ENDIF (BUILD_EXAMPLES)
137
156
138
-
139
157
###
140
158
# tests
141
159
###
142
160
IF (BUILD_TESTS)
143
161
add_subdirectory (tests)
162
+ IF (EXISTS ${PROJECT_SOURCE_DIR} /deps/src/googletest)
163
+ add_subdirectory (${PROJECT_SOURCE_DIR} /deps/src/googletest)
164
+ ENDIF ()
144
165
ENDIF (BUILD_TESTS)
0 commit comments