Skip to content

Commit 31f0373

Browse files
committed
fix compilation error on msvc
1 parent 5a4e387 commit 31f0373

File tree

5 files changed

+52
-51
lines changed

5 files changed

+52
-51
lines changed

recipes/cassandra-cpp-driver/all/conandata.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ patches:
1616
- patch_file: "patches/2.15.3/fix-atomic.patch"
1717
patch_description: "add static_cast for atomic enum"
1818
patch_type: "portability"
19+
- patch_file: "patches/2.15.3/remove-attribute-for-msvc.patch"
20+
patch_description: "remove attribute for msvc"
21+
patch_type: "portability"
1922
"2.15.3":
2023
- patch_file: "patches/2.15.3/fix-cmake.patch"
2124
patch_description: "use cci package"
@@ -26,3 +29,6 @@ patches:
2629
- patch_file: "patches/2.15.3/fix-atomic.patch"
2730
patch_description: "add static_cast for atomic enum"
2831
patch_type: "portability"
32+
- patch_file: "patches/2.15.3/remove-attribute-for-msvc.patch"
33+
patch_description: "remove attribute for msvc"
34+
patch_type: "portability"

recipes/cassandra-cpp-driver/all/conanfile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def requirements(self):
6262
self.requires("rapidjson/cci.20220822")
6363

6464
if self.options.with_openssl:
65-
self.requires("openssl/1.1.1t")
65+
self.requires("openssl/[>=1.1 <4]")
6666

6767
if self.options.with_zlib:
6868
self.requires("minizip/1.2.13")

recipes/cassandra-cpp-driver/all/patches/2.15.3/fix-cmake.patch

Lines changed: 10 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake
2-
index 9052472..347430b 100644
2+
index 9052472..3f65adb 100644
33
--- a/cmake/Dependencies.cmake
44
+++ b/cmake/Dependencies.cmake
55
@@ -21,28 +21,28 @@ if(NOT LIBUV_ROOT_DIR)
@@ -62,22 +62,13 @@ index 9052472..347430b 100644
6262
+find_package(minizip REQUIRED CONFIG)
6363
+set(CASS_LIBS ${CASS_LIBS} minizip::minizip)
6464
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
65-
index 06b84b7..c0bce58 100644
65+
index 06b84b7..41b23f2 100644
6666
--- a/src/CMakeLists.txt
6767
+++ b/src/CMakeLists.txt
68-
@@ -1,6 +1,50 @@
68+
@@ -1,6 +1,41 @@
6969
include(CheckSymbolExists)
7070
include(CheckCXXSourceCompiles)
7171

72-
+#------------------------
73-
+# Windows libraries
74-
+#------------------------
75-
+
76-
+if(WIN32)
77-
+ # Assign additional library requirements for Windows
78-
+ set(CASS_LIBS iphlpapi psapi wsock32 crypt32 ws2_32 userenv version)
79-
+endif()
80-
+
8172
+#------------------------
8273
+# Libuv
8374
+#------------------------
@@ -116,7 +107,7 @@ index 06b84b7..c0bce58 100644
116107
file(GLOB SOURCES *.cpp *.hpp)
117108

118109
if(APPLE)
119-
@@ -38,18 +82,14 @@ endif()
110+
@@ -38,18 +73,14 @@ endif()
120111

121112
add_subdirectory(third_party/curl)
122113
add_subdirectory(third_party/hdr_histogram)
@@ -140,7 +131,7 @@ index 06b84b7..c0bce58 100644
140131

141132
list(APPEND INCLUDE_DIRS ${CASS_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
142133

143-
@@ -69,12 +109,6 @@ if(WIN32)
134+
@@ -69,12 +100,6 @@ if(WIN32)
144135
endif()
145136
endif()
146137

@@ -153,33 +144,27 @@ index 06b84b7..c0bce58 100644
153144
#------------------------------
154145
# Build configured header
155146
#------------------------------
156-
@@ -131,10 +165,9 @@ if(CASS_BUILD_SHARED)
147+
@@ -131,8 +156,7 @@ if(CASS_BUILD_SHARED)
157148
${SOURCES}
158149
$<TARGET_OBJECTS:curl_hostcheck>
159150
$<TARGET_OBJECTS:hdr_histogram>
160151
- $<TARGET_OBJECTS:http-parser>
161152
- $<TARGET_OBJECTS:minizip>)
162153
+ )
163154
target_link_libraries(cassandra ${CASS_LIBS})
164-
- target_include_directories(cassandra PRIVATE ${INCLUDE_DIRS} ${CASS_INCLUDES})
165-
+ target_include_directories(cassandra PRIVATE ${INCLUDE_DIRS})
155+
target_include_directories(cassandra PRIVATE ${INCLUDE_DIRS} ${CASS_INCLUDES})
166156

167-
set_target_properties(cassandra PROPERTIES OUTPUT_NAME cassandra)
168-
set_target_properties(cassandra PROPERTIES VERSION ${PROJECT_VERSION_STRING} SOVERSION ${PROJECT_VERSION_MAJOR})
169-
@@ -168,10 +201,9 @@ if(CASS_BUILD_STATIC)
157+
@@ -168,8 +192,7 @@ if(CASS_BUILD_STATIC)
170158
${SOURCES}
171159
$<TARGET_OBJECTS:curl_hostcheck_static>
172160
$<TARGET_OBJECTS:hdr_histogram_static>
173161
- $<TARGET_OBJECTS:http-parser_static>
174162
- $<TARGET_OBJECTS:minizip_static>)
175163
+ )
176164
target_link_libraries(cassandra_static ${CASS_LIBS})
177-
- target_include_directories(cassandra_static PRIVATE ${INCLUDE_DIRS} ${CASS_INCLUDES})
178-
+ target_include_directories(cassandra_static PRIVATE ${INCLUDE_DIRS})
165+
target_include_directories(cassandra_static PRIVATE ${INCLUDE_DIRS} ${CASS_INCLUDES})
179166

180-
set_target_properties(cassandra_static PROPERTIES OUTPUT_NAME cassandra_static)
181-
set_target_properties(cassandra_static PROPERTIES VERSION ${PROJECT_VERSION_STRING} SOVERSION ${PROJECT_VERSION_MAJOR})
182-
@@ -274,11 +306,6 @@ if(CASS_BUILD_SHARED)
167+
@@ -274,11 +297,6 @@ if(CASS_BUILD_SHARED)
183168
endif()
184169
endif()
185170
endif()
@@ -191,4 +176,3 @@ index 06b84b7..c0bce58 100644
191176
endif()
192177

193178
if(CASS_BUILD_STATIC)
194-
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
diff --git a/src/third_party/sparsehash/src/sparsehash/internal/hashtable-common.h b/src/third_party/sparsehash/src/sparsehash/internal/hashtable-common.h
2+
index bac2b88..e802b5c 100644
3+
--- a/src/third_party/sparsehash/src/sparsehash/internal/hashtable-common.h
4+
+++ b/src/third_party/sparsehash/src/sparsehash/internal/hashtable-common.h
5+
@@ -50,8 +50,13 @@
6+
_START_GOOGLE_NAMESPACE_
7+
8+
template <bool> struct SparsehashCompileAssert { };
9+
+#if defined(_MSC_VER)
10+
+#define SPARSEHASH_COMPILE_ASSERT(expr, msg) \
11+
+ typedef SparsehashCompileAssert<(bool(expr))> msg[bool(expr) ? 1 : -1]
12+
+#else
13+
#define SPARSEHASH_COMPILE_ASSERT(expr, msg) \
14+
__attribute__((unused)) typedef SparsehashCompileAssert<(bool(expr))> msg[bool(expr) ? 1 : -1]
15+
+#endif
16+
17+
namespace sparsehash_internal {
18+

recipes/cassandra-cpp-driver/all/patches/2.16.2/fix-cmake.patch

Lines changed: 17 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -62,22 +62,13 @@ index 9052472..4701133 100644
6262
+find_package(minizip REQUIRED CONFIG)
6363
+set(CASS_LIBS ${CASS_LIBS} minizip::minizip)
6464
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
65-
index d662718..14f6459 100644
65+
index d662718..088a153 100644
6666
--- a/src/CMakeLists.txt
6767
+++ b/src/CMakeLists.txt
68-
@@ -1,6 +1,51 @@
68+
@@ -1,6 +1,42 @@
6969
include(CheckSymbolExists)
7070
include(CheckCXXSourceCompiles)
7171

72-
+#------------------------
73-
+# Windows libraries
74-
+#------------------------
75-
+
76-
+if(WIN32)
77-
+ # Assign additional library requirements for Windows
78-
+ set(CASS_LIBS iphlpapi psapi wsock32 crypt32 ws2_32 userenv version)
79-
+endif()
80-
+
8172
+#------------------------
8273
+# Libuv
8374
+#------------------------
@@ -117,7 +108,7 @@ index d662718..14f6459 100644
117108
file(GLOB SOURCES *.cpp *.hpp)
118109

119110
if(APPLE)
120-
@@ -38,18 +83,14 @@ endif()
111+
@@ -38,18 +74,14 @@ endif()
121112

122113
add_subdirectory(third_party/curl)
123114
add_subdirectory(third_party/hdr_histogram)
@@ -141,7 +132,7 @@ index d662718..14f6459 100644
141132

142133
list(APPEND INCLUDE_DIRS ${CASS_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
143134

144-
@@ -69,13 +110,6 @@ if(WIN32)
135+
@@ -69,13 +101,6 @@ if(WIN32)
145136
endif()
146137
endif()
147138

@@ -155,33 +146,35 @@ index d662718..14f6459 100644
155146
#------------------------------
156147
# Build configured header
157148
#------------------------------
158-
@@ -132,10 +166,9 @@ if(CASS_BUILD_SHARED)
149+
@@ -122,7 +147,6 @@ configure_file(
150+
${CASS_ROOT_DIR}/driver_config.hpp.in
151+
${CMAKE_CURRENT_SOURCE_DIR}/driver_config.hpp)
152+
153+
-
154+
#------------------------------
155+
# Targets
156+
#------------------------------
157+
@@ -132,8 +156,7 @@ if(CASS_BUILD_SHARED)
159158
${SOURCES}
160159
$<TARGET_OBJECTS:curl_hostcheck>
161160
$<TARGET_OBJECTS:hdr_histogram>
162161
- $<TARGET_OBJECTS:http-parser>
163162
- $<TARGET_OBJECTS:minizip>)
164163
+ )
165164
target_link_libraries(cassandra ${CASS_LIBS})
166-
- target_include_directories(cassandra PRIVATE ${INCLUDE_DIRS} ${CASS_INCLUDES})
167-
+ target_include_directories(cassandra PRIVATE ${INCLUDE_DIRS})
165+
target_include_directories(cassandra PRIVATE ${INCLUDE_DIRS} ${CASS_INCLUDES})
168166

169-
set_target_properties(cassandra PROPERTIES OUTPUT_NAME cassandra)
170-
set_target_properties(cassandra PROPERTIES VERSION ${PROJECT_VERSION_STRING} SOVERSION ${PROJECT_VERSION_MAJOR})
171-
@@ -169,10 +202,9 @@ if(CASS_BUILD_STATIC)
167+
@@ -169,8 +192,7 @@ if(CASS_BUILD_STATIC)
172168
${SOURCES}
173169
$<TARGET_OBJECTS:curl_hostcheck_static>
174170
$<TARGET_OBJECTS:hdr_histogram_static>
175171
- $<TARGET_OBJECTS:http-parser_static>
176172
- $<TARGET_OBJECTS:minizip_static>)
177173
+ )
178174
target_link_libraries(cassandra_static ${CASS_LIBS})
179-
- target_include_directories(cassandra_static PRIVATE ${INCLUDE_DIRS} ${CASS_INCLUDES})
180-
+ target_include_directories(cassandra_static PRIVATE ${INCLUDE_DIRS})
175+
target_include_directories(cassandra_static PRIVATE ${INCLUDE_DIRS} ${CASS_INCLUDES})
181176

182-
set_target_properties(cassandra_static PROPERTIES OUTPUT_NAME cassandra_static)
183-
set_target_properties(cassandra_static PROPERTIES VERSION ${PROJECT_VERSION_STRING} SOVERSION ${PROJECT_VERSION_MAJOR})
184-
@@ -275,11 +307,6 @@ if(CASS_BUILD_SHARED)
177+
@@ -275,11 +297,6 @@ if(CASS_BUILD_SHARED)
185178
endif()
186179
endif()
187180
endif()

0 commit comments

Comments
 (0)