Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
8a25ff4
CMakeLists.txt has been added (works fine with VS2017)
Deamhan Mar 14, 2019
f0b7666
CMakeLists.txt: src path has been fixed & USE_CXX17 has been set
Deamhan Mar 14, 2019
94381c2
file.h: helper functions performance has been improved
Deamhan Mar 14, 2019
0273fad
compatibility.h: custom typedefs have been removed, inttypes.h has be…
Deamhan Mar 14, 2019
62cb8e4
file.h: \t -> 4 spaces
Deamhan Mar 14, 2019
7a85464
libbdelta.cpp: exception safe resource deallocation & cleanup
Deamhan Mar 14, 2019
0accb4f
checksum.h: cleanup
Deamhan Mar 14, 2019
fecc331
bdelta.h: cleanup
Deamhan Mar 14, 2019
4634f54
bdelta.cpp: exception safe resource deallocation has been added & cle…
Deamhan Mar 14, 2019
f427b10
bpatch.cpp: exception safe resource deallocation & cleanup
Deamhan Mar 14, 2019
55586dd
multiple header include protection has been added
Deamhan Mar 14, 2019
856c782
file.h: double 'const' has been eliminated
Deamhan Mar 14, 2019
25f6104
GCC build issues have been fixed
Deamhan Mar 15, 2019
d98c35a
big stack objects have been moved to heap, thread safety has been imp…
Deamhan Mar 15, 2019
3e7e489
libbdelta.cpp: performance improvement & cleanup
Deamhan Mar 15, 2019
310a364
libbdelta.cpp: some performance improvements & cleanup
Deamhan Mar 15, 2019
a79ee72
libbdelta.cpp: memory management performance has been improved
Deamhan Mar 15, 2019
014a928
file.h: cleanup
Deamhan Mar 15, 2019
74bc6b0
bdelta.cpp: write buffer has been increased
Deamhan Mar 15, 2019
6ae1dd3
file.cpp has been added
Deamhan Mar 15, 2019
15b963f
compatibility.h has been removed
Deamhan Mar 15, 2019
4d51c6a
I/O performance upgrade
Deamhan Mar 15, 2019
05d58dc
windows: I/O performance has been improved
Deamhan Mar 15, 2019
d5e7e41
file.cpp: file I/O is unlocked now (it reduces locking overhead)
Deamhan Mar 15, 2019
97a4fca
--all-in-ram performance has been improved
Deamhan Mar 16, 2019
88a95bf
outdated & unused files have been removed
Deamhan Mar 16, 2019
b6dcb43
CMakeLists.txt: GCC32 option has been added
Deamhan Mar 16, 2019
3e7f0af
.gitignore
Deamhan Mar 16, 2019
3978f86
explicit buffer allocations have been removed
Deamhan Mar 17, 2019
59a97c4
file.cpp: some cleanup
Deamhan Mar 17, 2019
ffd9649
bpatch.cpp: mistake has been fixed
Deamhan Mar 17, 2019
f78caa7
cleanup
Deamhan Mar 18, 2019
199fd45
Checksums_Instance initialization has been moved to constructor
Deamhan Mar 18, 2019
c290092
checksum.h: some cleanup
Deamhan Mar 18, 2019
60cd44e
libbdelta.cpp: small performance optimization
Deamhan Mar 18, 2019
a2f6510
libbdelta.cpp: cleanup
Deamhan Mar 18, 2019
7ef3b5c
libbdelta.cpp: increment issue has been fixed
Deamhan Mar 18, 2019
70b0ffd
libbdelta.cpp: cleanup
Deamhan Mar 20, 2019
7a6e10c
file.cpp: missing header has been added
Deamhan Mar 20, 2019
c774369
bdelta.def has been added (for libbdelta.dll)
Deamhan Mar 20, 2019
89c5bb9
CMakeLists.txt: some new options have been added
Deamhan Mar 20, 2019
7a6337f
pre CXX17 build case under VS has been fixed
Deamhan Mar 20, 2019
a2e2cf0
CMakeLists.txt: -std=c++17 has been moved under CXX17
Deamhan Mar 20, 2019
2ddd766
file.h: some cleanup
Deamhan Mar 21, 2019
31f0a9c
'noexcept' has been added where it is possible & some cleanup
Deamhan Mar 22, 2019
79da656
exception-free bdelta implementation is ready to use
Deamhan Apr 9, 2019
73a01c7
cleanup
Deamhan Apr 11, 2019
a6823df
some minor improvements
Deamhan Apr 11, 2019
618f268
MinGW compatibility issue has been fixed & performance has been improved
Deamhan Apr 12, 2019
0ba557c
noexcept.h: comment has been added
Deamhan Jul 13, 2019
9f175cd
noexcept.h: inplace_realloc optimization has been add for _WIN32
Deamhan Jul 13, 2019
18317fe
added minor build fixes
Deamhan Jan 18, 2026
fc9d7c7
fixed memory allocation issue for bpatch
Deamhan Jan 18, 2026
cbffacc
fixed negative relative offset issue
Deamhan Jun 24, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
*.pyc
*.dylib

build
RELEASE-VERSION
src/bdelta
src/bpatch
src/bdelta.c
*vs*/
*cppcheck*

12 changes: 0 additions & 12 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,6 @@ is designed to give a great deal of control over each pass. This functionality
is not well-documented, so contact me if you need help. I hope to add more
comments to the code in future releases.


Other Bindings
==============

A simple interface for accessing the API with Python is included. This
interface is kept up-to-date since I do a lot of work in Python these days. To
istall it, just type "python build.py install" in the root folder. You'll need
Cython to build/install, but Cython is not required after installation.

See test/py_bindings.py for a usage example.


Delta File Format
=================

Expand Down
250 changes: 250 additions & 0 deletions makefiles/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,250 @@
cmake_minimum_required(VERSION 3.6)

project(bdelta)

option(BDELTA_PGO "build using PGO instead of PGI (MSVC only)" "OFF")
option(GCC32 "build 32 bit executable instead of 64 bit (GCC only)" "OFF")
option(CXX17 "enable C++17 features" "ON")
option(BIG_ENDIAN_HOST "build for big endian host" "OFF")

IF (CXX17)
set(CMAKE_CXX_STANDARD 17)
ENDIF()

IF(MSVC)
set(CMAKE_CONFIGURATION_TYPES "Debug;Release;PGO" CACHE STRING "" FORCE)
ELSE()
set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "" FORCE)
ENDIF()

set (COMMON_SOURCES

../src/file.h
../src/file.cpp
)

set (BDELTA_SOURCES

${COMMON_SOURCES}
../src/bdelta.cpp
../src/bdelta.h
../src/checksum.h
../src/libbdelta.cpp
../src/noexcept.h
)

set (BPATCH_SOURCES

${COMMON_SOURCES}
../src/bpatch.cpp
)

set (BDELTA_STATIC_LIB_SOURCES

${COMMON_SOURCES}
../src/bdelta.h
../src/checksum.h
../src/libbdelta.cpp
../src/noexcept.h
)

set (BDELTA_SHARED_LIB_SOURCES

${BDELTA_STATIC_LIB_SOURCES}
)

IF(MSVC)
set (BDELTA_SHARED_LIB_SOURCES

${BDELTA_SHARED_LIB_SOURCES}
../src/bdelta.def
)

IF(CXX17 AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.15)
message(FATAL_ERROR "Your Visual Studio is too old. Fully updated Visual Studio 2017 or newer is required")
ENDIF()
add_compile_options(/Zi # pdb
/W4 # warning level 4
/J # use unsigned char
/Gd # use cdecl
# treat warnings as errors
/we4715 # not all control paths return a value
/we4828 # disallow invalid characters
# prinf-like functions: format mismatch
/we4473 # <function> : not enough arguments passed for format string
/we4474 # <function> : too many arguments passed for format string
/we4475 # <function> : length modifier <length> cannot be used with type field character <conversion-specifier> in format specifier
/we4476 # <function> : unknown type field character <conversion-specifier> in format specifier
/we4477 # <function> : format string <format-string> requires an argument of type <type>, but variadic argument <position> has type <type>
/we4478 # <function> : positional and non-positional placeholders cannot be mixed in the same format string
/we4775 # nonstandard extension used in format string <format-string> of function <function>
/we4776 # %<conversion-specifier> is not allowed in the format string of function <function>
/we4777 # <function> : format string <format-string> requires an argument of type <type>, but variadic argument <position> has type <type>
/we4778 # <function> : unterminated format string <format-string>
# macro arg mismatch
/we4002 # too many actual parameters for macro 'identifier'
/we4003 # not enough actual parameters for macro 'identifier'
/Zc:threadSafeInit- # https://connect.microsoft.com/VisualStudio/feedback/details/1789709/visual-c-2015-runtime-broken-on-windows-server-2003-c-11-magic-statics
/MP # multiprocessor compilation
/utf-8 # utf-8 source & exec
/GF # eliminate duplicate strings
)

IF (CXX17)
add_compile_options(/std:c++17)
ENDIF()

string(REPLACE "/EHsc" "/EHs-c-" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") # disable c++ exceptions
SET(CMAKE_CXX_FLAGS ${CMAKE_C_FLAGS})

add_definitions(-D_CRT_SECURE_NO_WARNINGS)
add_definitions(-D_HAS_EXCEPTIONS=0)

SET(CMAKE_EXE_LINKER_FLAGS "/LARGEADDRESSAWARE /SUBSYSTEM:CONSOLE")
SET(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG /OPT:REF,ICF /DEBUG")
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MD -DNDEBUG /Ox /Ob2 /Oi /Ot /Oy /GS- /Gy /GR- /GL /Gw /MT")
SET(CMAKE_C_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE})
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MDd /GS /MTd -D_DEBUG")
SET(CMAKE_C_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG})

set(CMAKE_CXX_FLAGS_PGO ${CMAKE_CXX_FLAGS_RELEASE})
set(CMAKE_C_FLAGS_PGO ${CMAKE_C_FLAGS_RELEASE})

IF (BDELTA_PGO)
set(CMAKE_SHARED_LINKER_FLAGS_PGO "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /LTCG:PGOptimize")
set(CMAKE_EXE_LINKER_FLAGS_PGO "${CMAKE_EXE_LINKER_FLAGS_PGO} /LTCG:PGOptimize")
ELSE()
set(CMAKE_SHARED_LINKER_FLAGS_PGO "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /LTCG:PGInstrument")
set(CMAKE_EXE_LINKER_FLAGS_PGO "${CMAKE_EXE_LINKER_FLAGS_PGO} /LTCG:PGInstrument")
ENDIF()

ELSE()
IF(CXX17 AND CMAKE_COMPILER_IS_GNUCC)
IF(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.2)
message(FATAL_ERROR "Your GCC is too old. GCC 8.2 or newer is required")
ENDIF()
ENDIF()
add_compile_options(-pipe
-W
-Wall

-Wextra
-Wwrite-strings
-Wframe-larger-than=16384
-Wstack-usage=16384
-fdiagnostics-show-option
-Wmissing-declarations
-Wredundant-decls
-Wcast-qual
-Wsuggest-attribute=noreturn
-Wsuggest-attribute=format
-Wunused-but-set-variable
-Wunused-but-set-parameter

-Wframe-larger-than=4096

-Wno-multichar
-Wno-strict-aliasing
-Wno-missing-field-initializers

-Werror=return-type
-Werror=pointer-arith
-Werror=format
-Werror=format-extra-args
-Werror=unused-value
-Werror=sizeof-pointer-memaccess
-Werror=implicit-function-declaration

-Werror=missing-declarations
-Werror=missing-prototypes
-Werror=reorder
-Werror=declaration-after-statement
-Werror=missing-format-attribute
-funsigned-char

-fno-exceptions
-fno-rtti
)

SET(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -Werror=delete-non-virtual-dtor -U__STRICT_ANSI__ -fno-operator-names -std=c++17")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wimplicit-int -Wmissing-prototypes -Werror=implicit-int")

SET(CMAKE_CXX_FLAGS_RELEASE "-O2 -s -DNDEBUG -fomit-frame-pointer")
SET(CMAKE_C_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE})
SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g -D_DEBUG -D__DEBUG__ -DDEBUG_LEVEL=3 -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC")
SET(CMAKE_C_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG})

SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS} -g")
SET(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS} -g")

SET(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS} -s")
SET(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS} -s")

SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libgcc -static-libstdc++")
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-libgcc -static-libstdc++")

IF (GCC32)
add_compile_options (-m32)
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -m32")
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -m32")
ENDIF()
ENDIF()

IF (CXX17)
add_definitions(-DUSE_CXX17)
ENDIF()

add_executable(
bdelta

${BDELTA_SOURCES}
)

add_executable(
bpatch

${BPATCH_SOURCES}
)

add_library (
libbdelta-static
STATIC

${BDELTA_STATIC_LIB_SOURCES}
)

add_library (
libbdelta-shared
SHARED

${BDELTA_SHARED_LIB_SOURCES}
)

SET_TARGET_PROPERTIES(
libbdelta-static
PROPERTIES PREFIX ""
OUTPUT_NAME libbdelta
PDB_NAME libbdelta-static
)

SET_TARGET_PROPERTIES(
libbdelta-shared
PROPERTIES PREFIX ""
OUTPUT_NAME libbdelta
PDB_NAME libbdelta-shared
)

IF (NOT MSVC)
IF (CXX17)
SET (
LIBS

stdc++fs
)
ENDIF()

target_link_libraries(bdelta ${LIBS})
target_link_libraries(bpatch ${LIBS})
ENDIF()

set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT bdelta)
Loading