Merge pull request #960 from shawnl/dev

meson: support differn't legacy levels.
This commit is contained in:
Yann Collet 2017-12-22 07:07:52 +01:00 committed by GitHub
commit b7d0d96ac6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 13 deletions

View File

@ -38,21 +38,35 @@ libzstd_srcs = [
libzstd_includes = [include_directories(common_dir, dictbuilder_dir, compress_dir, lib_dir)] libzstd_includes = [include_directories(common_dir, dictbuilder_dir, compress_dir, lib_dir)]
if get_option('legacy_support') legacy = get_option('legacy_support')
message('Enabling legacy support') if legacy != 'false'
libzstd_cflags = ['-DZSTD_LEGACY_SUPPORT=4'] message('Enabling legacy support back to version 0.' + legacy)
legacy_int = legacy.to_int()
libzstd_cflags = ['-DZSTD_LEGACY_SUPPORT=' + legacy]
legacy_dir = join_paths(lib_dir, 'legacy') legacy_dir = join_paths(lib_dir, 'legacy')
libzstd_includes += [include_directories(legacy_dir)] libzstd_includes += [include_directories(legacy_dir)]
libzstd_srcs += [ if legacy_int <= 1
join_paths(legacy_dir, 'zstd_v01.c'), libzstd_srcs += join_paths(legacy_dir, 'zstd_v01.c')
join_paths(legacy_dir, 'zstd_v02.c'), endif
join_paths(legacy_dir, 'zstd_v03.c'), if legacy_int <= 2
join_paths(legacy_dir, 'zstd_v04.c'), libzstd_srcs += join_paths(legacy_dir, 'zstd_v02.c')
join_paths(legacy_dir, 'zstd_v05.c'), endif
join_paths(legacy_dir, 'zstd_v06.c'), if legacy_int <= 3
join_paths(legacy_dir, 'zstd_v07.c') libzstd_srcs += join_paths(legacy_dir, 'zstd_v03.c')
] endif
if legacy_int <= 4
libzstd_srcs += join_paths(legacy_dir, 'zstd_v04.c')
endif
if legacy_int <= 5
libzstd_srcs += join_paths(legacy_dir, 'zstd_v05.c')
endif
if legacy_int <= 6
libzstd_srcs += join_paths(legacy_dir, 'zstd_v06.c')
endif
if legacy_int <= 7
libzstd_srcs += join_paths(legacy_dir, 'zstd_v07.c')
endif
else else
libzstd_cflags = [] libzstd_cflags = []
endif endif

View File

@ -1,2 +1,2 @@
option('multithread', type: 'boolean', value: false) option('multithread', type: 'boolean', value: false)
option('legacy_support', type: 'boolean', value: false) option('legacy_support', type: 'string', value: '4')