forked from snowflakedb/libsnowflakeclient
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
539 lines (511 loc) · 29.3 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
# Copyright (c) 2018-2019 Snowflake Computing, Inc. All rights reserved.
#
# CMakeList for Snowflake Client
#
cmake_minimum_required(VERSION 2.8)
project(snowflakeclient)
if (CLIENT_CODE_COVERAGE) # Only when code coverage is enabled
# set(CMAKE_CXX_OUTPUT_EXTENSION_REPLACE 1)
message("Code coverage is enabled CLIENT_CODE_COVERAGE=" ${CLIENT_CODE_COVERAGE})
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --coverage -fprofile-arcs -ftest-coverage -O0")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage -fprofile-arcs -ftest-coverage -O0 -fno-elide-constructors -fno-inline -fno-inline-small-functions -fno-default-inline")
else()
message("Code coverage is disabled CLIENT_CODE_COVERAGE=" ${CLIENT_CODE_COVERAGE})
endif ()
# Enabling tests by Ctest. Don't use INCLUDE(Ctest) as
# we don't need Dart and other tools.
enable_testing()
add_definitions(-DLOG_USE_COLOR)
option(BUILD_TESTS "True if build tests" on)
option(MOCK "True if mock should be used" off)
set(OPENSSL_VERSION_NUMBER 0x11100000L)
# Developers can uncomment this to enable mock builds on their local VMs
#set(MOCK TRUE)
# Generates compile_commands.json file for clangd to parse.
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
if (MOCK)
set(MOCK_OBJECT_WRAPPER_FLAGS -Wl,--wrap=http_perform)
add_definitions(-DMOCK_ENABLED)
else()
set(MOCK_OBJECT_WRAPPER_FLAGS )
endif ()
if (UNIX AND NOT APPLE)
set(LINUX TRUE)
endif ()
if (LINUX)
set(PLATFORM linux)
message("Platform: Linux")
endif ()
if (APPLE)
set(PLATFORM darwin)
message("Platform: Apple OSX")
endif ()
if ("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64")
set(PLATFORM win64)
message("Platform: Windows 64bit")
endif ()
if ("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32")
set(PLATFORM win32)
message("Platform: Windows 32bit")
if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
set (WIN32_DEBUG ON)
message("WIN32_DEBUG: ${WIN32_DEBUG}")
endif ()
endif ()
set(CMAKE_VERBOSE_MAKEFILE ON)
if (UNIX)
# Linux and OSX
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -std=gnu99 -g -fPIC -Werror -Wno-error=deprecated-declarations -D_LARGEFILE64_SOURCE ${MOCK_OBJECT_WRAPPER_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -std=gnu++17 -fPIC -Werror -Wno-error=deprecated-declarations ${MOCK_OBJECT_WRAPPER_FLAGS}")
else()
# Windows
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /ZH:SHA_256 /guard:cf /Qspectre /sdl")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /ZH:SHA_256 /guard:cf /Qspectre /sdl")
if ($ENV{ARROW_FROM_SOURCE})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++17 /D_SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING")
endif ()
endif ()
if (LINUX)
# Linux. MacOS doesn't require pthread option
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread")
endif ()
if (LINUX)
# Profiler for Linux
if (NOT "$ENV{BUILD_WITH_PROFILE_OPTION}" STREQUAL "")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pg")
endif ()
# Code coverage for Linux
if (NOT "$ENV{BUILD_WITH_GCOV_OPTION}" STREQUAL "")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fprofile-arcs -ftest-coverage")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -gp -fprofile-arcs -ftest-coverage")
endif ()
endif ()
set(SOURCE_FILES
include/snowflake/basic_types.h
include/snowflake/client.h
include/snowflake/logger.h
include/snowflake/version.h
include/snowflake/platform.h
lib/client.c
lib/constants.h
lib/cJSON.h
lib/cJSON.c
lib/logger.c
lib/lib_common.h
lib/paramstore.c
lib/paramstore.h
lib/arraylist.h
lib/arraylist.c
lib/treemap.h
lib/treemap.c
lib/rbtree.h
lib/rbtree.c
lib/memory.h
lib/memory.c
lib/connection.h
lib/connection.c
lib/constants.h
lib/results.h
lib/results.c
lib/platform.c
lib/uuid4.c
lib/basic_types.c
lib/error.h
lib/error.c
lib/client_int.h
lib/chunk_downloader.h
lib/chunk_downloader.c
lib/mock_http_perform.h
lib/http_perform.c)
set (SOURCE_FILES_PUT_GET
cpp/EncryptionProvider.cpp
cpp/FileCompressionType.cpp
cpp/FileCompressionType.hpp
cpp/FileMetadata.hpp
cpp/FileMetadataInitializer.cpp
cpp/FileMetadataInitializer.hpp
cpp/FileTransferAgent.cpp
cpp/FileTransferAgent.hpp
cpp/FileTransferExecutionResult.cpp
cpp/FileTransferExecutionResult.hpp
cpp/IFileTransferAgent.cpp
cpp/IStorageClient.hpp
cpp/SnowflakeS3Client.hpp
cpp/SnowflakeS3Client.cpp
cpp/SnowflakeAzureClient.hpp
cpp/SnowflakeAzureClient.cpp
cpp/SnowflakeGCSClient.hpp
cpp/SnowflakeGCSClient.cpp
cpp/SnowflakeTransferException.cpp
cpp/StatementPutGet.hpp
cpp/StatementPutGet.cpp
cpp/StorageClientFactory.hpp
cpp/StorageClientFactory.cpp
cpp/RemoteStorageRequestOutcome.hpp
cpp/util/Base64.hpp
cpp/util/Base64.cpp
cpp/util/ByteArrayStreamBuf.cpp
cpp/util/ByteArrayStreamBuf.hpp
cpp/util/CompressionUtil.cpp
cpp/util/CompressionUtil.hpp
cpp/util/Proxy.cpp
cpp/util/ThreadPool.hpp
cpp/util/SnowflakeCommon.hpp
cpp/crypto/CryptoTypes.hpp
cpp/crypto/Cryptor.hpp
cpp/crypto/CipherContext.hpp
cpp/crypto/CipherContext.cpp
cpp/crypto/Cryptor.cpp
cpp/crypto/CipherStreamBuf.cpp
cpp/crypto/CipherStreamBuf.hpp
cpp/crypto/HashContext.cpp
cpp/crypto/HashContext.hpp
cpp/jwt/Jwt.cpp
cpp/jwt/Jwt.hpp
cpp/jwt/Signer.cpp
cpp/jwt/Signer.hpp
cpp/jwt/Util.cpp
cpp/jwt/Util.hpp
cpp/jwt/ClaimSet.hpp
cpp/jwt/ClaimSet.cpp
cpp/jwt/Header.cpp
cpp/jwt/Header.hpp
cpp/logger/ISFLogger.cpp
cpp/logger/SFAwsLogger.cpp
cpp/logger/SFAwsLogger.hpp
cpp/logger/SFLogger.cpp
cpp/logger/SFLogger.hpp
cpp/logger/SecretDetector.cpp
cpp/logger/SecretDetector.hpp
include/snowflake/IFileTransferAgent.hpp
include/snowflake/ISFLogger.hpp
include/snowflake/IStatementPutGet.hpp
include/snowflake/ITransferResult.hpp
include/snowflake/PutGetParseResponse.hpp
include/snowflake/SnowflakeTransferException.hpp
include/snowflake/IJwt.hpp
include/snowflake/IBase64.hpp
include/snowflake/Proxy.hpp
)
set(SOURCE_FILES_CPP_WRAPPER
include/snowflake/Connection.hpp
include/snowflake/Statement.hpp
include/snowflake/Column.hpp
include/snowflake/Param.hpp
include/snowflake/Exceptions.hpp
include/snowflake/jwtWrapper.h
include/snowflake/QueryContextCache.hpp
include/snowflake/BaseClasses.hpp
include/snowflake/SFURL.hpp
include/snowflake/CurlDesc.hpp
include/snowflake/CurlDescPool.hpp
cpp/lib/Exceptions.cpp
cpp/lib/Connection.cpp
cpp/lib/Statement.cpp
cpp/lib/Column.cpp
cpp/lib/ArrowChunkIterator.cpp
cpp/lib/ArrowChunkIterator.hpp
cpp/lib/DataConversion.cpp
cpp/lib/DataConversion.hpp
cpp/lib/QueryContextCache.cpp
cpp/lib/ClientQueryContextCache.cpp
cpp/lib/ClientQueryContextCache.hpp
cpp/lib/result_set.cpp
cpp/lib/result_set_arrow.cpp
cpp/lib/result_set_json.cpp
cpp/lib/ResultSet.cpp
cpp/lib/ResultSet.hpp
cpp/lib/ResultSetArrow.cpp
cpp/lib/ResultSetArrow.hpp
cpp/lib/ResultSetJson.cpp
cpp/lib/ResultSetJson.hpp
cpp/lib/Authenticator.cpp
cpp/lib/Authenticator.hpp
cpp/jwt/jwtWrapper.cpp
cpp/util/SnowflakeCommon.cpp
cpp/util/SFURL.cpp
cpp/util/CurlDesc.cpp
cpp/util/CurlDescPool.cpp
lib/result_set.h
lib/result_set_arrow.h
lib/result_set_json.h
lib/query_context_cache.h
lib/curl_desc_pool.h
lib/authenticator.h)
if (UNIX)
if (LINUX)
set(AWSLIBBIT "lib64")
elseif(APPLE)
set(AWSLIBBIT "lib")
endif()
# Common to both Linux and Apple
find_library(OOB_LIB libtelemetry.a PATHS deps-build/${PLATFORM}/${CMAKE_BUILD_TYPE}/oob/lib/ REQUIRED NO_DEFAULT_PATH)
find_library(CURL_LIB libcurl.a PATHS deps-build/${PLATFORM}/${CMAKE_BUILD_TYPE}/curl/lib/ REQUIRED NO_DEFAULT_PATH)
find_library(SSL_LIB libssl.a PATHS deps-build/${PLATFORM}/${CMAKE_BUILD_TYPE}/openssl/lib/ REQUIRED NO_DEFAULT_PATH)
find_library(CRYPTO_LIB libcrypto.a PATHS deps-build/${PLATFORM}/${CMAKE_BUILD_TYPE}/openssl/lib/ REQUIRED NO_DEFAULT_PATH)
find_library(AWS_CORE_LIB libaws-cpp-sdk-core.a PATHS deps-build/${PLATFORM}/${CMAKE_BUILD_TYPE}/aws/${AWSLIBBIT}/ REQUIRED NO_DEFAULT_PATH)
find_library(AWS_S3_LIB libaws-cpp-sdk-s3.a PATHS deps-build/${PLATFORM}/${CMAKE_BUILD_TYPE}/aws/${AWSLIBBIT}/ REQUIRED NO_DEFAULT_PATH)
find_library(AWS_C_AUTH_LIB libaws-c-auth.a PATHS deps-build/${PLATFORM}/${CMAKE_BUILD_TYPE}/aws/${AWSLIBBIT}/ REQUIRED NO_DEFAULT_PATH)
find_library(AWS_C_CAL_LIB libaws-c-cal.a PATHS deps-build/${PLATFORM}/${CMAKE_BUILD_TYPE}/aws/${AWSLIBBIT}/ REQUIRED NO_DEFAULT_PATH)
find_library(AWS_C_COMMON_LIB libaws-c-common.a PATHS deps-build/${PLATFORM}/${CMAKE_BUILD_TYPE}/aws/${AWSLIBBIT}/ REQUIRED NO_DEFAULT_PATH)
find_library(AWS_C_COMPRESSION_LIB libaws-c-compression.a PATHS deps-build/${PLATFORM}/${CMAKE_BUILD_TYPE}/aws/${AWSLIBBIT}/ REQUIRED NO_DEFAULT_PATH)
find_library(AWS_C_EVENT_STREAM_LIB libaws-c-event-stream.a PATHS deps-build/${PLATFORM}/${CMAKE_BUILD_TYPE}/aws/${AWSLIBBIT}/ REQUIRED NO_DEFAULT_PATH)
find_library(AWS_C_CHECKSUMS_LIB libaws-checksums.a PATHS deps-build/${PLATFORM}/${CMAKE_BUILD_TYPE}/aws/${AWSLIBBIT}/ REQUIRED NO_DEFAULT_PATH)
find_library(AWS_C_HTTP_LIB libaws-c-http.a PATHS deps-build/${PLATFORM}/${CMAKE_BUILD_TYPE}/aws/${AWSLIBBIT}/ REQUIRED NO_DEFAULT_PATH)
find_library(AWS_C_IO_LIB libaws-c-io.a PATHS deps-build/${PLATFORM}/${CMAKE_BUILD_TYPE}/aws/${AWSLIBBIT}/ REQUIRED NO_DEFAULT_PATH)
find_library(AWS_C_MQTT_LIB libaws-c-mqtt.a PATHS deps-build/${PLATFORM}/${CMAKE_BUILD_TYPE}/aws/${AWSLIBBIT}/ REQUIRED NO_DEFAULT_PATH)
find_library(AWS_CRT_CPP_LIB libaws-crt-cpp.a PATHS deps-build/${PLATFORM}/${CMAKE_BUILD_TYPE}/aws/${AWSLIBBIT}/ REQUIRED NO_DEFAULT_PATH)
find_library(AWS_C_S3_LIB libaws-c-s3.a PATHS deps-build/${PLATFORM}/${CMAKE_BUILD_TYPE}/aws/${AWSLIBBIT}/ REQUIRED NO_DEFAULT_PATH)
find_library(AWS_C_SDKUTILS_LIB libaws-c-sdkutils.a PATHS deps-build/${PLATFORM}/${CMAKE_BUILD_TYPE}/aws/${AWSLIBBIT}/ REQUIRED NO_DEFAULT_PATH)
find_library(AZURE_STORAGE_LITE_LIB libazure-storage-lite.a PATHS deps-build/${PLATFORM}/${CMAKE_BUILD_TYPE}/azure/lib/ REQUIRED NO_DEFAULT_PATH)
find_library(BOOST_FILESYSTEM_LIB libboost_filesystem.a PATHS deps-build/${PLATFORM}/${CMAKE_BUILD_TYPE}/boost/lib/ REQUIRED NO_DEFAULT_PATH)
find_library(BOOST_REGEX_LIB libboost_regex.a PATHS deps-build/${PLATFORM}/${CMAKE_BUILD_TYPE}/boost/lib/ REQUIRED NO_DEFAULT_PATH)
find_library(BOOST_SYSTEM_LIB libboost_system.a PATHS deps-build/${PLATFORM}/${CMAKE_BUILD_TYPE}/boost/lib/ REQUIRED NO_DEFAULT_PATH)
find_library(ARROW_JEMALLOCPIC_LIB libjemalloc_pic.a PATHS deps-build/${PLATFORM}/${CMAKE_BUILD_TYPE}/arrow_deps/lib/ REQUIRED NO_DEFAULT_PATH)
if ($ENV{ARROW_FROM_SOURCE})
else()
find_library(ARROW_FLATBUFFERS_LIB libflatbuffers.a PATHS deps-build/${PLATFORM}/${CMAKE_BUILD_TYPE}/arrow_deps/lib/ REQUIRED NO_DEFAULT_PATH)
find_library(ARROW_GFLAGS_LIB libgflags.a PATHS deps-build/${PLATFORM}/${CMAKE_BUILD_TYPE}/arrow_deps/lib/ REQUIRED NO_DEFAULT_PATH)
find_library(ARROW_GLOG_LIB libglog.a PATHS deps-build/${PLATFORM}/${CMAKE_BUILD_TYPE}/arrow_deps/lib/ REQUIRED NO_DEFAULT_PATH)
find_library(ARROW_LZ4_LIB liblz4.a PATHS deps-build/${PLATFORM}/${CMAKE_BUILD_TYPE}/arrow_deps/lib/ REQUIRED NO_DEFAULT_PATH)
find_library(ARROW_LZO2_LIB liblzo2.a PATHS deps-build/${PLATFORM}/${CMAKE_BUILD_TYPE}/arrow_deps/lib/ REQUIRED NO_DEFAULT_PATH)
find_library(ARROW_SNAPPY_LIB libsnappy.a PATHS deps-build/${PLATFORM}/${CMAKE_BUILD_TYPE}/arrow_deps/lib/ REQUIRED NO_DEFAULT_PATH)
find_library(ARROW_ZSTD_LIB libzstd.a PATHS deps-build/${PLATFORM}/${CMAKE_BUILD_TYPE}/arrow_deps/lib/ REQUIRED NO_DEFAULT_PATH)
find_library(ARROW_BROTLIDEC_LIB libbrotlidec-static.a PATHS deps-build/${PLATFORM}/${CMAKE_BUILD_TYPE}/arrow_deps/lib/ REQUIRED NO_DEFAULT_PATH)
find_library(ARROW_BROTLIENC_LIB libbrotlienc-static.a PATHS deps-build/${PLATFORM}/${CMAKE_BUILD_TYPE}/arrow_deps/lib/ REQUIRED NO_DEFAULT_PATH)
find_library(ARROW_BROTLICOMMON_LIB libbrotlicommon-static.a PATHS deps-build/${PLATFORM}/${CMAKE_BUILD_TYPE}/arrow_deps/lib/ REQUIRED NO_DEFAULT_PATH)
endif ()
#if(MOCK)
find_library(CMOCKA_LIB libcmocka.a PATHS deps-build/${PLATFORM}/${CMAKE_BUILD_TYPE}/cmocka/lib/ REQUIRED NO_DEFAULT_PATH)
#endif()
endif()
if (LINUX)
# Linux
find_library(ARROW_ARROW_LIB libarrow.a PATHS deps-build/${PLATFORM}/${CMAKE_BUILD_TYPE}/arrow/lib64/ REQUIRED NO_DEFAULT_PATH)
find_library(UUID_LIB libuuid.a PATHS deps-build/${PLATFORM}/${CMAKE_BUILD_TYPE}/uuid/lib/ REQUIRED NO_DEFAULT_PATH)
find_library(AWS_S2N_LIB libs2n.a PATHS deps-build/${PLATFORM}/${CMAKE_BUILD_TYPE}/aws/lib64/ REQUIRED NO_DEFAULT_PATH)
#if(MOCK)
find_library(CMOCKA_LIB libcmocka.a PATHS deps-build/${PLATFORM}/${CMAKE_BUILD_TYPE}/cmocka/lib/ REQUIRED NO_DEFAULT_PATH)
#endif()
endif ()
if (APPLE)
# macOS
if(ENV{ARCH} STREQUAL "x64")
find_library(ARROW_ARROW_LIB libarrow.a PATHS deps-build/${PLATFORM}/${CMAKE_BUILD_TYPE}/arrow/lib64/ REQUIRED NO_DEFAULT_PATH)
else()
find_library(ARROW_ARROW_LIB libarrow.a PATHS deps-build/${PLATFORM}/${CMAKE_BUILD_TYPE}/arrow/lib/ REQUIRED NO_DEFAULT_PATH)
endif()
endif ()
if (WIN32)
# Windows
option(DYNAMIC_RUNTIME "Dynamic runtime" OFF)
set(VSDIR "vs15" CACHE STRING "Used to specify visual studio version of libsnowflakeclient dependecies")
add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
find_library(OOB_LIB libtelemetry_a.lib PATHS deps-build/${PLATFORM}/${VSDIR}/${CMAKE_BUILD_TYPE}/oob/lib/ REQUIRED NO_DEFAULT_PATH)
find_library(CURL_LIB libcurl_a.lib PATHS deps-build/${PLATFORM}/${VSDIR}/${CMAKE_BUILD_TYPE}/curl/lib/ REQUIRED NO_DEFAULT_PATH)
find_library(SSL_LIB libssl_a.lib PATHS deps-build/${PLATFORM}/${VSDIR}/${CMAKE_BUILD_TYPE}/openssl/lib/ REQUIRED NO_DEFAULT_PATH)
find_library(CRYPTO_LIB libcrypto_a.lib PATHS deps-build/${PLATFORM}/${VSDIR}/${CMAKE_BUILD_TYPE}/openssl/lib/ REQUIRED NO_DEFAULT_PATH)
find_library(ZLIB_LIB zlib_a.lib PATHS deps-build/${PLATFORM}/${VSDIR}/${CMAKE_BUILD_TYPE}/zlib/lib/ REQUIRED NO_DEFAULT_PATH)
find_library(AWS_CORE_LIB aws-cpp-sdk-core.lib PATHS deps-build/${PLATFORM}/${VSDIR}/${CMAKE_BUILD_TYPE}/aws/lib/ REQUIRED NO_DEFAULT_PATH)
find_library(AWS_S3_LIB aws-cpp-sdk-s3.lib PATHS deps-build/${PLATFORM}/${VSDIR}/${CMAKE_BUILD_TYPE}/aws/lib/ REQUIRED NO_DEFAULT_PATH)
find_library(AWS_C_AUTH_LIB aws-c-auth.lib PATHS deps-build/${PLATFORM}/${VSDIR}/${CMAKE_BUILD_TYPE}/aws/lib/ REQUIRED NO_DEFAULT_PATH)
find_library(AWS_C_CAL_LIB aws-c-cal.lib PATHS deps-build/${PLATFORM}/${VSDIR}/${CMAKE_BUILD_TYPE}/aws/lib/ REQUIRED NO_DEFAULT_PATH)
find_library(AWS_C_COMMON_LIB aws-c-common.lib PATHS deps-build/${PLATFORM}/${VSDIR}/${CMAKE_BUILD_TYPE}/aws/lib/ REQUIRED NO_DEFAULT_PATH)
find_library(AWS_C_COMPRESSION_LIB aws-c-compression.lib PATHS deps-build/${PLATFORM}/${VSDIR}/${CMAKE_BUILD_TYPE}/aws/lib/ REQUIRED NO_DEFAULT_PATH)
find_library(AWS_C_EVENT_STREAM_LIB aws-c-event-stream.lib PATHS deps-build/${PLATFORM}/${VSDIR}/${CMAKE_BUILD_TYPE}/aws/lib/ REQUIRED NO_DEFAULT_PATH)
find_library(AWS_C_CHECKSUMS_LIB aws-checksums.lib PATHS deps-build/${PLATFORM}/${VSDIR}/${CMAKE_BUILD_TYPE}/aws/lib/ REQUIRED NO_DEFAULT_PATH)
find_library(AWS_C_HTTP_LIB aws-c-http.lib PATHS deps-build/${PLATFORM}/${VSDIR}/${CMAKE_BUILD_TYPE}/aws/lib/ REQUIRED NO_DEFAULT_PATH)
find_library(AWS_C_IO_LIB aws-c-io.lib PATHS deps-build/${PLATFORM}/${VSDIR}/${CMAKE_BUILD_TYPE}/aws/lib/ REQUIRED NO_DEFAULT_PATH)
find_library(AWS_C_MQTT_LIB aws-c-mqtt.lib PATHS deps-build/${PLATFORM}/${VSDIR}/${CMAKE_BUILD_TYPE}/aws/lib/ REQUIRED NO_DEFAULT_PATH)
find_library(AWS_CRT_CPP_LIB aws-crt-cpp.lib PATHS deps-build/${PLATFORM}/${VSDIR}/${CMAKE_BUILD_TYPE}/aws/lib/ REQUIRED NO_DEFAULT_PATH)
find_library(AWS_C_S3_LIB aws-c-s3.lib PATHS deps-build/${PLATFORM}/${VSDIR}/${CMAKE_BUILD_TYPE}/aws/lib/ REQUIRED NO_DEFAULT_PATH)
find_library(AWS_C_SDKUTILS_LIB aws-c-sdkutils.lib PATHS deps-build/${PLATFORM}/${VSDIR}/${CMAKE_BUILD_TYPE}/aws/lib/ REQUIRED NO_DEFAULT_PATH)
find_library(AZURE_STORAGE_LITE_LIB azure-storage-lite.lib PATHS deps-build/${PLATFORM}/${VSDIR}/${CMAKE_BUILD_TYPE}/azure/lib/ REQUIRED NO_DEFAULT_PATH)
if ($ENV{ARROW_FROM_SOURCE})
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DBOOST_ALL_NO_LIB")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBOOST_ALL_NO_LIB")
find_library(BOOST_FILESYSTEM_LIB libboost_filesystem.lib PATHS deps-build/${PLATFORM}/${VSDIR}/${CMAKE_BUILD_TYPE}/boost/lib/ REQUIRED NO_DEFAULT_PATH)
find_library(BOOST_REGEX_LIB libboost_regex.lib PATHS deps-build/${PLATFORM}/${VSDIR}/${CMAKE_BUILD_TYPE}/boost/lib/ REQUIRED NO_DEFAULT_PATH)
find_library(BOOST_SYSTEM_LIB libboost_system.lib PATHS deps-build/${PLATFORM}/${VSDIR}/${CMAKE_BUILD_TYPE}/boost/lib/ REQUIRED NO_DEFAULT_PATH)
else()
if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
find_library(BOOST_FILESYSTEM_LIB boost_filesystem-vc140-mt-gd.lib PATHS deps-build/${PLATFORM}/${VSDIR}/${CMAKE_BUILD_TYPE}/boost/lib/ REQUIRED NO_DEFAULT_PATH)
find_library(BOOST_REGEX_LIB boost_regex-vc140-mt-gd.lib PATHS deps-build/${PLATFORM}/${VSDIR}/${CMAKE_BUILD_TYPE}/boost/lib/ REQUIRED NO_DEFAULT_PATH)
find_library(BOOST_SYSTEM_LIB boost_system-vc140-mt-gd.lib PATHS deps-build/${PLATFORM}/${VSDIR}/${CMAKE_BUILD_TYPE}/boost/lib/ REQUIRED NO_DEFAULT_PATH)
else()
find_library(BOOST_FILESYSTEM_LIB boost_filesystem-vc140-mt.lib PATHS deps-build/${PLATFORM}/${VSDIR}/${CMAKE_BUILD_TYPE}/boost/lib/ REQUIRED NO_DEFAULT_PATH)
find_library(BOOST_REGEX_LIB boost_regex-vc140-mt.lib PATHS deps-build/${PLATFORM}/${VSDIR}/${CMAKE_BUILD_TYPE}/boost/lib/ REQUIRED NO_DEFAULT_PATH)
find_library(BOOST_SYSTEM_LIB boost_system-vc140-mt.lib PATHS deps-build/${PLATFORM}/${VSDIR}/${CMAKE_BUILD_TYPE}/boost/lib/ REQUIRED NO_DEFAULT_PATH)
endif()
endif()
# No arrow on Win-32bit
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
if ($ENV{ARROW_FROM_SOURCE})
find_library(ARROW_ARROW_LIB arrow_static.lib PATHS deps-build/${PLATFORM}/${VSDIR}/${CMAKE_BUILD_TYPE}/arrow/lib/ REQUIRED NO_DEFAULT_PATH)
else()
find_library(ARROW_ARROW_LIB arrow.lib PATHS deps-build/${PLATFORM}/${VSDIR}/${CMAKE_BUILD_TYPE}/arrow/lib/ REQUIRED NO_DEFAULT_PATH)
# The following file names differ based on build type
if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
find_library(ARROW_BZ2_LIB bz2d.lib PATHS deps-build/${PLATFORM}/${VSDIR}/${CMAKE_BUILD_TYPE}/arrow_deps/lib/ REQUIRED NO_DEFAULT_PATH)
find_library(ARROW_GFLAGS_LIB gflags_static_debug.lib PATHS deps-build/${PLATFORM}/${VSDIR}/${CMAKE_BUILD_TYPE}/arrow_deps/lib/ REQUIRED NO_DEFAULT_PATH)
find_library(ARROW_LZ4_LIB lz4d.lib PATHS deps-build/${PLATFORM}/${VSDIR}/${CMAKE_BUILD_TYPE}/arrow_deps/lib/ REQUIRED NO_DEFAULT_PATH)
find_library(ARROW_SNAPPY_LIB snappyd.lib PATHS deps-build/${PLATFORM}/${VSDIR}/${CMAKE_BUILD_TYPE}/arrow_deps/lib/ REQUIRED NO_DEFAULT_PATH)
find_library(ARROW_ZLIB_LIB zlibd.lib PATHS deps-build/${PLATFORM}/${VSDIR}/${CMAKE_BUILD_TYPE}/arrow_deps/lib/ REQUIRED NO_DEFAULT_PATH)
find_library(ARROW_ZSTD_LIB zstdd.lib PATHS deps-build/${PLATFORM}/${VSDIR}/${CMAKE_BUILD_TYPE}/arrow_deps/lib/ REQUIRED NO_DEFAULT_PATH)
else()
find_library(ARROW_BZ2_LIB bz2.lib PATHS deps-build/${PLATFORM}/${VSDIR}/${CMAKE_BUILD_TYPE}/arrow_deps/lib/ REQUIRED NO_DEFAULT_PATH)
find_library(ARROW_GFLAGS_LIB gflags_static.lib PATHS deps-build/${PLATFORM}/${VSDIR}/${CMAKE_BUILD_TYPE}/arrow_deps/lib/ REQUIRED NO_DEFAULT_PATH)
find_library(ARROW_LZ4_LIB lz4.lib PATHS deps-build/${PLATFORM}/${VSDIR}/${CMAKE_BUILD_TYPE}/arrow_deps/lib/ REQUIRED NO_DEFAULT_PATH)
find_library(ARROW_SNAPPY_LIB snappy.lib PATHS deps-build/${PLATFORM}/${VSDIR}/${CMAKE_BUILD_TYPE}/arrow_deps/lib/ REQUIRED NO_DEFAULT_PATH)
find_library(ARROW_ZLIB_LIB zlib.lib PATHS deps-build/${PLATFORM}/${VSDIR}/${CMAKE_BUILD_TYPE}/arrow_deps/lib/ REQUIRED NO_DEFAULT_PATH)
find_library(ARROW_ZSTD_LIB zstd.lib PATHS deps-build/${PLATFORM}/${VSDIR}/${CMAKE_BUILD_TYPE}/arrow_deps/lib/ REQUIRED NO_DEFAULT_PATH)
endif()
find_library(ARROW_BROTLICOMMON_LIB brotlicommon-static.lib PATHS deps-build/${PLATFORM}/${VSDIR}/${CMAKE_BUILD_TYPE}/arrow_deps/lib/ REQUIRED NO_DEFAULT_PATH)
find_library(ARROW_BROTLIDEC_LIB brotlidec-static.lib PATHS deps-build/${PLATFORM}/${VSDIR}/${CMAKE_BUILD_TYPE}/arrow_deps/lib/ REQUIRED NO_DEFAULT_PATH)
find_library(ARROW_BROTLIENC_LIB brotlienc-static.lib PATHS deps-build/${PLATFORM}/${VSDIR}/${CMAKE_BUILD_TYPE}/arrow_deps/lib/ REQUIRED NO_DEFAULT_PATH)
find_library(ARROW_DOUBLECONVERSION_LIB double-conversion.lib PATHS deps-build/${PLATFORM}/${VSDIR}/${CMAKE_BUILD_TYPE}/arrow_deps/lib/ REQUIRED NO_DEFAULT_PATH)
find_library(ARROW_EVENT_LIB event.lib PATHS deps-build/${PLATFORM}/${VSDIR}/${CMAKE_BUILD_TYPE}/arrow_deps/lib/ REQUIRED NO_DEFAULT_PATH)
find_library(ARROW_EVENTCORE_LIB event_core.lib PATHS deps-build/${PLATFORM}/${VSDIR}/${CMAKE_BUILD_TYPE}/arrow_deps/lib/ REQUIRED NO_DEFAULT_PATH)
find_library(ARROW_EVENTEXTRA_LIB event_extra.lib PATHS deps-build/${PLATFORM}/${VSDIR}/${CMAKE_BUILD_TYPE}/arrow_deps/lib/ REQUIRED NO_DEFAULT_PATH)
find_library(ARROW_FLATBUFFERS_LIB flatbuffers.lib PATHS deps-build/${PLATFORM}/${VSDIR}/${CMAKE_BUILD_TYPE}/arrow_deps/lib/ REQUIRED NO_DEFAULT_PATH)
find_library(ARROW_GLOG_LIB glog.lib PATHS deps-build/${PLATFORM}/${VSDIR}/${CMAKE_BUILD_TYPE}/arrow_deps/lib/ REQUIRED NO_DEFAULT_PATH)
endif()
endif()
if(MOCK)
find_library(CMOCKA_LIB cmocka_a.lib PATHS deps-build/${PLATFORM}/${VSDIR}/${CMAKE_BUILD_TYPE}/cmocka/lib/ REQUIRED NO_DEFAULT_PATH)
endif()
endif ()
if (LINUX)
include_directories(
deps-build/${PLATFORM}/${CMAKE_BUILD_TYPE}/oob/include
deps-build/${PLATFORM}/${CMAKE_BUILD_TYPE}/curl/include
deps-build/${PLATFORM}/${CMAKE_BUILD_TYPE}/openssl/include
deps-build/${PLATFORM}/${CMAKE_BUILD_TYPE}/zlib/include
deps-build/${PLATFORM}/${CMAKE_BUILD_TYPE}/boost/include
deps-build/${PLATFORM}/${CMAKE_BUILD_TYPE}/arrow/include
deps-build/${PLATFORM}/${CMAKE_BUILD_TYPE}/aws/include
deps-build/${PLATFORM}/${CMAKE_BUILD_TYPE}/azure/include
deps-build/${PLATFORM}/${CMAKE_BUILD_TYPE}/cmocka/include
deps-build/${PLATFORM}/${CMAKE_BUILD_TYPE}/uuid/include
include
lib)
endif()
if (APPLE)
include_directories(
deps-build/${PLATFORM}/${CMAKE_BUILD_TYPE}/oob/include
deps-build/${PLATFORM}/${CMAKE_BUILD_TYPE}/curl/include
deps-build/${PLATFORM}/${CMAKE_BUILD_TYPE}/openssl/include
deps-build/${PLATFORM}/${CMAKE_BUILD_TYPE}/zlib/include
deps-build/${PLATFORM}/${CMAKE_BUILD_TYPE}/boost/include
deps-build/${PLATFORM}/${CMAKE_BUILD_TYPE}/arrow/include
deps-build/${PLATFORM}/${CMAKE_BUILD_TYPE}/aws/include
deps-build/${PLATFORM}/${CMAKE_BUILD_TYPE}/azure/include
deps-build/${PLATFORM}/${CMAKE_BUILD_TYPE}/cmocka/include
include
lib)
endif()
if (WIN32)
include_directories(
deps-build/${PLATFORM}/${VSDIR}/${CMAKE_BUILD_TYPE}/oob/include
deps-build/${PLATFORM}/${VSDIR}/${CMAKE_BUILD_TYPE}/curl/include
deps-build/${PLATFORM}/${VSDIR}/${CMAKE_BUILD_TYPE}/openssl/include
deps-build/${PLATFORM}/${VSDIR}/${CMAKE_BUILD_TYPE}/zlib/include
deps-build/${PLATFORM}/${VSDIR}/${CMAKE_BUILD_TYPE}/boost/include
deps-build/${PLATFORM}/${VSDIR}/${CMAKE_BUILD_TYPE}/aws/include
deps-build/${PLATFORM}/${VSDIR}/${CMAKE_BUILD_TYPE}/azure/include
deps-build/${PLATFORM}/${VSDIR}/${CMAKE_BUILD_TYPE}/cmocka/include
include
lib)
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
include_directories(deps-build/${PLATFORM}/${VSDIR}/${CMAKE_BUILD_TYPE}/arrow/include)
endif ()
endif()
message("libtelemetry is located at " ${OOB_LIB})
message("libcurl is located at " ${CURL_LIB})
message("libssl is located at " ${SSL_LIB})
message("libcrypto is located at " ${CRYPTO_LIB})
message("libboost_regex is located at " ${BOOST_REGEX_LIB})
message("libarrow is located at " ${ARROW_ARROW_LIB})
message("libaws-cpp-sdk-core is located at " ${AWS_CORE_LIB})
message("libaws-cpp-sdk-s3 is located at " ${AWS_S3_LIB})
message("libazure-storage-lite.a is located at " ${AZURE_STORAGE_LITE_LIB})
if (LINUX)
message("libuuid is located at " ${UUID_LIB})
endif ()
if (MOCK)
message("libcmocka is located at " ${CMOCKA_LIB})
endif ()
add_library(snowflakeclient STATIC ${SOURCE_FILES} ${SOURCE_FILES_PUT_GET} ${SOURCE_FILES_CPP_WRAPPER})
set_target_properties(snowflakeclient PROPERTIES LINKER_LANGUAGE CXX)
set_property(TARGET snowflakeclient PROPERTY C_STANDARD 99)
#set (CMAKE_CXX_STANDARD 11)
if(LINUX)
link_directories(
"${CMAKE_CURRENT_SOURCE_DIR}/deps-build/${PLATFORM}/${CMAKE_BUILD_TYPE}/oob/lib"
"${CMAKE_CURRENT_SOURCE_DIR}/deps-build/${PLATFORM}/${CMAKE_BUILD_TYPE}/curl/lib"
"${CMAKE_CURRENT_SOURCE_DIR}/deps-build/${PLATFORM}/${CMAKE_BUILD_TYPE}/openssl/lib"
"${CMAKE_CURRENT_SOURCE_DIR}/deps-build/${PLATFORM}/${CMAKE_BUILD_TYPE}/zlib/lib"
"${CMAKE_CURRENT_SOURCE_DIR}/deps-build/${PLATFORM}/${CMAKE_BUILD_TYPE}/arrow/lib"
"${CMAKE_CURRENT_SOURCE_DIR}/deps-build/${PLATFORM}/${CMAKE_BUILD_TYPE}/arrow_deps/lib"
"${CMAKE_CURRENT_SOURCE_DIR}/deps-build/${PLATFORM}/${CMAKE_BUILD_TYPE}/aws/lib64"
"${CMAKE_CURRENT_SOURCE_DIR}/deps-build/${PLATFORM}/${CMAKE_BUILD_TYPE}/azure/lib"
"${CMAKE_CURRENT_SOURCE_DIR}/deps-build/${PLATFORM}/${CMAKE_BUILD_TYPE}/boost/lib"
"${CMAKE_CURRENT_SOURCE_DIR}/deps-build/${PLATFORM}/${CMAKE_BUILD_TYPE}/uuid/lib"
)
if(MOCK)
link_directories("${CMAKE_CURRENT_SOURCE_DIR}/deps-build/${PLATFORM}/${CMAKE_BUILD_TYPE}/cmocka/lib")
endif()
elseif(WIN32)
link_directories(
"${CMAKE_CURRENT_SOURCE_DIR}/deps-build/${PLATFORM}/${VSDIR}/${CMAKE_BUILD_TYPE}/oob/lib"
"${CMAKE_CURRENT_SOURCE_DIR}/deps-build/${PLATFORM}/${VSDIR}/${CMAKE_BUILD_TYPE}/curl/lib"
"${CMAKE_CURRENT_SOURCE_DIR}/deps-build/${PLATFORM}/${VSDIR}/${CMAKE_BUILD_TYPE}/openssl/lib"
"${CMAKE_CURRENT_SOURCE_DIR}/deps-build/${PLATFORM}/${VSDIR}/${CMAKE_BUILD_TYPE}/aws/lib"
)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
link_directories(
"${CMAKE_CURRENT_SOURCE_DIR}/deps-build/${PLATFORM}/${VSDIR}/${CMAKE_BUILD_TYPE}/arrow/lib"
"${CMAKE_CURRENT_SOURCE_DIR}/deps-build/${PLATFORM}/${VSDIR}/${CMAKE_BUILD_TYPE}/arrow_deps/lib"
"${CMAKE_CURRENT_SOURCE_DIR}/deps-build/${PLATFORM}/${VSDIR}/${CMAKE_BUILD_TYPE}/boost/lib"
)
endif()
if(MOCK)
link_directories("${CMAKE_CURRENT_SOURCE_DIR}/deps-build/${PLATFORM}/${VSDIR}/${CMAKE_BUILD_TYPE}/cmocka/lib")
endif()
elseif()
link_directories(
"${CMAKE_CURRENT_SOURCE_DIR}/deps-build/${PLATFORM}/${CMAKE_BUILD_TYPE}/oob/lib"
"${CMAKE_CURRENT_SOURCE_DIR}/deps-build/${PLATFORM}/${CMAKE_BUILD_TYPE}/curl/lib"
"${CMAKE_CURRENT_SOURCE_DIR}/deps-build/${PLATFORM}/${CMAKE_BUILD_TYPE}/openssl/lib"
"${CMAKE_CURRENT_SOURCE_DIR}/deps-build/${PLATFORM}/${CMAKE_BUILD_TYPE}/arrow/lib"
"${CMAKE_CURRENT_SOURCE_DIR}/deps-build/${PLATFORM}/${CMAKE_BUILD_TYPE}/arrow_deps/lib"
"${CMAKE_CURRENT_SOURCE_DIR}/deps-build/${PLATFORM}/${CMAKE_BUILD_TYPE}/azure/lib"
"${CMAKE_CURRENT_SOURCE_DIR}/deps-build/${PLATFORM}/${CMAKE_BUILD_TYPE}/boost/lib"
)
if(MOCK)
link_directories("${CMAKE_CURRENT_SOURCE_DIR}/deps-build/${PLATFORM}/${CMAKE_BUILD_TYPE}/cmocka/lib")
endif()
endif()
if (LINUX)
# Linux
target_link_libraries(snowflakeclient rt dl z)
endif ()
if (APPLE)
# OSX. no librt is required.
target_link_libraries(snowflakeclient dl z)
endif ()
if (WIN32)
# Windows
target_link_libraries(snowflakeclient)
if (DYNAMIC_RUNTIME)
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MD")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MDd")
else()
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd")
endif()
endif ()
add_subdirectory(examples)
if (BUILD_TESTS)
add_subdirectory(tests)
endif()