1+ # The MIT License (MIT)
2+ #
3+ # Copyright (c) 2015-2017 Simon Ninon <simon.ninon@gmail.com>
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+
123###
224# config
325###
@@ -23,6 +45,13 @@ project(${PROJECT} CXX)
2345###
2446IF (WIN32 )
2547 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+
2655 add_definitions (-D_UNICODE )
2756 add_definitions (-DUNICODE )
2857 add_definitions (-DWIN32_LEAN_AND_MEAN )
@@ -34,40 +63,34 @@ ENDIF (WIN32)
3463###
3564# variables
3665###
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
4069set (CPP_REDIS_INCLUDES ${PROJECT_SOURCE_DIR} /includes)
70+ # tacopie
71+ set (TACOPIE_FOLDER ${PROJECT_SOURCE_DIR} /tacopie)
72+ set (TACOPIE_INCLUDES ${TACOPIE_FOLDER} /includes)
4173
4274
4375###
4476# includes
4577###
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} )
5380
5481
5582###
5683# sources
5784###
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" )
6686foreach (dir ${SRC_DIRS} )
67- # get directory sources
87+ # get directory sources and headers
6888 file (GLOB s_${dir} "${dir} /*.cpp" )
89+ file (GLOB h_${dir} "${dir} /*.hpp" )
90+ file (GLOB i_${dir} "${dir} /*.ipp" )
91+
6992 # set sources
70- set (SOURCES ${SOURCES} ${s_${dir} })
93+ set (SOURCES ${SOURCES} ${s_${dir} } ${h_ ${dir} } ${i_ ${dir} } )
7194endforeach ()
7295
7396
@@ -90,31 +113,21 @@ configure_file("cpp_redis.pc.in" "${CMAKE_PKGCONFIG_OUTPUT_DIRECTORY}/cpp_redis.
90113add_library (${PROJECT} STATIC ${SOURCES} )
91114
92115IF (WIN32 )
93- target_link_libraries (${PROJECT} ws2_32 )
116+ target_link_libraries (${PROJECT} ws2_32 tacopie )
94117ELSE ()
95- target_link_libraries (${PROJECT} pthread )
118+ target_link_libraries (${PROJECT} pthread tacopie )
96119ENDIF (WIN32 )
97120
98121# __CPP_REDIS_READ_SIZE
99122IF (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} " )
101124ENDIF (READ_SIZE )
102125
103126# __CPP_REDIS_LOGGING_ENABLED
104127IF (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} " )
106129ENDIF (LOGGING_ENABLED )
107130
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-
118131
119132###
120133# install
@@ -128,17 +141,25 @@ install (DIRECTORY ${CMAKE_BINARY_DIR}/bin/ DESTINATION bin USE_SOURCE_PERMISSIO
128141install (DIRECTORY ${CPP_REDIS_INCLUDES} / DESTINATION include USE_SOURCE_PERMISSIONS)
129142
130143
144+ ###
145+ # tacopie
146+ ###
147+ add_subdirectory (tacopie )
148+
149+
131150###
132151# examples
133152###
134153IF (BUILD_EXAMPLES)
135154 add_subdirectory (examples )
136155ENDIF (BUILD_EXAMPLES )
137156
138-
139157###
140158# tests
141159###
142160IF (BUILD_TESTS)
143161 add_subdirectory (tests )
162+ IF (EXISTS ${PROJECT_SOURCE_DIR} /deps/src/googletest)
163+ add_subdirectory (${PROJECT_SOURCE_DIR} /deps/src/googletest )
164+ ENDIF ()
144165ENDIF (BUILD_TESTS )
0 commit comments