all: add zstd compression library
This commit is contained in:
@@ -6,12 +6,14 @@ if(NOT IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/.git")
|
||||
option(UPX_CONFIG_DISABLE_GITREV "Do not compile with default Git version info." ON)
|
||||
option(UPX_CONFIG_DISABLE_SANITIZE "Do not compile with default sanitize options." ON)
|
||||
option(UPX_CONFIG_DISABLE_WERROR "Do not compile with default -Werror option." ON)
|
||||
option(UPX_CONFIG_DISABLE_ZSTD "Do not compile with zstd; NOTE: zstd is WIP." ON)
|
||||
else()
|
||||
# strict config defaults for devel builds
|
||||
message(STATUS "upx info: strict config defaults enabled")
|
||||
option(UPX_CONFIG_DISABLE_GITREV "Do not compile with default Git version info." OFF)
|
||||
option(UPX_CONFIG_DISABLE_SANITIZE "Do not compile with default sanitize options." OFF)
|
||||
option(UPX_CONFIG_DISABLE_WERROR "Do not compile with default -Werror option." OFF)
|
||||
option(UPX_CONFIG_DISABLE_ZSTD "Do not compile with zstd; NOTE: zstd is WIP." OFF)
|
||||
endif()
|
||||
|
||||
# test config options (see below)
|
||||
@@ -109,6 +111,13 @@ list(SORT zlib_SOURCES)
|
||||
add_library(upx_vendor_zlib STATIC ${zlib_SOURCES})
|
||||
set_property(TARGET upx_vendor_zlib PROPERTY C_STANDARD 11)
|
||||
|
||||
if(NOT UPX_CONFIG_DISABLE_ZSTD)
|
||||
file(GLOB zstd_SOURCES "vendor/zstd/lib/*/*.c")
|
||||
list(SORT zstd_SOURCES)
|
||||
add_library(upx_vendor_zstd STATIC ${zstd_SOURCES})
|
||||
set_property(TARGET upx_vendor_zstd PROPERTY C_STANDARD 11)
|
||||
endif()
|
||||
|
||||
file(GLOB upx_SOURCES "src/*.cpp" "src/util/*.cpp")
|
||||
list(SORT upx_SOURCES)
|
||||
add_executable(upx ${upx_SOURCES})
|
||||
@@ -181,6 +190,17 @@ else()
|
||||
target_compile_options(${t} PRIVATE -Wall -Wextra -Wvla -Wno-strict-prototypes ${warn_Werror})
|
||||
endif()
|
||||
|
||||
if(NOT UPX_CONFIG_DISABLE_ZSTD)
|
||||
set(t upx_vendor_zstd)
|
||||
upx_sanitize_target(${t})
|
||||
target_compile_options(${t} PRIVATE -DDYNAMIC_BMI2=0 -DZSTD_DISABLE_ASM)
|
||||
if(MSVC)
|
||||
target_compile_options(${t} PRIVATE -J -W4 ${warn_WX})
|
||||
else()
|
||||
target_compile_options(${t} PRIVATE -Wall -Wextra -Wcast-align -Wcast-qual -Wpointer-arith -Wvla -Wwrite-strings ${warn_Werror})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(t upx)
|
||||
target_include_directories(${t} PRIVATE vendor vendor/boost-pfr/include)
|
||||
target_compile_definitions(${t} PRIVATE $<$<CONFIG:Debug>:DEBUG=1>)
|
||||
@@ -199,6 +219,10 @@ else()
|
||||
-Wshadow -Wvla -Wwrite-strings ${warn_Werror}
|
||||
)
|
||||
endif()
|
||||
if(NOT UPX_CONFIG_DISABLE_ZSTD)
|
||||
target_compile_definitions(${t} PRIVATE WITH_ZSTD=1)
|
||||
target_link_libraries(upx upx_vendor_zstd)
|
||||
endif()
|
||||
|
||||
#***********************************************************************
|
||||
# "make test"
|
||||
|
||||
Reference in New Issue
Block a user