Skip to content

Commit 79b766b

Browse files
committed
CDRIVER-3274 reduce the required cmake version to build with zstd
1 parent 4d1cd82 commit 79b766b

File tree

4 files changed

+71
-40
lines changed

4 files changed

+71
-40
lines changed

.evergreen/config.yml

+34-10
Original file line numberDiff line numberDiff line change
@@ -244,9 +244,9 @@ functions:
244244
remote_file: ${project}/${build_variant}/${revision}/${version_id}/${build_id}/abi-compliance/compat_report.html
245245
bucket: mciuploads
246246
permissions: public-read
247-
local_files_include_filter: mongoc/abi-compliance/compat_reports/**/*.html
248-
content_type: text/html
249247
display_name: 'ABI Report:'
248+
content_type: text/html
249+
local_files_include_filter: mongoc/abi-compliance/compat_reports/**/*.html
250250
upload scan artifacts:
251251
- command: shell.exec
252252
type: test
@@ -11145,12 +11145,35 @@ tasks:
1114511145
AUTH: noauth
1114611146
COMPRESSORS: snappy
1114711147
SSL: nossl
11148+
- name: test-latest-server-compression-zstd
11149+
tags:
11150+
- compression
11151+
- latest
11152+
- zstd
11153+
depends_on:
11154+
name: debug-compile-compression-zstd
11155+
commands:
11156+
- func: fetch build
11157+
vars:
11158+
BUILD_NAME: debug-compile-compression-zstd
11159+
- func: bootstrap mongo-orchestration
11160+
vars:
11161+
AUTH: noauth
11162+
ORCHESTRATION_FILE: zstd
11163+
SSL: nossl
11164+
VERSION: latest
11165+
- func: run tests
11166+
vars:
11167+
AUTH: noauth
11168+
COMPRESSORS: zstd
11169+
SSL: nossl
1114811170
- name: test-latest-server-compression
1114911171
tags:
1115011172
- compression
1115111173
- latest
1115211174
- snappy
1115311175
- zlib
11176+
- zstd
1115411177
depends_on:
1115511178
name: debug-compile-compression
1115611179
commands:
@@ -11166,7 +11189,7 @@ tasks:
1116611189
- func: run tests
1116711190
vars:
1116811191
AUTH: noauth
11169-
COMPRESSORS: snappy,zlib
11192+
COMPRESSORS: snappy,zlib,zstd
1117011193
SSL: nossl
1117111194
- name: retry-true-latest-server
1117211195
depends_on:
@@ -11708,7 +11731,8 @@ buildvariants:
1170811731
CC: clang
1170911732
run_on: ubuntu1604-test
1171011733
tasks:
11711-
- .compression
11734+
- .compression !.zstd
11735+
- debug-compile-compression-zstd
1171211736
- debug-compile-scan-build
1171311737
- debug-compile-asan-clang
1171411738
- debug-compile-ubsan
@@ -11824,7 +11848,7 @@ buildvariants:
1182411848
CC: gcc
1182511849
run_on: ubuntu1604-test
1182611850
tasks:
11827-
- .compression
11851+
- .compression !.zstd
1182811852
- debug-compile-asan-gcc
1182911853
- debug-compile-coverage
1183011854
- debug-compile-nosrv
@@ -11851,7 +11875,7 @@ buildvariants:
1185111875
CC: clang
1185211876
run_on: macos-1012
1185311877
tasks:
11854-
- .compression !.snappy
11878+
- .compression !.snappy !.zstd
1185511879
- debug-compile-coverage
1185611880
- release-compile
1185711881
- debug-compile-nosasl-nossl
@@ -11908,7 +11932,7 @@ buildvariants:
1190811932
CC: Visual Studio 14 2015
1190911933
run_on: windows-64-vs2015-compile
1191011934
tasks:
11911-
- .compression !.snappy
11935+
- .compression !.snappy !.zstd
1191211936
- release-compile
1191311937
- debug-compile-nosasl-nossl
1191411938
- debug-compile-no-align
@@ -11927,7 +11951,7 @@ buildvariants:
1192711951
CC: Visual Studio 12 2013 Win64
1192811952
run_on: windows-64-vs2013-compile
1192911953
tasks:
11930-
- .compression !.snappy
11954+
- .compression !.snappy !.zstd
1193111955
- release-compile
1193211956
- debug-compile-nosasl-nossl
1193311957
- .debug-compile .winssl
@@ -11966,7 +11990,7 @@ buildvariants:
1196611990
CC: Visual Studio 10 2010 Win64
1196711991
run_on: windows-64-vs2010-compile
1196811992
tasks:
11969-
- .compression !.snappy
11993+
- .compression !.snappy !.zstd
1197011994
- release-compile
1197111995
- debug-compile-nosasl-nossl
1197211996
- debug-compile-rdtscp
@@ -12067,7 +12091,7 @@ buildvariants:
1206712091
CC: gcc
1206812092
run_on: ubuntu1604-arm64-large
1206912093
tasks:
12070-
- .compression !.snappy
12094+
- .compression !.snappy !.zstd
1207112095
- debug-compile-scan-build
1207212096
- debug-compile-coverage
1207312097
- debug-compile-no-align

build/evergreen_config_lib/tasks.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,7 @@ def to_dict(self):
491491

492492

493493
class CompressionTask(MatrixTask):
494-
axes = OD([('compression', ['zlib', 'snappy', 'compression'])]) # TODO: CDRIVER-3274 add "zstd"
494+
axes = OD([('compression', ['zlib', 'snappy', 'zstd', 'compression'])])
495495
name_prefix = 'test-latest-server'
496496

497497
def __init__(self, *args, **kwargs):
@@ -542,7 +542,7 @@ def _compressor_list(self):
542542
elif self.compression == 'zstd':
543543
return ['zstd']
544544
else:
545-
return ['snappy', 'zlib'] # TODO: CDRIVER-3247 add zstd
545+
return ['snappy', 'zlib', 'zstd']
546546

547547

548548
all_tasks = chain(all_tasks, CompressionTask.matrix())

build/evergreen_config_lib/variants.py

+8-7
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,8 @@ def android(abi):
190190
Variant('clang38ubuntu',
191191
'clang 3.8 (Ubuntu 16.04)',
192192
'ubuntu1604-test',
193-
['.compression',
193+
['.compression !.zstd',
194+
'debug-compile-compression-zstd',
194195
'debug-compile-scan-build',
195196
'debug-compile-asan-clang',
196197
'debug-compile-ubsan',
@@ -291,7 +292,7 @@ def android(abi):
291292
Variant('gcc54',
292293
'GCC 5.4 (Ubuntu 16.04)',
293294
'ubuntu1604-test',
294-
['.compression',
295+
['.compression !.zstd',
295296
'debug-compile-asan-gcc',
296297
'debug-compile-coverage',
297298
'debug-compile-nosrv',
@@ -316,7 +317,7 @@ def android(abi):
316317
Variant('darwin',
317318
'*Darwin, macOS (Apple LLVM)',
318319
'macos-1012',
319-
['.compression !.snappy',
320+
['.compression !.snappy !.zstd',
320321
'debug-compile-coverage',
321322
'release-compile',
322323
'debug-compile-nosasl-nossl',
@@ -369,7 +370,7 @@ def android(abi):
369370
Variant('windows-2015-32',
370371
'Windows (i386) (VS 2015)',
371372
'windows-64-vs2015-compile',
372-
['.compression !.snappy',
373+
['.compression !.snappy !.zstd',
373374
'release-compile',
374375
'debug-compile-nosasl-nossl',
375376
'debug-compile-no-align',
@@ -386,7 +387,7 @@ def android(abi):
386387
Variant('windows-2013',
387388
'Windows (VS 2013)',
388389
'windows-64-vs2013-compile',
389-
['.compression !.snappy',
390+
['.compression !.snappy !.zstd',
390391
'release-compile',
391392
'debug-compile-nosasl-nossl',
392393
'.debug-compile .winssl',
@@ -421,7 +422,7 @@ def android(abi):
421422
Variant('windows-2010',
422423
'Windows (VS 2010)',
423424
'windows-64-vs2010-compile',
424-
['.compression !.snappy',
425+
['.compression !.snappy !.zstd',
425426
'release-compile',
426427
'debug-compile-nosasl-nossl',
427428
'debug-compile-rdtscp',
@@ -510,7 +511,7 @@ def android(abi):
510511
Variant('arm-ubuntu1604',
511512
'*ARM (aarch64) (Ubuntu 16.04)',
512513
'ubuntu1604-arm64-large',
513-
['.compression !.snappy',
514+
['.compression !.snappy !.zstd',
514515
'debug-compile-scan-build',
515516
'debug-compile-coverage',
516517
'debug-compile-no-align',

src/libmongoc/CMakeLists.txt

+27-21
Original file line numberDiff line numberDiff line change
@@ -98,30 +98,36 @@ endif ()
9898

9999

100100
if (NOT ENABLE_ZSTD STREQUAL OFF)
101-
if (${CMAKE_VERSION} VERSION_LESS "3.12.0")
102-
if (ENABLE_ZSTD STREQUAL ON)
103-
message (FATAL_ERROR " zstd not supported on CMake versions less than 3.12")
101+
message (STATUS "Searching for compression library zstd")
102+
find_package(PkgConfig)
103+
pkg_check_modules (ZSTD libzstd)
104+
105+
if (NOT ZSTD_FOUND)
106+
if (ENABLE_ZSTD MATCHES "ON")
107+
message (FATAL_ERROR " Not found")
108+
else ()
109+
message (STATUS " Not found")
110+
endif ()
111+
# The compression format below this version isn't supported. See SERVER-43070
112+
elseif (${ZSTD_VERSION} VERSION_LESS "0.8.0")
113+
if (ENABLE_ZSTD MATCHES "ON")
114+
message (FATAL_ERROR "Detected zstd version ${ZSTD_VERSION} but version 0.8.0 required")
104115
else ()
105-
message (STATUS " zstd not support on CMake versions less than 3.12")
116+
message (STATUS "Detected zstd version ${ZSTD_VERSION} but version 0.8.0 required")
106117
endif ()
107118
else ()
108-
message (STATUS "Searching for compression library zstd")
109-
find_package(PkgConfig)
110-
pkg_check_modules (ZSTD libzstd)
111-
112-
if (NOT ZSTD_FOUND)
113-
if (ENABLE_ZSTD MATCHES "ON")
114-
message (FATAL_ERROR " Not found")
115-
else ()
116-
message (STATUS " Not found")
117-
endif ()
119+
message (STATUS " Found in ${ZSTD_INCLUDE_DIRS}")
120+
set (MONGOC_ENABLE_COMPRESSION 1)
121+
set (MONGOC_ENABLE_COMPRESSION_ZSTD 1)
122+
set (MONGOC_INTERNAL_INCLUDE_DIRS ${MONGOC_INTERNAL_INCLUDE_DIRS} ${ZSTD_INCLUDE_DIRS})
123+
124+
if (${CMAKE_VERSION} VERSION_LESS "3.12.0")
125+
link_directories(${ZSTD_LIBRARY_DIRS})
126+
set (MONGOC_ZSTD_LIBRARIES ${ZSTD_LIBRARIES})
118127
else ()
119-
message (STATUS " Found in ${ZSTD_INCLUDE_DIRS}")
120-
set (MONGOC_INTERNAL_INCLUDE_DIRS ${MONGOC_INTERNAL_INCLUDE_DIRS} ${ZSTD_INCLUDE_DIRS})
121-
set (MONGOC_ENABLE_COMPRESSION 1)
122-
set (MONGOC_ENABLE_COMPRESSION_ZSTD 1)
123-
endif()
124-
endif ()
128+
set (MONGOC_ZSTD_LIBRARIES ${ZSTD_LINK_LIBRARIES})
129+
endif ()
130+
endif()
125131
endif()
126132

127133
if (NOT ENABLE_SSL STREQUAL OFF)
@@ -629,7 +635,7 @@ endif ()
629635

630636
set (LIBRARIES
631637
${SASL_LIBRARIES} ${SSL_LIBRARIES} ${SHM_LIBRARIES} ${RESOLV_LIBRARIES}
632-
${SNAPPY_LIBRARIES} ${ZLIB_LIBRARIES} ${ZSTD_LINK_LIBRARIES} Threads::Threads ${ICU_LIBRARIES}
638+
${SNAPPY_LIBRARIES} ${ZLIB_LIBRARIES} ${MONGOC_ZSTD_LIBRARIES} Threads::Threads ${ICU_LIBRARIES}
633639
)
634640

635641
if (WIN32)

0 commit comments

Comments
 (0)