Skip to content

Commit

Permalink
uopdate other builders: compress support muti-thread;
Browse files Browse the repository at this point in the history
  • Loading branch information
sisong committed Sep 16, 2023
1 parent 4c90b53 commit eb7ba8d
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 19 deletions.
26 changes: 23 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# args
MT := 1
STATIC_CPP := 0
# used clang?
CL := 0
CL := 0
# build with -m32?
M32 := 0
# build for out min size
MINS := 0
ifeq ($(OS),Windows_NT) # mingw?
CC := gcc
CC := gcc
endif


Expand All @@ -17,6 +18,13 @@ HDP_OBJ := \
$(HDP_PATH)/libHDiffPatch/HPatch/patch.o \
$(HDP_PATH)/file_for_patch.o

ifeq ($(MT),0)
else
HDP_OBJ += \
$(HDP_PATH)/libParallel/parallel_import.o \
$(HDP_PATH)/libParallel/parallel_channel.o
endif

TINY_OBJ := \
decompress/tuz_dec.o \
compress/tuz_enc.o \
Expand All @@ -27,7 +35,15 @@ TINY_OBJ := \
$(HDP_OBJ)

DEF_FLAGS := \
-O3 -DNDEBUG -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_IS_USED_MULTITHREAD=0
-O3 -DNDEBUG -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64

ifeq ($(MT),0)
DEF_FLAGS += -D_IS_USED_MULTITHREAD=0
else
DEF_FLAGS += \
-D_IS_USED_MULTITHREAD=1 \
-D_IS_USED_CPP11THREAD=1
endif

ifeq ($(M32),0)
else
Expand All @@ -45,6 +61,10 @@ else
endif

TINY_LINK :=
ifeq ($(MT),0)
else
TINY_LINK += -lpthread # link pthread
endif
ifeq ($(M32),0)
else
TINY_LINK += -m32
Expand Down
6 changes: 5 additions & 1 deletion builds/codeblocks/tinyuz.cbp
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,19 @@
<Add option="-fexceptions" />
<Add option="-D_LARGEFILE_SOURCE" />
<Add option="-D_FILE_OFFSET_BITS=64" />
<Add option="-D_IS_USED_MULTITHREAD=0" />
</Compiler>
<Linker>
<Add library="pthread" />
</Linker>
<Unit filename="../../../HDiffPatch/file_for_patch.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="../../../HDiffPatch/libHDiffPatch/HDiff/private_diff/libdivsufsort/divsufsort.cpp" />
<Unit filename="../../../HDiffPatch/libHDiffPatch/HPatch/patch.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="../../../HDiffPatch/libParallel/parallel_channel.cpp" />
<Unit filename="../../../HDiffPatch/libParallel/parallel_import.cpp" />
<Unit filename="../../compress/tuz_enc.cpp" />
<Unit filename="../../compress/tuz_enc_private/tuz_enc_clip.cpp" />
<Unit filename="../../compress/tuz_enc_private/tuz_enc_code.cpp" />
Expand Down
12 changes: 10 additions & 2 deletions builds/xcode/libtinyuz.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
/* Begin PBXBuildFile section */
0D7FEA82282A676D0029772D /* patch.c in Sources */ = {isa = PBXBuildFile; fileRef = 0D7FEA81282A676D0029772D /* patch.c */; };
0D7FEA84282A67830029772D /* divsufsort.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0D7FEA83282A67830029772D /* divsufsort.cpp */; };
0D7FEA86282A67850029772D /* parallel_channel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0D7FEA85282A67850029772D /* parallel_channel.cpp */; };
0D7FEA88282A67870029772D /* parallel_import.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0D7FEA87282A67870029772D /* parallel_import.cpp */; };
D6F3B7C82427B30E0066B989 /* tuz_enc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D6F3B7BB2427B30E0066B989 /* tuz_enc.cpp */; };
D6F3B7C92427B30E0066B989 /* tuz_enc_types.h in Headers */ = {isa = PBXBuildFile; fileRef = D6F3B7BC2427B30E0066B989 /* tuz_enc_types.h */; };
D6F3B7CA2427B30E0066B989 /* tuz_enc.h in Headers */ = {isa = PBXBuildFile; fileRef = D6F3B7BD2427B30E0066B989 /* tuz_enc.h */; };
Expand All @@ -30,6 +32,8 @@
/* Begin PBXFileReference section */
0D7FEA81282A676D0029772D /* patch.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = patch.c; path = ../../../HDiffPatch/libHDiffPatch/HPatch/patch.c; sourceTree = "<group>"; };
0D7FEA83282A67830029772D /* divsufsort.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = divsufsort.cpp; path = ../../../HDiffPatch/libHDiffPatch/HDiff/private_diff/libdivsufsort/divsufsort.cpp; sourceTree = "<group>"; };
0D7FEA85282A67850029772D /* parallel_channel.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = parallel_channel.cpp; path = ../../../HDiffPatch/libParallel/parallel_channel.cpp; sourceTree = "<group>"; };
0D7FEA87282A67870029772D /* parallel_import.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = parallel_import.cpp; path = ../../../HDiffPatch/libParallel/parallel_import.cpp; sourceTree = "<group>"; };
0D7FEA9C282A6BC60029772D /* tinyuz.xcworkspace */ = {isa = PBXFileReference; lastKnownFileType = wrapper.workspace; path = tinyuz.xcworkspace; sourceTree = "<group>"; };
D6F3B7B32427B2D20066B989 /* liblibtinyuz.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = liblibtinyuz.a; sourceTree = BUILT_PRODUCTS_DIR; };
D6F3B7BB2427B30E0066B989 /* tuz_enc.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = tuz_enc.cpp; sourceTree = "<group>"; };
Expand Down Expand Up @@ -124,6 +128,8 @@
isa = PBXGroup;
children = (
0D7FEA83282A67830029772D /* divsufsort.cpp */,
0D7FEA85282A67850029772D /* parallel_channel.cpp */,
0D7FEA87282A67870029772D /* parallel_import.cpp */,
0D7FEA81282A676D0029772D /* patch.c */,
);
name = HDiffPatch;
Expand Down Expand Up @@ -213,6 +219,8 @@
D6F3B7D12427B30E0066B989 /* tuz_enc_match.cpp in Sources */,
D6F3B7CD2427B30E0066B989 /* tuz_enc_code.cpp in Sources */,
0D7FEA84282A67830029772D /* divsufsort.cpp in Sources */,
0D7FEA86282A67850029772D /* parallel_channel.cpp in Sources */,
0D7FEA88282A67870029772D /* parallel_import.cpp in Sources */,
D6F3B7C82427B30E0066B989 /* tuz_enc.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand All @@ -226,6 +234,7 @@
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
Expand Down Expand Up @@ -264,7 +273,6 @@
"DEBUG=1",
"_LARGEFILE_SOURCE",
"_FILE_OFFSET_BITS=64",
"_IS_USED_MULTITHREAD=0",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
Expand All @@ -288,6 +296,7 @@
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
Expand Down Expand Up @@ -324,7 +333,6 @@
"NDEBUG",
"_LARGEFILE_SOURCE",
"_FILE_OFFSET_BITS=64",
"_IS_USED_MULTITHREAD=0",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
Expand Down
6 changes: 2 additions & 4 deletions builds/xcode/speedTest.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
Expand Down Expand Up @@ -174,7 +174,6 @@
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
Expand Down Expand Up @@ -203,7 +202,7 @@
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
Expand Down Expand Up @@ -235,7 +234,6 @@
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
Expand Down
7 changes: 3 additions & 4 deletions builds/xcode/tinyuz.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
Expand Down Expand Up @@ -171,7 +171,6 @@
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
Expand Down Expand Up @@ -199,7 +198,7 @@
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
Expand Down Expand Up @@ -232,7 +231,6 @@
DEPLOYMENT_POSTPROCESSING = YES;
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
GCC_PREPROCESSOR_DEFINITIONS = NDEBUG;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
Expand All @@ -241,6 +239,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
LLVM_LTO = YES;
MACOSX_DEPLOYMENT_TARGET = 10.9;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
Expand Down
6 changes: 2 additions & 4 deletions builds/xcode/unitTest.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
Expand Down Expand Up @@ -170,7 +170,6 @@
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
Expand Down Expand Up @@ -199,7 +198,7 @@
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
Expand Down Expand Up @@ -231,7 +230,6 @@
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
Expand Down
2 changes: 1 addition & 1 deletion compress/tuz_enc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ hpatch_StreamPos_t tuz_compress(const hpatch_TStreamOutput* out_code,const hpatc
_codeList.resize(threadNum+1+threadNum/2);
for (size_t i=0;i<_codeList.size();++i)
checkv(mt.work_chan.send(&_codeList[i],true));
mt.start_threads(threadNum,_tuz_compress_mt,&mt,true);
mt.start_threads((int)threadNum,_tuz_compress_mt,&mt,true);

mt.wait_all_thread_end();
checkv(!mt.is_on_error());
Expand Down

0 comments on commit eb7ba8d

Please sign in to comment.