Merge pull request #666 from iburinoc/zstdmt-default

Add MT enabled targets for libzstd
This commit is contained in:
Yann Collet 2017-04-18 23:07:41 -07:00 committed by GitHub
commit 987cc95ed7
2 changed files with 19 additions and 1 deletions

View File

@ -71,6 +71,9 @@ libzstd.a: $(ZSTD_OBJ)
@echo compiling static library @echo compiling static library
@$(AR) $(ARFLAGS) $@ $^ @$(AR) $(ARFLAGS) $@ $^
libzstd.a-mt: CPPFLAGS += -DZSTD_MULTHREAD
libzstd.a-mt: libzstd.a
$(LIBZSTD): LDFLAGS += -shared -fPIC -fvisibility=hidden $(LIBZSTD): LDFLAGS += -shared -fPIC -fvisibility=hidden
$(LIBZSTD): $(ZSTD_FILES) $(LIBZSTD): $(ZSTD_FILES)
@echo compiling dynamic library $(LIBVER) @echo compiling dynamic library $(LIBVER)
@ -86,10 +89,17 @@ endif
libzstd : $(LIBZSTD) libzstd : $(LIBZSTD)
libzstd-mt : CPPFLAGS += -DZSTD_MULTITHREAD
libzstd-mt : libzstd
lib: libzstd.a libzstd lib: libzstd.a libzstd
lib-release: DEBUGFLAGS := lib-mt: CPPFLAGS += -DZSTD_MULTITHREAD
lib-mt: lib
lib-release lib-release-mt: DEBUGFLAGS :=
lib-release: lib lib-release: lib
lib-release-mt: lib-mt
clean: clean:
@$(RM) -r *.dSYM # Mac OS-X specific @$(RM) -r *.dSYM # Mac OS-X specific

View File

@ -22,6 +22,14 @@ Some additional API may be useful if you're looking into advanced features :
They are not "stable", their definition may change in the future. They are not "stable", their definition may change in the future.
Only static linking is allowed. Only static linking is allowed.
#### ZSTDMT API
To enable building the multithreaded compression API, use the `make lib-mt` target.
The header file zstdmt_compress.h (in compress/) provides the prototypes for the API.
If linking a program that uses the ZSTDMT API against libzstd.a on a POSIX system,
the -pthread flag must be provided to the compiler at link time.
Note that these prototypes may still be used in a version built without multithread support,
but they will be single threaded (i.e. no benefits will be given over the standard ZSTD API).
#### Modular build #### Modular build