From 70370d880fe31fc5d9beaf1e054ba5acd11a8e22 Mon Sep 17 00:00:00 2001 From: Lzu Tao Date: Fri, 16 Oct 2020 19:32:20 +0700 Subject: [PATCH 01/47] fix --- build/meson/lib/meson.build | 8 ++++++-- build/meson/programs/meson.build | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/build/meson/lib/meson.build b/build/meson/lib/meson.build index 17806c8dcc3..a0b9ba96272 100644 --- a/build/meson/lib/meson.build +++ b/build/meson/lib/meson.build @@ -77,8 +77,12 @@ endif libzstd_c_args = [] if cc_id == compiler_msvc if default_library_type != 'static' - libzstd_sources += [windows_mod.compile_resources( - join_paths(zstd_rootdir, 'build/VS2010/libzstd-dll/libzstd-dll.rc'))] + libzstd_sources += [ + windows_mod.compile_resources( + join_paths(zstd_rootdir, 'build/VS2010/libzstd-dll/libzstd-dll.rc'), + include_directories: include_directories(join_paths(zstd_rootdir, 'lib')), + ) + ] libzstd_c_args += ['-DZSTD_DLL_EXPORT=1', '-DZSTD_HEAPMODE=0', '-D_CONSOLE', diff --git a/build/meson/programs/meson.build b/build/meson/programs/meson.build index 363818f9d64..c156c6dc622 100644 --- a/build/meson/programs/meson.build +++ b/build/meson/programs/meson.build @@ -51,8 +51,12 @@ endif if cc_id == compiler_msvc if default_library_type != 'static' - zstd_programs_sources += [windows_mod.compile_resources( - join_paths(zstd_rootdir, 'build/VS2010/zstd/zstd.rc'))] + zstd_programs_sources += [ + windows_mod.compile_resources( + join_paths(zstd_rootdir, 'build/VS2010/zstd/zstd.rc'), + include_directories: include_directories(join_paths(zstd_rootdir, 'lib')), + ) + ] endif endif From 82a7b7505921999732bba1c99f5397a5472392db Mon Sep 17 00:00:00 2001 From: Lzu Tao Date: Fri, 16 Oct 2020 19:32:20 +0700 Subject: [PATCH 02/47] [dnm] test --- .github/workflows/generic-dev.yml | 215 ++++++-------------------- .github/workflows/generic-release.yml | 68 -------- .github/workflows/linux-kernel.yml | 13 -- .github/workflows/main.yml | 30 ---- 4 files changed, 44 insertions(+), 282 deletions(-) delete mode 100644 .github/workflows/generic-release.yml delete mode 100644 .github/workflows/linux-kernel.yml delete mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/generic-dev.yml b/.github/workflows/generic-dev.yml index c66a2bee3b1..dcbf14f09e0 100644 --- a/.github/workflows/generic-dev.yml +++ b/.github/workflows/generic-dev.yml @@ -22,184 +22,57 @@ jobs: # The master branch exclusive jobs will be in a separate # workflow file (the osx tests and meson build that is) - benchmarking: - runs-on: ubuntu-latest + meson-msvc: + name: 'Meson on Windows MSVC' + runs-on: windows-latest steps: - uses: actions/checkout@v2 - - name: make benchmarking - run: make benchmarking - test: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: make test - run: make test + # Some replacements: + # * https://renenyffenegger.ch/notes/Windows/development/Visual-Studio/environment-variables/index + # * https://github.com/microsoft/vswhere/wiki/Start-Developer-Command-Prompt + - uses: ilammy/msvc-dev-cmd@v1 - gcc-6-7-libzstd: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: gcc-6 + gcc-7 + libzstdmt compilation + - name: install meson run: | - make gcc6install gcc7install - CC=gcc-6 CFLAGS=-Werror make -j all - make clean - CC=gcc-7 CFLAGS=-Werror make -j all - make clean - LDFLAGS=-Wl,--no-undefined make -C lib libzstd-mt - make -C tests zbufftest-dll - - gcc-8-asan-ubsan-testzstd: - runs-on: ubuntu-16.04 # fails on 18.04 - steps: - - uses: actions/checkout@v2 - - name: gcc-8 + ASan + UBSan + Test Zstd + echo "$env:userprofile\AppData\Roaming\Python\Python37\Scripts" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 + pip install -U meson + + - run: | + git clone https://github.com/lzutao/lz4/ third-party\lz4 + cd third-party\lz4 + git switch std + meson setup ` + --buildtype=release ` + -Ddefault_library=shared ` + -Dprefix=C:\lz4 ` + contrib\meson builddir + cd builddir + meson compile + meson install + echo "PKG_CONFIG_PATH=C:\lz4\lib\pkgconfig" ` + | Out-File -Append -FilePath $env:GITHUB_ENV -Encoding utf8 + + - name: install zlib run: | - make gcc8install - CC=gcc-8 CFLAGS="-Werror" make -j all - make clean - CC=gcc-8 make -j uasan-test-zstd Date: Fri, 16 Oct 2020 19:41:27 +0700 Subject: [PATCH 03/47] prefer shared --- .github/workflows/generic-dev.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/generic-dev.yml b/.github/workflows/generic-dev.yml index dcbf14f09e0..8c24c4427a2 100644 --- a/.github/workflows/generic-dev.yml +++ b/.github/workflows/generic-dev.yml @@ -74,5 +74,6 @@ jobs: -Dauto_features=enabled ` -Dbin_programs=true ` -Dbin_contrib=true ` + -Ddefault_library=shared ` builddir meson compile -C builddir From b7bfbe01fba580c4cd73620216337d2b2d5d4033 Mon Sep 17 00:00:00 2001 From: Lzu Tao Date: Fri, 16 Oct 2020 20:24:17 +0700 Subject: [PATCH 04/47] /D --- build/meson/contrib/pzstd/meson.build | 10 ++++++- build/meson/lib/meson.build | 21 ++++++++++---- build/meson/meson.build | 6 +++- build/meson/programs/meson.build | 42 ++++++++++++++++++++++----- build/meson/tests/meson.build | 6 +++- 5 files changed, 69 insertions(+), 16 deletions(-) diff --git a/build/meson/contrib/pzstd/meson.build b/build/meson/contrib/pzstd/meson.build index 8f3822fd776..9639f3ccfb5 100644 --- a/build/meson/contrib/pzstd/meson.build +++ b/build/meson/contrib/pzstd/meson.build @@ -16,9 +16,17 @@ pzstd_sources = [join_paths(zstd_rootdir, 'programs/util.c'), join_paths(zstd_rootdir, 'contrib/pzstd/Options.cpp'), join_paths(zstd_rootdir, 'contrib/pzstd/Pzstd.cpp'), join_paths(zstd_rootdir, 'contrib/pzstd/SkippableFrame.cpp')] + +pzstd_cpp_args = [] +if [compiler_gcc, compiler_clang].contains(cc_id) + pzstd_cpp_args += [ '-DNDEBUG', '-Wno-shadow', '-pedantic' ] +else + pzstd_cpp_args += [ '/DNDEBUG' ] +endif + pzstd = executable('pzstd', pzstd_sources, - cpp_args: [ '-DNDEBUG', '-Wno-shadow', '-pedantic' ], + cpp_args: pzstd_cpp_args, include_directories: pzstd_includes, dependencies: [ libzstd_dep, thread_dep ], install: true) diff --git a/build/meson/lib/meson.build b/build/meson/lib/meson.build index a0b9ba96272..16d8189248a 100644 --- a/build/meson/lib/meson.build +++ b/build/meson/lib/meson.build @@ -70,7 +70,11 @@ endif libzstd_deps = [] if use_multi_thread message('Enable multi-threading support') - add_project_arguments('-DZSTD_MULTITHREAD', language: 'c') + if [compiler_gcc, compiler_clang].contains(cc_id) + add_project_arguments('-DZSTD_MULTITHREAD', language: 'c') + else + add_project_arguments('/DZSTD_MULTITHREAD', language: 'c') + endif libzstd_deps = [ thread_dep ] endif @@ -83,10 +87,10 @@ if cc_id == compiler_msvc include_directories: include_directories(join_paths(zstd_rootdir, 'lib')), ) ] - libzstd_c_args += ['-DZSTD_DLL_EXPORT=1', - '-DZSTD_HEAPMODE=0', - '-D_CONSOLE', - '-D_CRT_SECURE_NO_WARNINGS'] + libzstd_c_args += ['/DZSTD_DLL_EXPORT=1', + '/DZSTD_HEAPMODE=0', + '/D_CONSOLE', + '/D_CRT_SECURE_NO_WARNINGS'] else libzstd_c_args += ['-DZSTD_HEAPMODE=0', '-D_CRT_SECURE_NO_WARNINGS'] @@ -101,7 +105,12 @@ libzstd_c_args += mingw_ansi_stdio_flags libzstd_debug_cflags = [] if use_debug - libzstd_c_args += '-DDEBUGLEVEL=@0@'.format(debug_level) + if cc_id == compiler_msvc + libzstd_c_args += '/DDEBUGLEVEL=@0@'.format(debug_level) + else + libzstd_c_args += '-DDEBUGLEVEL=@0@'.format(debug_level) + endif + if cc_id == compiler_gcc or cc_id == compiler_clang libzstd_debug_cflags = ['-Wstrict-aliasing=1', '-Wswitch-enum', '-Wdeclaration-after-statement', '-Wstrict-prototypes', diff --git a/build/meson/meson.build b/build/meson/meson.build index 2a425b2fa39..3184b961cfe 100644 --- a/build/meson/meson.build +++ b/build/meson/meson.build @@ -103,7 +103,11 @@ use_lz4 = lz4_dep.found() # Compiler flags # ============================================================================= -add_project_arguments('-DXXH_NAMESPACE=ZSTD_', language: ['c']) +if [compiler_gcc, compiler_clang].contains(cc_id) + add_project_arguments('-DXXH_NAMESPACE=ZSTD_', language: ['c']) +else + add_project_arguments('/DXXH_NAMESPACE=ZSTD_', language: ['c']) +endif if [compiler_gcc, compiler_clang].contains(cc_id) common_warning_flags = [ '-Wextra', '-Wundef', '-Wshadow', '-Wcast-align', '-Wcast-qual' ] diff --git a/build/meson/programs/meson.build b/build/meson/programs/meson.build index c156c6dc622..a1ec5ccdc54 100644 --- a/build/meson/programs/meson.build +++ b/build/meson/programs/meson.build @@ -21,31 +21,55 @@ zstd_programs_sources = [join_paths(zstd_rootdir, 'programs/zstdcli.c'), zstd_c_args = libzstd_debug_cflags if use_multi_thread - zstd_c_args += [ '-DZSTD_MULTITHREAD' ] + if cc_id == compiler_msvc + zstd_c_args += [ '/DZSTD_MULTITHREAD' ] + else + zstd_c_args += [ '-DZSTD_MULTITHREAD' ] + endif endif zstd_deps = [ libzstd_dep ] if use_zlib zstd_deps += [ zlib_dep ] - zstd_c_args += [ '-DZSTD_GZCOMPRESS', '-DZSTD_GZDECOMPRESS' ] + if cc_id == compiler_msvc + zstd_c_args += [ '/DZSTD_GZCOMPRESS', '/DZSTD_GZDECOMPRESS' ] + else + zstd_c_args += [ '-DZSTD_GZCOMPRESS', '-DZSTD_GZDECOMPRESS' ] + endif endif if use_lzma zstd_deps += [ lzma_dep ] - zstd_c_args += [ '-DZSTD_LZMACOMPRESS', '-DZSTD_LZMADECOMPRESS' ] + if cc_id == compiler_msvc + zstd_c_args += [ '/DZSTD_LZMACOMPRESS', '/DZSTD_LZMADECOMPRESS' ] + else + zstd_c_args += [ '-DZSTD_LZMACOMPRESS', '-DZSTD_LZMADECOMPRESS' ] + endif endif if use_lz4 zstd_deps += [ lz4_dep ] - zstd_c_args += [ '-DZSTD_LZ4COMPRESS', '-DZSTD_LZ4DECOMPRESS' ] + if cc_id == compiler_msvc + zstd_c_args += [ '/DZSTD_LZ4COMPRESS', '/DZSTD_LZ4DECOMPRESS' ] + else + zstd_c_args += [ '-DZSTD_LZ4COMPRESS', '-DZSTD_LZ4DECOMPRESS' ] + endif endif export_dynamic_on_windows = false # explicit backtrace enable/disable for Linux & Darwin if not use_backtrace - zstd_c_args += '-DBACKTRACE_ENABLE=0' + if cc_id == compiler_msvc + zstd_c_args += [ '/DBACKTRACE_ENABLE=0' ] + else + zstd_c_args += '-DBACKTRACE_ENABLE=0' + endif elif use_debug and host_machine_os == os_windows # MinGW target - zstd_c_args += '-DBACKTRACE_ENABLE=1' + if cc_id == compiler_msvc + zstd_c_args += [ '/DDBACKTRACE_ENABLE=1' ] + else + zstd_c_args += '-DBACKTRACE_ENABLE=1' + endif export_dynamic_on_windows = true endif @@ -77,7 +101,11 @@ zstd_frugal_sources = [join_paths(zstd_rootdir, 'programs/zstdcli.c'), executable('zstd-frugal', zstd_frugal_sources, dependencies: libzstd_dep, - c_args: [ '-DZSTD_NOBENCH', '-DZSTD_NODICT' ], + c_args: if cc_id == compiler_msvc + [ '/DZSTD_NOBENCH', '/DZSTD_NODICT' ] + else + [ '-DZSTD_NOBENCH', '-DZSTD_NODICT' ] + endif, install: true) install_data(join_paths(zstd_rootdir, 'programs/zstdgrep'), diff --git a/build/meson/tests/meson.build b/build/meson/tests/meson.build index 0587f9a70d5..e3916bd00d7 100644 --- a/build/meson/tests/meson.build +++ b/build/meson/tests/meson.build @@ -33,7 +33,11 @@ datagen_sources = [join_paths(zstd_rootdir, 'programs/datagen.c'), join_paths(zstd_rootdir, 'tests/datagencli.c')] datagen = executable('datagen', datagen_sources, - c_args: [ '-DNDEBUG' ], + c_args: if cc_id == compiler_msvc + [ '/DNDEBUG' ] + else + [ '-DNDEBUG' ] + endif, include_directories: test_includes, dependencies: libzstd_dep, install: false) From f32d693b7c3f80f83c957c2b814c8ecea1b2538d Mon Sep 17 00:00:00 2001 From: Lzu Tao Date: Fri, 16 Oct 2020 20:24:17 +0700 Subject: [PATCH 05/47] /D --- build/meson/programs/meson.build | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/build/meson/programs/meson.build b/build/meson/programs/meson.build index a1ec5ccdc54..95706d2ddbb 100644 --- a/build/meson/programs/meson.build +++ b/build/meson/programs/meson.build @@ -98,14 +98,15 @@ zstd_frugal_sources = [join_paths(zstd_rootdir, 'programs/zstdcli.c'), # Minimal target, with only zstd compression and decompression. # No bench. No legacy. +if cc_id == compiler_msvc + zstd_frugal_c_args = [ '/DZSTD_NOBENCH', '/DZSTD_NODICT' ] +else + zstd_frugal_c_args = [ '-DZSTD_NOBENCH', '-DZSTD_NODICT' ] +endif executable('zstd-frugal', zstd_frugal_sources, dependencies: libzstd_dep, - c_args: if cc_id == compiler_msvc - [ '/DZSTD_NOBENCH', '/DZSTD_NODICT' ] - else - [ '-DZSTD_NOBENCH', '-DZSTD_NODICT' ] - endif, + c_args: zstd_frugal_c_args, install: true) install_data(join_paths(zstd_rootdir, 'programs/zstdgrep'), From d0e1a71945882b3b390c2c589d74198b72242f11 Mon Sep 17 00:00:00 2001 From: Lzu Tao Date: Fri, 16 Oct 2020 20:24:17 +0700 Subject: [PATCH 06/47] /D --- build/meson/tests/meson.build | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/build/meson/tests/meson.build b/build/meson/tests/meson.build index e3916bd00d7..0b68fd005f1 100644 --- a/build/meson/tests/meson.build +++ b/build/meson/tests/meson.build @@ -31,13 +31,14 @@ test_includes = [ include_directories(join_paths(zstd_rootdir, 'programs')) ] datagen_sources = [join_paths(zstd_rootdir, 'programs/datagen.c'), join_paths(zstd_rootdir, 'tests/datagencli.c')] +if cc_id == compiler_msvc + datagen_c_args = [ '/DNDEBUG' ] +else + datagen_c_args = [ '-DNDEBUG' ] +endif datagen = executable('datagen', datagen_sources, - c_args: if cc_id == compiler_msvc - [ '/DNDEBUG' ] - else - [ '-DNDEBUG' ] - endif, + c_args: datagen_c_args, include_directories: test_includes, dependencies: libzstd_dep, install: false) From c9c555234f4cade32af4839855526624c04e509c Mon Sep 17 00:00:00 2001 From: Lzu Tao Date: Fri, 16 Oct 2020 20:40:54 +0700 Subject: [PATCH 07/47] meson -D --- .github/workflows/generic-dev.yml | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/.github/workflows/generic-dev.yml b/.github/workflows/generic-dev.yml index 8c24c4427a2..5af6eac4966 100644 --- a/.github/workflows/generic-dev.yml +++ b/.github/workflows/generic-dev.yml @@ -35,7 +35,6 @@ jobs: - name: install meson run: | - echo "$env:userprofile\AppData\Roaming\Python\Python37\Scripts" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 pip install -U meson - run: | @@ -50,20 +49,15 @@ jobs: cd builddir meson compile meson install - echo "PKG_CONFIG_PATH=C:\lz4\lib\pkgconfig" ` - | Out-File -Append -FilePath $env:GITHUB_ENV -Encoding utf8 - name: install zlib run: | vcpkg install --triplet x64-windows zlib - echo "PKG_CONFIG_PATH=C:\vcpkg\packages\zlib_x64-windows\lib\pkgconfig;$env:PKG_CONFIG_PATH" ` - | Out-File -Append -FilePath $env:GITHUB_ENV -Encoding utf8 - name: install liblzma run: | vcpkg install --triplet x64-windows liblzma - echo "CPPFLAGS=-IC:\vcpkg\packages\liblzma_x64-windows\include $env:CPPFLAGS" ` - | Out-File -Append -FilePath $env:GITHUB_ENV -Encoding utf8 + Tree C:\vcpkg\packages\liblzma_x64-windows /F - name: test run: | @@ -75,5 +69,7 @@ jobs: -Dbin_programs=true ` -Dbin_contrib=true ` -Ddefault_library=shared ` + -Dpkg_config_path=C:\lz4\lib\pkgconfig;C:\vcpkg\packages\zlib_x64-windows\lib\pkgconfig ` + -Dcmake_prefix_path=C:\vcpkg\packages\liblzma_x64-windows\share\cmake ` builddir meson compile -C builddir From ec5852bb00d20018b5d7cddfba590ddd9fcb9877 Mon Sep 17 00:00:00 2001 From: Lzu Tao Date: Fri, 16 Oct 2020 20:40:54 +0700 Subject: [PATCH 08/47] meson -D --- .github/workflows/generic-dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/generic-dev.yml b/.github/workflows/generic-dev.yml index 5af6eac4966..e1dead41220 100644 --- a/.github/workflows/generic-dev.yml +++ b/.github/workflows/generic-dev.yml @@ -70,6 +70,6 @@ jobs: -Dbin_contrib=true ` -Ddefault_library=shared ` -Dpkg_config_path=C:\lz4\lib\pkgconfig;C:\vcpkg\packages\zlib_x64-windows\lib\pkgconfig ` - -Dcmake_prefix_path=C:\vcpkg\packages\liblzma_x64-windows\share\cmake ` + -Dcmake_prefix_path=C:\vcpkg\packages\liblzma_x64-windows\share\liblzma ` builddir meson compile -C builddir From 71b22ceca747154ffc5c4ae6e390289e60387330 Mon Sep 17 00:00:00 2001 From: Lzu Tao Date: Fri, 16 Oct 2020 20:40:54 +0700 Subject: [PATCH 09/47] meson -D --- .github/workflows/generic-dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/generic-dev.yml b/.github/workflows/generic-dev.yml index e1dead41220..6311590f7cb 100644 --- a/.github/workflows/generic-dev.yml +++ b/.github/workflows/generic-dev.yml @@ -69,7 +69,7 @@ jobs: -Dbin_programs=true ` -Dbin_contrib=true ` -Ddefault_library=shared ` - -Dpkg_config_path=C:\lz4\lib\pkgconfig;C:\vcpkg\packages\zlib_x64-windows\lib\pkgconfig ` + -Dpkg_config_path="C:\lz4\lib\pkgconfig;C:\vcpkg\packages\zlib_x64-windows\lib\pkgconfig" ` -Dcmake_prefix_path=C:\vcpkg\packages\liblzma_x64-windows\share\liblzma ` builddir meson compile -C builddir From c916fc4400b889433e859ecd2e4d07e2ad845d8f Mon Sep 17 00:00:00 2001 From: Lzu Tao Date: Fri, 16 Oct 2020 20:40:54 +0700 Subject: [PATCH 10/47] meson -D --- .github/workflows/generic-dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/generic-dev.yml b/.github/workflows/generic-dev.yml index 6311590f7cb..1a584e7ff37 100644 --- a/.github/workflows/generic-dev.yml +++ b/.github/workflows/generic-dev.yml @@ -69,7 +69,7 @@ jobs: -Dbin_programs=true ` -Dbin_contrib=true ` -Ddefault_library=shared ` - -Dpkg_config_path="C:\lz4\lib\pkgconfig;C:\vcpkg\packages\zlib_x64-windows\lib\pkgconfig" ` + -Dpkg_config_path="C:\lz4\lib\pkgconfig:;C:\vcpkg\packages\zlib_x64-windows\lib\pkgconfig" ` -Dcmake_prefix_path=C:\vcpkg\packages\liblzma_x64-windows\share\liblzma ` builddir meson compile -C builddir From 5f629f6b77c9ef10d91f544179c8f224a0761a81 Mon Sep 17 00:00:00 2001 From: Lzu Tao Date: Fri, 16 Oct 2020 20:40:54 +0700 Subject: [PATCH 11/47] meson -D --- .github/workflows/generic-dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/generic-dev.yml b/.github/workflows/generic-dev.yml index 1a584e7ff37..0c046c15bfc 100644 --- a/.github/workflows/generic-dev.yml +++ b/.github/workflows/generic-dev.yml @@ -69,7 +69,7 @@ jobs: -Dbin_programs=true ` -Dbin_contrib=true ` -Ddefault_library=shared ` - -Dpkg_config_path="C:\lz4\lib\pkgconfig:;C:\vcpkg\packages\zlib_x64-windows\lib\pkgconfig" ` + -Dpkg_config_path="C:\vcpkg\packages\zlib_x64-windows\lib\pkgconfig;C:\lz4\lib\pkgconfig" ` -Dcmake_prefix_path=C:\vcpkg\packages\liblzma_x64-windows\share\liblzma ` builddir meson compile -C builddir From 0b50f69a02c9df23df3eddc997072d42a51e167f Mon Sep 17 00:00:00 2001 From: Lzu Tao Date: Fri, 16 Oct 2020 20:40:54 +0700 Subject: [PATCH 12/47] meson -D --- .github/workflows/generic-dev.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/generic-dev.yml b/.github/workflows/generic-dev.yml index 0c046c15bfc..ddc5a3ac37c 100644 --- a/.github/workflows/generic-dev.yml +++ b/.github/workflows/generic-dev.yml @@ -52,6 +52,7 @@ jobs: - name: install zlib run: | + vcpkg integrate install vcpkg install --triplet x64-windows zlib - name: install liblzma @@ -70,6 +71,7 @@ jobs: -Dbin_contrib=true ` -Ddefault_library=shared ` -Dpkg_config_path="C:\vcpkg\packages\zlib_x64-windows\lib\pkgconfig;C:\lz4\lib\pkgconfig" ` - -Dcmake_prefix_path=C:\vcpkg\packages\liblzma_x64-windows\share\liblzma ` + -Dcmake_prefix_path=C:\src\vcpkg\scripts\buildsystems\ ` + -Dc_args="-IC:\vcpkg\packages\liblzma_x64-windows\include " ` builddir meson compile -C builddir From 05efc6d3c099aab8b5b49b92a0fdac203693e351 Mon Sep 17 00:00:00 2001 From: Lzu Tao Date: Fri, 16 Oct 2020 21:18:57 +0700 Subject: [PATCH 13/47] static --- .github/workflows/generic-dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/generic-dev.yml b/.github/workflows/generic-dev.yml index ddc5a3ac37c..6e811362768 100644 --- a/.github/workflows/generic-dev.yml +++ b/.github/workflows/generic-dev.yml @@ -69,7 +69,7 @@ jobs: -Dauto_features=enabled ` -Dbin_programs=true ` -Dbin_contrib=true ` - -Ddefault_library=shared ` + -Ddefault_library=static ` -Dpkg_config_path="C:\vcpkg\packages\zlib_x64-windows\lib\pkgconfig;C:\lz4\lib\pkgconfig" ` -Dcmake_prefix_path=C:\src\vcpkg\scripts\buildsystems\ ` -Dc_args="-IC:\vcpkg\packages\liblzma_x64-windows\include " ` From f78d483a8053b636bb53c6d755171c52de209579 Mon Sep 17 00:00:00 2001 From: Lzu Tao Date: Sat, 17 Oct 2020 08:51:53 +0700 Subject: [PATCH 14/47] cpp --- build/meson/contrib/pzstd/meson.build | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/build/meson/contrib/pzstd/meson.build b/build/meson/contrib/pzstd/meson.build index 9639f3ccfb5..05df0b3ba51 100644 --- a/build/meson/contrib/pzstd/meson.build +++ b/build/meson/contrib/pzstd/meson.build @@ -11,11 +11,13 @@ zstd_rootdir = '../../../..' pzstd_includes = include_directories(join_paths(zstd_rootdir, 'programs'), join_paths(zstd_rootdir, 'contrib/pzstd')) -pzstd_sources = [join_paths(zstd_rootdir, 'programs/util.c'), +pzstd_sources = [ join_paths(zstd_rootdir, 'contrib/pzstd/main.cpp'), join_paths(zstd_rootdir, 'contrib/pzstd/Options.cpp'), join_paths(zstd_rootdir, 'contrib/pzstd/Pzstd.cpp'), - join_paths(zstd_rootdir, 'contrib/pzstd/SkippableFrame.cpp')] + join_paths(zstd_rootdir, 'contrib/pzstd/SkippableFrame.cpp'), + join_paths(zstd_rootdir, 'programs/util.c'), +] pzstd_cpp_args = [] if [compiler_gcc, compiler_clang].contains(cc_id) From cb9f5a71561b2fcca7582826ed83453aca09d0c4 Mon Sep 17 00:00:00 2001 From: Lzu Tao Date: Sat, 17 Oct 2020 09:54:51 +0700 Subject: [PATCH 15/47] bool --- build/meson/lib/meson.build | 16 ++++++++++------ build/meson/meson.build | 29 +++++++++++++++++------------ 2 files changed, 27 insertions(+), 18 deletions(-) diff --git a/build/meson/lib/meson.build b/build/meson/lib/meson.build index 16d8189248a..2095a932c95 100644 --- a/build/meson/lib/meson.build +++ b/build/meson/lib/meson.build @@ -79,7 +79,7 @@ if use_multi_thread endif libzstd_c_args = [] -if cc_id == compiler_msvc +if is_like_msvc if default_library_type != 'static' libzstd_sources += [ windows_mod.compile_resources( @@ -87,18 +87,22 @@ if cc_id == compiler_msvc include_directories: include_directories(join_paths(zstd_rootdir, 'lib')), ) ] - libzstd_c_args += ['/DZSTD_DLL_EXPORT=1', + libzstd_c_args += [ + '/DZSTD_DLL_EXPORT=1', '/DZSTD_HEAPMODE=0', '/D_CONSOLE', - '/D_CRT_SECURE_NO_WARNINGS'] + '/D_CRT_SECURE_NO_WARNINGS', + ] else - libzstd_c_args += ['-DZSTD_HEAPMODE=0', - '-D_CRT_SECURE_NO_WARNINGS'] + libzstd_c_args += [ + '/DZSTD_HEAPMODE=0', + '/D_CRT_SECURE_NO_WARNINGS', + ] endif endif mingw_ansi_stdio_flags = [] -if host_machine_os == os_windows and cc_id == compiler_gcc +if is_os_windows and cc_id == compiler_gcc mingw_ansi_stdio_flags = [ '-D__USE_MINGW_ANSI_STDIO' ] endif libzstd_c_args += mingw_ansi_stdio_flags diff --git a/build/meson/meson.build b/build/meson/meson.build index 3184b961cfe..5e95ba99347 100644 --- a/build/meson/meson.build +++ b/build/meson/meson.build @@ -25,16 +25,21 @@ pkgconfig = import('pkgconfig') windows_mod = import('windows') host_machine_os = host_machine.system() -os_windows = 'windows' -os_linux = 'linux' -os_darwin = 'darwin' -os_freebsd = 'freebsd' -os_sun = 'sunos' +is_os_windows = host_machine_os == 'windows' +is_os_linux = host_machine_os == 'linux' +is_os_darwin = host_machine_os == 'darwin' +is_os_freebsd = host_machine_os == 'freebsd' +is_os_sun = host_machine_os == 'sunos' cc_id = cc.get_id() -compiler_gcc = 'gcc' -compiler_clang = 'clang' -compiler_msvc = 'msvc' +cc_arg_syntax = cc.get_argument_syntax() +is_like_clang = cc_id == 'clang' +is_like_gcc == cc_arg_syntax == 'gcc' +is_like_msvc == cc_arg_syntax == 'msvc' + +if not is_like_msvc and not is_like_gcc + error('Unsupported compiler: @0@'.format(cc_id)) +endif zstd_version = meson.project_version() @@ -103,13 +108,13 @@ use_lz4 = lz4_dep.found() # Compiler flags # ============================================================================= -if [compiler_gcc, compiler_clang].contains(cc_id) +if is_like_gcc add_project_arguments('-DXXH_NAMESPACE=ZSTD_', language: ['c']) -else +elif is_like_msvc add_project_arguments('/DXXH_NAMESPACE=ZSTD_', language: ['c']) endif -if [compiler_gcc, compiler_clang].contains(cc_id) +if is_like_gcc common_warning_flags = [ '-Wextra', '-Wundef', '-Wshadow', '-Wcast-align', '-Wcast-qual' ] if cc_id == compiler_clang # Should use Meson's own --werror build option @@ -120,7 +125,7 @@ if [compiler_gcc, compiler_clang].contains(cc_id) cxx_compile_flags = cxx.get_supported_arguments(common_warning_flags) add_project_arguments(cc_compile_flags, language : 'c') add_project_arguments(cxx_compile_flags, language : 'cpp') -elif cc_id == compiler_msvc +elif is_like_msvc msvc_compile_flags = [ '/D_UNICODE', '/DUNICODE' ] if use_multi_thread msvc_compile_flags += '/MP' From ead867745ee000d72dcfbbaa5ddd8e22d7be446b Mon Sep 17 00:00:00 2001 From: Lzu Tao Date: Sat, 17 Oct 2020 09:54:51 +0700 Subject: [PATCH 16/47] bool --- build/meson/meson.build | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/meson/meson.build b/build/meson/meson.build index 5e95ba99347..c500f538ee7 100644 --- a/build/meson/meson.build +++ b/build/meson/meson.build @@ -34,8 +34,8 @@ is_os_sun = host_machine_os == 'sunos' cc_id = cc.get_id() cc_arg_syntax = cc.get_argument_syntax() is_like_clang = cc_id == 'clang' -is_like_gcc == cc_arg_syntax == 'gcc' -is_like_msvc == cc_arg_syntax == 'msvc' +is_like_gcc = cc_arg_syntax == 'gcc' +is_like_msvc = cc_arg_syntax == 'msvc' if not is_like_msvc and not is_like_gcc error('Unsupported compiler: @0@'.format(cc_id)) From 25a8205a96628633a979cff27bb57bb58c007c75 Mon Sep 17 00:00:00 2001 From: Lzu Tao Date: Sat, 17 Oct 2020 09:54:51 +0700 Subject: [PATCH 17/47] bool --- build/meson/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/meson/meson.build b/build/meson/meson.build index c500f538ee7..b569c4e1c8c 100644 --- a/build/meson/meson.build +++ b/build/meson/meson.build @@ -116,7 +116,7 @@ endif if is_like_gcc common_warning_flags = [ '-Wextra', '-Wundef', '-Wshadow', '-Wcast-align', '-Wcast-qual' ] - if cc_id == compiler_clang + if is_like_clang # Should use Meson's own --werror build option #common_warning_flags += '-Werror' common_warning_flags += ['-Wconversion', '-Wno-sign-conversion', '-Wdocumentation'] From f4f38980fe7bb85b0381d5a8028f65dffae28b7a Mon Sep 17 00:00:00 2001 From: Lzu Tao Date: Sat, 17 Oct 2020 09:54:51 +0700 Subject: [PATCH 18/47] bool --- build/meson/lib/meson.build | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/build/meson/lib/meson.build b/build/meson/lib/meson.build index 2095a932c95..c80351dc008 100644 --- a/build/meson/lib/meson.build +++ b/build/meson/lib/meson.build @@ -50,8 +50,17 @@ libzstd_sources = [join_paths(zstd_rootdir, 'lib/common/entropy_common.c'), join_paths(zstd_rootdir, 'lib/deprecated/zbuff_decompress.c')] # Explicit define legacy support -add_project_arguments('-DZSTD_LEGACY_SUPPORT=@0@'.format(legacy_level), - language: 'c') +if is_like_gcc + add_project_arguments( + '-DZSTD_LEGACY_SUPPORT=@0@'.format(legacy_level), + language: 'c' + ) +else + add_project_arguments( + '/DZSTD_LEGACY_SUPPORT=@0@'.format(legacy_level), + language: 'c' + ) +endif if legacy_level == 0 message('Legacy support: DISABLED') @@ -70,7 +79,7 @@ endif libzstd_deps = [] if use_multi_thread message('Enable multi-threading support') - if [compiler_gcc, compiler_clang].contains(cc_id) + if is_like_gcc add_project_arguments('-DZSTD_MULTITHREAD', language: 'c') else add_project_arguments('/DZSTD_MULTITHREAD', language: 'c') @@ -102,20 +111,20 @@ if is_like_msvc endif mingw_ansi_stdio_flags = [] -if is_os_windows and cc_id == compiler_gcc +if is_os_windows and cc_id == 'gcc' mingw_ansi_stdio_flags = [ '-D__USE_MINGW_ANSI_STDIO' ] endif libzstd_c_args += mingw_ansi_stdio_flags libzstd_debug_cflags = [] if use_debug - if cc_id == compiler_msvc + if is_like_msvc libzstd_c_args += '/DDEBUGLEVEL=@0@'.format(debug_level) else libzstd_c_args += '-DDEBUGLEVEL=@0@'.format(debug_level) endif - if cc_id == compiler_gcc or cc_id == compiler_clang + if is_like_gcc libzstd_debug_cflags = ['-Wstrict-aliasing=1', '-Wswitch-enum', '-Wdeclaration-after-statement', '-Wstrict-prototypes', '-Wundef', '-Wpointer-arith', '-Wvla', From 06beca395a6a8547728dcf62b82e810723083744 Mon Sep 17 00:00:00 2001 From: Lzu Tao Date: Sat, 17 Oct 2020 09:54:51 +0700 Subject: [PATCH 19/47] bool --- build/meson/programs/meson.build | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/build/meson/programs/meson.build b/build/meson/programs/meson.build index 95706d2ddbb..c07e96d3bb1 100644 --- a/build/meson/programs/meson.build +++ b/build/meson/programs/meson.build @@ -21,7 +21,7 @@ zstd_programs_sources = [join_paths(zstd_rootdir, 'programs/zstdcli.c'), zstd_c_args = libzstd_debug_cflags if use_multi_thread - if cc_id == compiler_msvc + if is_like_msvc zstd_c_args += [ '/DZSTD_MULTITHREAD' ] else zstd_c_args += [ '-DZSTD_MULTITHREAD' ] @@ -31,7 +31,7 @@ endif zstd_deps = [ libzstd_dep ] if use_zlib zstd_deps += [ zlib_dep ] - if cc_id == compiler_msvc + if is_like_msvc zstd_c_args += [ '/DZSTD_GZCOMPRESS', '/DZSTD_GZDECOMPRESS' ] else zstd_c_args += [ '-DZSTD_GZCOMPRESS', '-DZSTD_GZDECOMPRESS' ] @@ -40,7 +40,7 @@ endif if use_lzma zstd_deps += [ lzma_dep ] - if cc_id == compiler_msvc + if is_like_msvc zstd_c_args += [ '/DZSTD_LZMACOMPRESS', '/DZSTD_LZMADECOMPRESS' ] else zstd_c_args += [ '-DZSTD_LZMACOMPRESS', '-DZSTD_LZMADECOMPRESS' ] @@ -49,7 +49,7 @@ endif if use_lz4 zstd_deps += [ lz4_dep ] - if cc_id == compiler_msvc + if is_like_msvc zstd_c_args += [ '/DZSTD_LZ4COMPRESS', '/DZSTD_LZ4DECOMPRESS' ] else zstd_c_args += [ '-DZSTD_LZ4COMPRESS', '-DZSTD_LZ4DECOMPRESS' ] @@ -59,13 +59,13 @@ endif export_dynamic_on_windows = false # explicit backtrace enable/disable for Linux & Darwin if not use_backtrace - if cc_id == compiler_msvc + if is_like_msvc zstd_c_args += [ '/DBACKTRACE_ENABLE=0' ] else zstd_c_args += '-DBACKTRACE_ENABLE=0' endif -elif use_debug and host_machine_os == os_windows # MinGW target - if cc_id == compiler_msvc +elif use_debug and is_os_windows # MinGW target + if is_like_msvc zstd_c_args += [ '/DDBACKTRACE_ENABLE=1' ] else zstd_c_args += '-DBACKTRACE_ENABLE=1' @@ -73,7 +73,7 @@ elif use_debug and host_machine_os == os_windows # MinGW target export_dynamic_on_windows = true endif -if cc_id == compiler_msvc +if is_like_msvc if default_library_type != 'static' zstd_programs_sources += [ windows_mod.compile_resources( @@ -98,7 +98,7 @@ zstd_frugal_sources = [join_paths(zstd_rootdir, 'programs/zstdcli.c'), # Minimal target, with only zstd compression and decompression. # No bench. No legacy. -if cc_id == compiler_msvc +if is_like_msvc zstd_frugal_c_args = [ '/DZSTD_NOBENCH', '/DZSTD_NODICT' ] else zstd_frugal_c_args = [ '-DZSTD_NOBENCH', '-DZSTD_NODICT' ] @@ -123,7 +123,7 @@ install_man(join_paths(zstd_rootdir, 'programs/zstd.1'), InstallSymlink_py = '../InstallSymlink.py' zstd_man1_dir = join_paths(zstd_mandir, 'man1') -bin_EXT = host_machine_os == os_windows ? '.exe' : '' +bin_EXT = is_os_windows ? '.exe' : '' man1_EXT = meson.version().version_compare('>=0.49.0') ? '.1' : '.1.gz' foreach f : ['zstdcat', 'unzstd'] From a57e2c6b1321ac2ee69e1bf854d8325e60461d71 Mon Sep 17 00:00:00 2001 From: Lzu Tao Date: Sat, 17 Oct 2020 09:54:51 +0700 Subject: [PATCH 20/47] bool --- build/meson/tests/meson.build | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/meson/tests/meson.build b/build/meson/tests/meson.build index 0b68fd005f1..8ee0f480e45 100644 --- a/build/meson/tests/meson.build +++ b/build/meson/tests/meson.build @@ -10,8 +10,8 @@ zstd_rootdir = '../../..' -tests_supported_oses = [os_linux, 'gnu/kfreebsd', os_darwin, 'gnu', 'openbsd', - os_freebsd, 'netbsd', 'dragonfly', os_sun] +tests_supported_oses = ['linux', 'gnu/kfreebsd', 'darwin', 'gnu', 'openbsd', + 'freebsd', 'netbsd', 'dragonfly', 'sunos'] # ============================================================================= # Test flags From 6a7c9edb51115189c31e30f1f68fcf86c31ac662 Mon Sep 17 00:00:00 2001 From: Lzu Tao Date: Sat, 17 Oct 2020 09:54:51 +0700 Subject: [PATCH 21/47] bool --- build/meson/tests/meson.build | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/meson/tests/meson.build b/build/meson/tests/meson.build index 8ee0f480e45..cae86b90c34 100644 --- a/build/meson/tests/meson.build +++ b/build/meson/tests/meson.build @@ -31,7 +31,7 @@ test_includes = [ include_directories(join_paths(zstd_rootdir, 'programs')) ] datagen_sources = [join_paths(zstd_rootdir, 'programs/datagen.c'), join_paths(zstd_rootdir, 'tests/datagencli.c')] -if cc_id == compiler_msvc +if is_like_msvc datagen_c_args = [ '/DNDEBUG' ] else datagen_c_args = [ '-DNDEBUG' ] @@ -158,7 +158,7 @@ if tests_supported_oses.contains(host_machine_os) timeout: 600) # Timeout should work on HDD drive endif -if host_machine_os != os_windows +if not is_os_windows playTests_sh = find_program(join_paths(zstd_rootdir, 'tests/playTests.sh'), required: true) test('test-zstd', playTests_sh, From 8986517182af204f86d19cd91a2eb8ea0a9a7229 Mon Sep 17 00:00:00 2001 From: Lzu Tao Date: Sat, 17 Oct 2020 09:54:51 +0700 Subject: [PATCH 22/47] bool --- build/meson/contrib/pzstd/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/meson/contrib/pzstd/meson.build b/build/meson/contrib/pzstd/meson.build index 05df0b3ba51..fa56fbc09ef 100644 --- a/build/meson/contrib/pzstd/meson.build +++ b/build/meson/contrib/pzstd/meson.build @@ -20,7 +20,7 @@ pzstd_sources = [ ] pzstd_cpp_args = [] -if [compiler_gcc, compiler_clang].contains(cc_id) +if is_like_gcc pzstd_cpp_args += [ '-DNDEBUG', '-Wno-shadow', '-pedantic' ] else pzstd_cpp_args += [ '/DNDEBUG' ] From 8e02728f9dfa89a660207d8ac6bb548f71580e7e Mon Sep 17 00:00:00 2001 From: Lzu Tao Date: Sat, 17 Oct 2020 09:54:51 +0700 Subject: [PATCH 23/47] bool --- build/meson/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/meson/meson.build b/build/meson/meson.build index b569c4e1c8c..4de9479fd4c 100644 --- a/build/meson/meson.build +++ b/build/meson/meson.build @@ -17,7 +17,7 @@ project('zstd', 'buildtype=release' ], version: 'DUMMY', - meson_version: '>=0.47.0') + meson_version: '>=0.49.0') cc = meson.get_compiler('c') cxx = meson.get_compiler('cpp') From 8eb682b3ffff31fc7ec4704401ebf181763418a4 Mon Sep 17 00:00:00 2001 From: Lzu Tao Date: Sat, 17 Oct 2020 10:59:41 +0700 Subject: [PATCH 24/47] meson arr --- .github/workflows/generic-dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/generic-dev.yml b/.github/workflows/generic-dev.yml index 6e811362768..63cf8345de2 100644 --- a/.github/workflows/generic-dev.yml +++ b/.github/workflows/generic-dev.yml @@ -70,7 +70,7 @@ jobs: -Dbin_programs=true ` -Dbin_contrib=true ` -Ddefault_library=static ` - -Dpkg_config_path="C:\vcpkg\packages\zlib_x64-windows\lib\pkgconfig;C:\lz4\lib\pkgconfig" ` + -Dpkg_config_path="[C:\vcpkg\packages\zlib_x64-windows\lib\pkgconfig, C:\lz4\lib\pkgconfig]" ` -Dcmake_prefix_path=C:\src\vcpkg\scripts\buildsystems\ ` -Dc_args="-IC:\vcpkg\packages\liblzma_x64-windows\include " ` builddir From 142e4a16f92df4ec1013133c3a4ab2e669a2d634 Mon Sep 17 00:00:00 2001 From: Lzu Tao Date: Sat, 17 Oct 2020 10:59:41 +0700 Subject: [PATCH 25/47] meson arr --- .github/workflows/generic-dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/generic-dev.yml b/.github/workflows/generic-dev.yml index 63cf8345de2..5f8dc64a333 100644 --- a/.github/workflows/generic-dev.yml +++ b/.github/workflows/generic-dev.yml @@ -70,7 +70,7 @@ jobs: -Dbin_programs=true ` -Dbin_contrib=true ` -Ddefault_library=static ` - -Dpkg_config_path="[C:\vcpkg\packages\zlib_x64-windows\lib\pkgconfig, C:\lz4\lib\pkgconfig]" ` + -Dpkg_config_path="['C:\vcpkg\packages\zlib_x64-windows\lib\pkgconfig', 'C:\lz4\lib\pkgconfig']" ` -Dcmake_prefix_path=C:\src\vcpkg\scripts\buildsystems\ ` -Dc_args="-IC:\vcpkg\packages\liblzma_x64-windows\include " ` builddir From c7c032e5a08eec1435670f22c43bdb86a877ba61 Mon Sep 17 00:00:00 2001 From: Lzu Tao Date: Sat, 17 Oct 2020 10:59:41 +0700 Subject: [PATCH 26/47] meson arr --- .github/workflows/generic-dev.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/generic-dev.yml b/.github/workflows/generic-dev.yml index 5f8dc64a333..e2cda33ca9a 100644 --- a/.github/workflows/generic-dev.yml +++ b/.github/workflows/generic-dev.yml @@ -71,7 +71,6 @@ jobs: -Dbin_contrib=true ` -Ddefault_library=static ` -Dpkg_config_path="['C:\vcpkg\packages\zlib_x64-windows\lib\pkgconfig', 'C:\lz4\lib\pkgconfig']" ` - -Dcmake_prefix_path=C:\src\vcpkg\scripts\buildsystems\ ` -Dc_args="-IC:\vcpkg\packages\liblzma_x64-windows\include " ` builddir meson compile -C builddir From 37fc2e878ca0ac08953a47b02055046148380e34 Mon Sep 17 00:00:00 2001 From: Lzu Tao Date: Sat, 17 Oct 2020 10:59:41 +0700 Subject: [PATCH 27/47] meson arr --- .github/workflows/generic-dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/generic-dev.yml b/.github/workflows/generic-dev.yml index e2cda33ca9a..34f6766bb18 100644 --- a/.github/workflows/generic-dev.yml +++ b/.github/workflows/generic-dev.yml @@ -70,7 +70,7 @@ jobs: -Dbin_programs=true ` -Dbin_contrib=true ` -Ddefault_library=static ` - -Dpkg_config_path="['C:\vcpkg\packages\zlib_x64-windows\lib\pkgconfig', 'C:\lz4\lib\pkgconfig']" ` + -Dpkg_config_path="C:\vcpkg\packages\zlib_x64-windows\lib\pkgconfig;C:\lz4\lib\pkgconfig" ` -Dc_args="-IC:\vcpkg\packages\liblzma_x64-windows\include " ` builddir meson compile -C builddir From cfe36d136bb036e6264c479d6f2696b7c23616fc Mon Sep 17 00:00:00 2001 From: Lzu Tao Date: Sat, 17 Oct 2020 11:20:59 +0700 Subject: [PATCH 28/47] clang --- .github/workflows/generic-dev.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/generic-dev.yml b/.github/workflows/generic-dev.yml index 34f6766bb18..42592e59f56 100644 --- a/.github/workflows/generic-dev.yml +++ b/.github/workflows/generic-dev.yml @@ -63,6 +63,8 @@ jobs: - name: test run: | cd build\meson + $env:myX = "clang" + $env:myX = "clang++" meson setup ` --buildtype=debugoptimized ` -Db_lundef=false ` From e4fd1dd9d055baca34f6f7816456c6b1577d34d6 Mon Sep 17 00:00:00 2001 From: Lzu Tao Date: Sat, 17 Oct 2020 11:20:59 +0700 Subject: [PATCH 29/47] clang --- .github/workflows/generic-dev.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/generic-dev.yml b/.github/workflows/generic-dev.yml index 42592e59f56..4d32fc287ae 100644 --- a/.github/workflows/generic-dev.yml +++ b/.github/workflows/generic-dev.yml @@ -63,8 +63,8 @@ jobs: - name: test run: | cd build\meson - $env:myX = "clang" - $env:myX = "clang++" + $env:CC = "clang" + $env:C++ = "clang++" meson setup ` --buildtype=debugoptimized ` -Db_lundef=false ` From 82cdc2ee228b435d095fbfbeb98d69d27426f459 Mon Sep 17 00:00:00 2001 From: Lzu Tao Date: Sat, 17 Oct 2020 11:20:59 +0700 Subject: [PATCH 30/47] clang --- .github/workflows/generic-dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/generic-dev.yml b/.github/workflows/generic-dev.yml index 4d32fc287ae..5f7ebabcbe8 100644 --- a/.github/workflows/generic-dev.yml +++ b/.github/workflows/generic-dev.yml @@ -64,7 +64,7 @@ jobs: run: | cd build\meson $env:CC = "clang" - $env:C++ = "clang++" + $env:CXX = "clang++" meson setup ` --buildtype=debugoptimized ` -Db_lundef=false ` From da49c18fa25f1c53ba0ad11a751d40b081cbd11b Mon Sep 17 00:00:00 2001 From: Lzu Tao Date: Sat, 17 Oct 2020 11:20:59 +0700 Subject: [PATCH 31/47] clang --- .github/workflows/generic-dev.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/generic-dev.yml b/.github/workflows/generic-dev.yml index 5f7ebabcbe8..62f57d0c300 100644 --- a/.github/workflows/generic-dev.yml +++ b/.github/workflows/generic-dev.yml @@ -63,8 +63,8 @@ jobs: - name: test run: | cd build\meson - $env:CC = "clang" - $env:CXX = "clang++" + $env:CC = "clang.exe" + $env:CXX = "clang++.exe" meson setup ` --buildtype=debugoptimized ` -Db_lundef=false ` From c8d8d95e468d138fec5347f5a35740a45a2a4d5f Mon Sep 17 00:00:00 2001 From: Lzu Tao Date: Sat, 17 Oct 2020 11:20:59 +0700 Subject: [PATCH 32/47] clang --- .github/workflows/generic-dev.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/generic-dev.yml b/.github/workflows/generic-dev.yml index 62f57d0c300..123be53f03b 100644 --- a/.github/workflows/generic-dev.yml +++ b/.github/workflows/generic-dev.yml @@ -63,8 +63,8 @@ jobs: - name: test run: | cd build\meson - $env:CC = "clang.exe" - $env:CXX = "clang++.exe" + $env:CC = "gcc" + $env:CXX = "g++" meson setup ` --buildtype=debugoptimized ` -Db_lundef=false ` From 003c03484edcd5e751ba62ec110238cb5182afea Mon Sep 17 00:00:00 2001 From: Lzu Tao Date: Sun, 18 Oct 2020 09:46:12 +0700 Subject: [PATCH 33/47] clashing --- programs/platform.h | 1 + 1 file changed, 1 insertion(+) diff --git a/programs/platform.h b/programs/platform.h index 68be70bb333..ef320d14613 100644 --- a/programs/platform.h +++ b/programs/platform.h @@ -138,6 +138,7 @@ extern "C" { # define IS_CONSOLE(stdStream) _isatty(_fileno(stdStream)) #elif defined(WIN32) || defined(_WIN32) # include /* _isatty */ + #define NOMINMAX /* Avoid clashing name with max in windows.h and std */ # include /* DeviceIoControl, HANDLE, FSCTL_SET_SPARSE */ # include /* FILE */ static __inline int IS_CONSOLE(FILE* stdStream) { From 66582abc4657049bde158ae14232423fd43bee5e Mon Sep 17 00:00:00 2001 From: Lzu Tao Date: Sun, 18 Oct 2020 09:46:12 +0700 Subject: [PATCH 34/47] clashing --- .github/workflows/generic-dev.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/generic-dev.yml b/.github/workflows/generic-dev.yml index 123be53f03b..34f6766bb18 100644 --- a/.github/workflows/generic-dev.yml +++ b/.github/workflows/generic-dev.yml @@ -63,8 +63,6 @@ jobs: - name: test run: | cd build\meson - $env:CC = "gcc" - $env:CXX = "g++" meson setup ` --buildtype=debugoptimized ` -Db_lundef=false ` From ee00cb4fe05e7054f6dd564c79323c039e70e7e5 Mon Sep 17 00:00:00 2001 From: Lzu Tao Date: Sun, 18 Oct 2020 10:01:00 +0700 Subject: [PATCH 35/47] share --- .github/workflows/generic-dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/generic-dev.yml b/.github/workflows/generic-dev.yml index 34f6766bb18..ca6db16e85c 100644 --- a/.github/workflows/generic-dev.yml +++ b/.github/workflows/generic-dev.yml @@ -69,7 +69,7 @@ jobs: -Dauto_features=enabled ` -Dbin_programs=true ` -Dbin_contrib=true ` - -Ddefault_library=static ` + -Ddefault_library=shared ` -Dpkg_config_path="C:\vcpkg\packages\zlib_x64-windows\lib\pkgconfig;C:\lz4\lib\pkgconfig" ` -Dc_args="-IC:\vcpkg\packages\liblzma_x64-windows\include " ` builddir From 376b61df7ac4008b0d0c710f6f4eb14f4906d9ec Mon Sep 17 00:00:00 2001 From: Lzu Tao Date: Sun, 18 Oct 2020 10:03:26 +0700 Subject: [PATCH 36/47] me --- build/meson/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/meson/meson.build b/build/meson/meson.build index 4de9479fd4c..7338ba6cfb8 100644 --- a/build/meson/meson.build +++ b/build/meson/meson.build @@ -126,7 +126,7 @@ if is_like_gcc add_project_arguments(cc_compile_flags, language : 'c') add_project_arguments(cxx_compile_flags, language : 'cpp') elif is_like_msvc - msvc_compile_flags = [ '/D_UNICODE', '/DUNICODE' ] + msvc_compile_flags = [ '/D_UNICODE', '/DUNICODE', '/DNOMINMAX' ] if use_multi_thread msvc_compile_flags += '/MP' endif From 27903283666c0c75e431b1c57272acb7332c9502 Mon Sep 17 00:00:00 2001 From: Lzu Tao Date: Sun, 18 Oct 2020 10:14:43 +0700 Subject: [PATCH 37/47] gcc --- .github/workflows/generic-dev.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/generic-dev.yml b/.github/workflows/generic-dev.yml index ca6db16e85c..451a4dfac8c 100644 --- a/.github/workflows/generic-dev.yml +++ b/.github/workflows/generic-dev.yml @@ -63,6 +63,8 @@ jobs: - name: test run: | cd build\meson + $env:CC = "gcc" + $env:CXX = "g++" meson setup ` --buildtype=debugoptimized ` -Db_lundef=false ` From fc2656b281d08a8a65fa884d29b2bcb8bf3e1f8a Mon Sep 17 00:00:00 2001 From: Lzu Tao Date: Sun, 18 Oct 2020 10:20:16 +0700 Subject: [PATCH 38/47] revert --- .github/workflows/generic-dev.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/generic-dev.yml b/.github/workflows/generic-dev.yml index 451a4dfac8c..ca6db16e85c 100644 --- a/.github/workflows/generic-dev.yml +++ b/.github/workflows/generic-dev.yml @@ -63,8 +63,6 @@ jobs: - name: test run: | cd build\meson - $env:CC = "gcc" - $env:CXX = "g++" meson setup ` --buildtype=debugoptimized ` -Db_lundef=false ` From 36fe8af7fd7c41a6bd26570dab5d3b1887d1f624 Mon Sep 17 00:00:00 2001 From: Lzu Tao Date: Mon, 19 Oct 2020 10:35:50 +0700 Subject: [PATCH 39/47] visualbility --- lib/dictBuilder/zdict.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/dictBuilder/zdict.c b/lib/dictBuilder/zdict.c index 6bb66347753..af13e1c8124 100644 --- a/lib/dictBuilder/zdict.c +++ b/lib/dictBuilder/zdict.c @@ -969,7 +969,7 @@ static size_t ZDICT_addEntropyTablesFromBuffer_advanced( } /* Hidden declaration for dbio.c */ -size_t ZDICT_trainFromBuffer_unsafe_legacy( +ZDICTLIB_VISIBILITY size_t ZDICT_trainFromBuffer_unsafe_legacy( void* dictBuffer, size_t maxDictSize, const void* samplesBuffer, const size_t* samplesSizes, unsigned nbSamples, ZDICT_legacy_params_t params); From 21a6f8a07991eb03dc7ffa1a1ffffd8ddb7cbbc4 Mon Sep 17 00:00:00 2001 From: Lzu Tao Date: Mon, 19 Oct 2020 10:35:50 +0700 Subject: [PATCH 40/47] visualbility --- lib/dictBuilder/zdict.c | 7 +------ programs/dibio.h | 9 +++++++++ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/lib/dictBuilder/zdict.c b/lib/dictBuilder/zdict.c index af13e1c8124..69399ebe5f3 100644 --- a/lib/dictBuilder/zdict.c +++ b/lib/dictBuilder/zdict.c @@ -968,16 +968,11 @@ static size_t ZDICT_addEntropyTablesFromBuffer_advanced( return MIN(dictBufferCapacity, hSize+dictContentSize); } -/* Hidden declaration for dbio.c */ -ZDICTLIB_VISIBILITY size_t ZDICT_trainFromBuffer_unsafe_legacy( - void* dictBuffer, size_t maxDictSize, - const void* samplesBuffer, const size_t* samplesSizes, unsigned nbSamples, - ZDICT_legacy_params_t params); /*! ZDICT_trainFromBuffer_unsafe_legacy() : * Warning : `samplesBuffer` must be followed by noisy guard band. * @return : size of dictionary, or an error code which can be tested with ZDICT_isError() */ -size_t ZDICT_trainFromBuffer_unsafe_legacy( +ZDICTLIB_API size_t ZDICT_trainFromBuffer_unsafe_legacy( void* dictBuffer, size_t maxDictSize, const void* samplesBuffer, const size_t* samplesSizes, unsigned nbSamples, ZDICT_legacy_params_t params) diff --git a/programs/dibio.h b/programs/dibio.h index 682723d6a54..017b3f8ee70 100644 --- a/programs/dibio.h +++ b/programs/dibio.h @@ -36,4 +36,13 @@ int DiB_trainFromFiles(const char* dictFileName, unsigned maxDictSize, ZDICT_legacy_params_t* params, ZDICT_cover_params_t* coverParams, ZDICT_fastCover_params_t* fastCoverParams, int optimize); + +/* Hidden declaration for dbio.c */ +/* +size_t ZDICT_trainFromBuffer_unsafe_legacy( + void* dictBuffer, size_t maxDictSize, + const void* samplesBuffer, const size_t* samplesSizes, unsigned nbSamples, + ZDICT_legacy_params_t params); +*/ + #endif From 95de0f04dcea41f8931baaebe3509d6079de9fbb Mon Sep 17 00:00:00 2001 From: Lzu Tao Date: Mon, 19 Oct 2020 10:35:50 +0700 Subject: [PATCH 41/47] visualbility --- lib/compress/zstd_compress.c | 2 +- programs/dibio.h | 9 --------- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/lib/compress/zstd_compress.c b/lib/compress/zstd_compress.c index b1bb9fa1021..3a941600911 100644 --- a/lib/compress/zstd_compress.c +++ b/lib/compress/zstd_compress.c @@ -1057,7 +1057,7 @@ ZSTD_clampCParams(ZSTD_compressionParameters cParams) /** ZSTD_cycleLog() : * condition for correct operation : hashLog > 1 */ -U32 ZSTD_cycleLog(U32 hashLog, ZSTD_strategy strat) +ZDICTLIB_API U32 ZSTD_cycleLog(U32 hashLog, ZSTD_strategy strat) { U32 const btScale = ((U32)strat >= (U32)ZSTD_btlazy2); return hashLog - btScale; diff --git a/programs/dibio.h b/programs/dibio.h index 017b3f8ee70..682723d6a54 100644 --- a/programs/dibio.h +++ b/programs/dibio.h @@ -36,13 +36,4 @@ int DiB_trainFromFiles(const char* dictFileName, unsigned maxDictSize, ZDICT_legacy_params_t* params, ZDICT_cover_params_t* coverParams, ZDICT_fastCover_params_t* fastCoverParams, int optimize); - -/* Hidden declaration for dbio.c */ -/* -size_t ZDICT_trainFromBuffer_unsafe_legacy( - void* dictBuffer, size_t maxDictSize, - const void* samplesBuffer, const size_t* samplesSizes, unsigned nbSamples, - ZDICT_legacy_params_t params); -*/ - #endif From 0e7c168b8510f68aa508443485b3485929e8744d Mon Sep 17 00:00:00 2001 From: Lzu Tao Date: Mon, 19 Oct 2020 10:35:50 +0700 Subject: [PATCH 42/47] visualbility --- lib/compress/zstd_compress.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/compress/zstd_compress.c b/lib/compress/zstd_compress.c index 3a941600911..327426ebf96 100644 --- a/lib/compress/zstd_compress.c +++ b/lib/compress/zstd_compress.c @@ -1057,7 +1057,7 @@ ZSTD_clampCParams(ZSTD_compressionParameters cParams) /** ZSTD_cycleLog() : * condition for correct operation : hashLog > 1 */ -ZDICTLIB_API U32 ZSTD_cycleLog(U32 hashLog, ZSTD_strategy strat) +ZSTDLIB_API U32 ZSTD_cycleLog(U32 hashLog, ZSTD_strategy strat) { U32 const btScale = ((U32)strat >= (U32)ZSTD_btlazy2); return hashLog - btScale; From 547c24d93bebe04071cfeb3532fab45b4e3efe38 Mon Sep 17 00:00:00 2001 From: Lzu Tao Date: Mon, 19 Oct 2020 10:35:50 +0700 Subject: [PATCH 43/47] visualbility --- lib/compress/zstd_compress.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/compress/zstd_compress.c b/lib/compress/zstd_compress.c index 327426ebf96..b1bb9fa1021 100644 --- a/lib/compress/zstd_compress.c +++ b/lib/compress/zstd_compress.c @@ -1057,7 +1057,7 @@ ZSTD_clampCParams(ZSTD_compressionParameters cParams) /** ZSTD_cycleLog() : * condition for correct operation : hashLog > 1 */ -ZSTDLIB_API U32 ZSTD_cycleLog(U32 hashLog, ZSTD_strategy strat) +U32 ZSTD_cycleLog(U32 hashLog, ZSTD_strategy strat) { U32 const btScale = ((U32)strat >= (U32)ZSTD_btlazy2); return hashLog - btScale; From cb7cd6212a6e5be72778da7cae617c50b3d4048b Mon Sep 17 00:00:00 2001 From: Lzu Tao Date: Mon, 19 Oct 2020 18:19:20 +0700 Subject: [PATCH 44/47] use debug profile --- .github/workflows/generic-dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/generic-dev.yml b/.github/workflows/generic-dev.yml index ca6db16e85c..dd418fc0d15 100644 --- a/.github/workflows/generic-dev.yml +++ b/.github/workflows/generic-dev.yml @@ -64,7 +64,7 @@ jobs: run: | cd build\meson meson setup ` - --buildtype=debugoptimized ` + --buildtype=debug ` -Db_lundef=false ` -Dauto_features=enabled ` -Dbin_programs=true ` From 354d6f7e880236274ddd53c0c617997684f7473a Mon Sep 17 00:00:00 2001 From: Lzu Tao Date: Mon, 19 Oct 2020 18:34:17 +0700 Subject: [PATCH 45/47] dll --- lib/compress/zstd_compress.c | 2 +- lib/compress/zstd_compress_internal.h | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/lib/compress/zstd_compress.c b/lib/compress/zstd_compress.c index b1bb9fa1021..1b51f2acf94 100644 --- a/lib/compress/zstd_compress.c +++ b/lib/compress/zstd_compress.c @@ -1057,7 +1057,7 @@ ZSTD_clampCParams(ZSTD_compressionParameters cParams) /** ZSTD_cycleLog() : * condition for correct operation : hashLog > 1 */ -U32 ZSTD_cycleLog(U32 hashLog, ZSTD_strategy strat) +ZSTD_COMPRESS_DLL_PUBLIC U32 ZSTD_cycleLog(U32 hashLog, ZSTD_strategy strat) { U32 const btScale = ((U32)strat >= (U32)ZSTD_btlazy2); return hashLog - btScale; diff --git a/lib/compress/zstd_compress_internal.h b/lib/compress/zstd_compress_internal.h index a0a9d53bac5..1f1679c7c99 100644 --- a/lib/compress/zstd_compress_internal.h +++ b/lib/compress/zstd_compress_internal.h @@ -24,6 +24,20 @@ # include "zstdmt_compress.h" #endif +#if defined _WIN32 || defined __CYGWIN__ + #ifdef __GNUC__ + #define ZSTD_COMPRESS_DLL_PUBLIC __attribute__ ((dllexport)) + #else + #define ZSTD_COMPRESS_DLL_PUBLIC __declspec(dllexport) // Note: actually gcc seems to also supports this syntax. + #endif +#else + #if __GNUC__ >= 4 + #define ZSTD_COMPRESS_DLL_PUBLIC __attribute__ ((visibility ("default"))) + #else + #define ZSTD_COMPRESS_DLL_PUBLIC + #endif +#endif + #if defined (__cplusplus) extern "C" { #endif From 5bac83b5d83a0c21cc04fd201c1434e5c188b4ff Mon Sep 17 00:00:00 2001 From: Lzu Tao Date: Mon, 19 Oct 2020 18:34:17 +0700 Subject: [PATCH 46/47] dll --- lib/compress/zstd_compress_internal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/compress/zstd_compress_internal.h b/lib/compress/zstd_compress_internal.h index 1f1679c7c99..b82ebdd8be0 100644 --- a/lib/compress/zstd_compress_internal.h +++ b/lib/compress/zstd_compress_internal.h @@ -1187,6 +1187,6 @@ size_t ZSTD_referenceExternalSequences(ZSTD_CCtx* cctx, rawSeq* seq, size_t nbSe /** ZSTD_cycleLog() : * condition for correct operation : hashLog > 1 */ -U32 ZSTD_cycleLog(U32 hashLog, ZSTD_strategy strat); +ZSTD_COMPRESS_DLL_PUBLIC U32 ZSTD_cycleLog(U32 hashLog, ZSTD_strategy strat); #endif /* ZSTD_COMPRESS_H */ From f8d3a2eb61cbc5a932b36a3ab791567ab556f5bf Mon Sep 17 00:00:00 2001 From: Lzu Tao Date: Mon, 19 Oct 2020 18:34:17 +0700 Subject: [PATCH 47/47] dll --- lib/common/xxhash.c | 2 +- lib/common/xxhash.h | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/lib/common/xxhash.c b/lib/common/xxhash.c index e708df3c338..6160662b430 100644 --- a/lib/common/xxhash.c +++ b/lib/common/xxhash.c @@ -459,7 +459,7 @@ FORCE_INLINE_TEMPLATE U64 XXH64_endian_align(const void* input, size_t len, U64 } -XXH_PUBLIC_API unsigned long long XXH64 (const void* input, size_t len, unsigned long long seed) +XXHASH_DLL_PUBLIC XXH_PUBLIC_API unsigned long long XXH64 (const void* input, size_t len, unsigned long long seed) { #if 0 /* Simple version, good for code maintenance, but unfortunately slow for small inputs */ diff --git a/lib/common/xxhash.h b/lib/common/xxhash.h index eceb55d5e07..cefed82719d 100644 --- a/lib/common/xxhash.h +++ b/lib/common/xxhash.h @@ -88,6 +88,20 @@ typedef enum { XXH_OK=0, XXH_ERROR } XXH_errorcode; # define XXH_PUBLIC_API /* do nothing */ #endif /* XXH_PRIVATE_API */ +#if defined _WIN32 || defined __CYGWIN__ + #ifdef __GNUC__ + #define XXHASH_DLL_PUBLIC __attribute__ ((dllexport)) + #else + #define XXHASH_DLL_PUBLIC __declspec(dllexport) // Note: actually gcc seems to also supports this syntax. + #endif +#else + #if __GNUC__ >= 4 + #define XXHASH_DLL_PUBLIC __attribute__ ((visibility ("default"))) + #else + #define XXHASH_DLL_PUBLIC + #endif +#endif + /*!XXH_NAMESPACE, aka Namespace Emulation : If you want to include _and expose_ xxHash functions from within your own library, @@ -141,7 +155,7 @@ typedef unsigned int XXH32_hash_t; typedef unsigned long long XXH64_hash_t; XXH_PUBLIC_API XXH32_hash_t XXH32 (const void* input, size_t length, unsigned int seed); -XXH_PUBLIC_API XXH64_hash_t XXH64 (const void* input, size_t length, unsigned long long seed); +XXHASH_DLL_PUBLIC XXH_PUBLIC_API XXH64_hash_t XXH64 (const void* input, size_t length, unsigned long long seed); /*! XXH32() :