diff --git a/Makefile b/Makefile index 193162e1..963b1882 100644 --- a/Makefile +++ b/Makefile @@ -85,7 +85,7 @@ clean: $(MAKE) -C $(FUZZDIR) $@ > $(VOID) $(MAKE) -C contrib/gen_manual $@ > $(VOID) $(RM) lz4$(EXT) - $(RM) -r $(CMAKE_BUILD_DIR) + $(RM) -r $(CMAKE_BUILD_DIR) $(MESON_BUILD_DIR) @echo Cleaning completed @@ -119,6 +119,13 @@ cmakebuild: mkdir -p $(CMAKE_BUILD_DIR) cd $(CMAKE_BUILD_DIR); $(CMAKE) $(CMAKE_PARAMS) ..; $(CMAKE) --build . +MESON ?= meson +MESON_BUILD_DIR ?= mesonBuildDir + +.PHONY: mesonbuild +mesonbuild: + $(MESON) setup --fatal-meson-warnings --buildtype=debug -Db_lundef=false -Dauto_features=enabled -Dprograms=true -Dcontrib=true -Dtests=true -Dexamples=true build/meson $(MESON_BUILD_DIR) + $(MESON) test -C $(MESON_BUILD_DIR) #------------------------------------------------------------------------ # make tests validated only for MSYS and Posix environments diff --git a/build/meson/meson/programs/meson.build b/build/meson/meson/programs/meson.build index a8bc18ae..5e8063fb 100644 --- a/build/meson/meson/programs/meson.build +++ b/build/meson/meson/programs/meson.build @@ -10,18 +10,35 @@ lz4_source_root = '../../../..' +# note: +# it would be preferable to use some kind of glob or wildcard expansion here... sources = files( lz4_source_root / 'programs/bench.c', lz4_source_root / 'programs/datagen.c', lz4_source_root / 'programs/lz4cli.c', lz4_source_root / 'programs/lz4io.c', + lz4_source_root / 'programs/util.c', + lz4_source_root / 'programs/threadpool.c', + lz4_source_root / 'programs/timefn.c', ) +# Initialize an empty list for extra dependencies +extra_deps = [] + +if get_option('enable_multithread') + pthread_dep = dependency('threads', required : true) + extra_deps += [pthread_dep] + multithread_args = ['-DLZ4IO_MULTITHREAD'] +else + multithread_args = [] +endif + lz4 = executable( 'lz4', sources, include_directories: include_directories(lz4_source_root / 'programs'), - dependencies: [liblz4_internal_dep], + dependencies: [liblz4_internal_dep] + extra_deps, + c_args: multithread_args, export_dynamic: get_option('debug') and host_machine.system() == 'windows', install: true ) diff --git a/build/meson/meson_options.txt b/build/meson/meson_options.txt index 9623a6e3..d9c30d63 100644 --- a/build/meson/meson_options.txt +++ b/build/meson/meson_options.txt @@ -8,6 +8,8 @@ # in the COPYING file in the root directory of this source tree). # ############################################################################# +option('enable_multithread', type: 'boolean', value: true, + description: 'Enable multi-threading support') option('align-test', type: 'boolean', value: true, description: 'See LZ4_ALIGN_TEST') option('contrib', type: 'boolean', value: false, diff --git a/tests/test-lz4-fast-hugefile.sh b/tests/test-lz4-fast-hugefile.sh index c777b910..58204782 100755 --- a/tests/test-lz4-fast-hugefile.sh +++ b/tests/test-lz4-fast-hugefile.sh @@ -12,7 +12,7 @@ trap remove EXIT set -x -datagen -g6GB | lz4 -vB5D | lz4 -qt +datagen -g6GB | lz4 -vB5 | lz4 -qt # test large file size [2-4] GB datagen -g3G -P100 | lz4 -vv | lz4 --decompress --force --sparse - ${FPREFIX}1 ls -ls ${FPREFIX}1 diff --git a/tests/test-lz4hc-hugefile.sh b/tests/test-lz4hc-hugefile.sh index 74eb5c9a..107c3137 100755 --- a/tests/test-lz4hc-hugefile.sh +++ b/tests/test-lz4hc-hugefile.sh @@ -3,4 +3,4 @@ set -e set -x -datagen -g4200MB | lz4 -v3BD | lz4 -qt +datagen -g4200MB | lz4 -v3 | lz4 -qt