【QT+QGIS跨平台编译】之六:【LZMA+Qt跨平台编译】(一套代码、一套框架,跨平台编译)

发布时间:2024年01月23日

文章目录

  • 一、lzma介绍
  • 二、文件下载
  • 三、文件分析
  • 四、pro文件
  • 五、编译实践

一、lzma介绍

LZMA(Lempel-Ziv-Markov chain-Algorithm的缩写),是一个Deflate和LZ77算法改良和优化后的压缩算法。
libLzma是基于LZMA压缩算法封装的开源库。2001年被首次应用于7-Zip压缩工具中,是 2001年以来得到发展的一个数据压缩算法。
在一般的情况下压缩率比 bzip2 为高,用于压缩的可变字典最大可达4GB。
libLzma目前的版本:lzma-5.2.7
在这里插入图片描述


二、文件下载

liblzma网址:
LZMA
在这里插入图片描述

获取xz-5.2.7.tar.gz文件。


三、文件分析

解压缩xz-5.2.7.tar.gz
有CMakeLists.txt文件:
在这里插入图片描述

文件中,标识了相应的头文件和源文件:

add_library(liblzma
    src/common/mythread.h
    src/common/sysdefs.h
    src/common/tuklib_common.h
    src/common/tuklib_config.h
    src/common/tuklib_cpucores.c
    src/common/tuklib_cpucores.h
    src/common/tuklib_integer.h
    src/common/tuklib_physmem.c
    src/common/tuklib_physmem.h
    src/liblzma/api/lzma.h
    src/liblzma/api/lzma/base.h
    src/liblzma/api/lzma/bcj.h
    src/liblzma/api/lzma/block.h
    src/liblzma/api/lzma/check.h
    src/liblzma/api/lzma/container.h
    src/liblzma/api/lzma/delta.h
    src/liblzma/api/lzma/filter.h
    src/liblzma/api/lzma/hardware.h
    src/liblzma/api/lzma/index.h
    src/liblzma/api/lzma/index_hash.h
    src/liblzma/api/lzma/lzma12.h
    src/liblzma/api/lzma/stream_flags.h
    src/liblzma/api/lzma/version.h
    src/liblzma/api/lzma/vli.h
    src/liblzma/check/check.c
    src/liblzma/check/check.h
    src/liblzma/check/crc32_fast.c
    src/liblzma/check/crc32_table.c
    src/liblzma/check/crc32_table_be.h
    src/liblzma/check/crc32_table_le.h
    src/liblzma/check/crc64_fast.c
    src/liblzma/check/crc64_table.c
    src/liblzma/check/crc64_table_be.h
    src/liblzma/check/crc64_table_le.h
    src/liblzma/check/crc_macros.h
    src/liblzma/check/sha256.c
    src/liblzma/common/alone_decoder.c
    src/liblzma/common/alone_decoder.h
    src/liblzma/common/alone_encoder.c
    src/liblzma/common/auto_decoder.c
    src/liblzma/common/block_buffer_decoder.c
    src/liblzma/common/block_buffer_encoder.c
    src/liblzma/common/block_buffer_encoder.h
    src/liblzma/common/block_decoder.c
    src/liblzma/common/block_decoder.h
    src/liblzma/common/block_encoder.c
    src/liblzma/common/block_encoder.h
    src/liblzma/common/block_header_decoder.c
    src/liblzma/common/block_header_encoder.c
    src/liblzma/common/block_util.c
    src/liblzma/common/common.c
    src/liblzma/common/common.h
    src/liblzma/common/easy_buffer_encoder.c
    src/liblzma/common/easy_decoder_memusage.c
    src/liblzma/common/easy_encoder.c
    src/liblzma/common/easy_encoder_memusage.c
    src/liblzma/common/easy_preset.c
    src/liblzma/common/easy_preset.h
    src/liblzma/common/filter_buffer_decoder.c
    src/liblzma/common/filter_buffer_encoder.c
    src/liblzma/common/filter_common.c
    src/liblzma/common/filter_common.h
    src/liblzma/common/filter_decoder.c
    src/liblzma/common/filter_decoder.h
    src/liblzma/common/filter_encoder.c
    src/liblzma/common/filter_encoder.h
    src/liblzma/common/filter_flags_decoder.c
    src/liblzma/common/filter_flags_encoder.c
    src/liblzma/common/hardware_cputhreads.c
    src/liblzma/common/hardware_physmem.c
    src/liblzma/common/index.c
    src/liblzma/common/index.h
    src/liblzma/common/index_decoder.c
    src/liblzma/common/index_encoder.c
    src/liblzma/common/index_encoder.h
    src/liblzma/common/index_hash.c
    src/liblzma/common/memcmplen.h
    src/liblzma/common/outqueue.c
    src/liblzma/common/outqueue.h
    src/liblzma/common/stream_buffer_decoder.c
    src/liblzma/common/stream_buffer_encoder.c
    src/liblzma/common/stream_decoder.c
    src/liblzma/common/stream_decoder.h
    src/liblzma/common/stream_encoder.c
    src/liblzma/common/stream_encoder_mt.c
    src/liblzma/common/stream_flags_common.c
    src/liblzma/common/stream_flags_common.h
    src/liblzma/common/stream_flags_decoder.c
    src/liblzma/common/stream_flags_encoder.c
    src/liblzma/common/vli_decoder.c
    src/liblzma/common/vli_encoder.c
    src/liblzma/common/vli_size.c
    src/liblzma/delta/delta_common.c
    src/liblzma/delta/delta_common.h
    src/liblzma/delta/delta_decoder.c
    src/liblzma/delta/delta_decoder.h
    src/liblzma/delta/delta_encoder.c
    src/liblzma/delta/delta_encoder.h
    src/liblzma/delta/delta_private.h
    src/liblzma/lz/lz_decoder.c
    src/liblzma/lz/lz_decoder.h
    src/liblzma/lz/lz_encoder.c
    src/liblzma/lz/lz_encoder.h
    src/liblzma/lz/lz_encoder_hash.h
    src/liblzma/lz/lz_encoder_hash_table.h
    src/liblzma/lz/lz_encoder_mf.c
    src/liblzma/lzma/fastpos.h
    src/liblzma/lzma/fastpos_table.c
    src/liblzma/lzma/lzma2_decoder.c
    src/liblzma/lzma/lzma2_decoder.h
    src/liblzma/lzma/lzma2_encoder.c
    src/liblzma/lzma/lzma2_encoder.h
    src/liblzma/lzma/lzma_common.h
    src/liblzma/lzma/lzma_decoder.c
    src/liblzma/lzma/lzma_decoder.h
    src/liblzma/lzma/lzma_encoder.c
    src/liblzma/lzma/lzma_encoder.h
    src/liblzma/lzma/lzma_encoder_optimum_fast.c
    src/liblzma/lzma/lzma_encoder_optimum_normal.c
    src/liblzma/lzma/lzma_encoder_presets.c
    src/liblzma/lzma/lzma_encoder_private.h
    src/liblzma/rangecoder/price.h
    src/liblzma/rangecoder/price_table.c
    src/liblzma/rangecoder/range_common.h
    src/liblzma/rangecoder/range_decoder.h
    src/liblzma/rangecoder/range_encoder.h
    src/liblzma/simple/arm.c
    src/liblzma/simple/armthumb.c
    src/liblzma/simple/ia64.c
    src/liblzma/simple/powerpc.c
    src/liblzma/simple/simple_coder.c
    src/liblzma/simple/simple_coder.h
    src/liblzma/simple/simple_decoder.c
    src/liblzma/simple/simple_decoder.h
    src/liblzma/simple/simple_encoder.c
    src/liblzma/simple/simple_encoder.h
    src/liblzma/simple/simple_private.h
    src/liblzma/simple/sparc.c
    src/liblzma/simple/x86.c
)

预定义项信息:
在这里插入图片描述
在xz\windows\vs2019目录下,config.h文件中,列出了相关的预定义项信息:
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述


四、pro文件

配置头文件:

#头文件
HEADERS +=  ./common/mythread.h \
            ./common/sysdefs.h \
            ./common/tuklib_common.h \
            ./common/tuklib_config.h \
            ./common/tuklib_cpucores.h \
            ./common/tuklib_integer.h \
            ./common/tuklib_physmem.h \
            ./liblzma/api/lzma.h \
            ./liblzma/api/lzma/base.h \
            ./liblzma/api/lzma/bcj.h \
            ./liblzma/api/lzma/block.h \
            ./liblzma/api/lzma/check.h \
            ./liblzma/api/lzma/container.h \
            ./liblzma/api/lzma/delta.h \
            ./liblzma/api/lzma/filter.h \
            ./liblzma/api/lzma/hardware.h \
            ./liblzma/api/lzma/index.h \
            ./liblzma/api/lzma/index_hash.h \
            ./liblzma/api/lzma/lzma12.h \
            ./liblzma/api/lzma/stream_flags.h \
            ./liblzma/api/lzma/version.h \
            ./liblzma/api/lzma/vli.h \
            ./liblzma/check/check.h \
            ./liblzma/check/crc32_table_be.h \
            ./liblzma/check/crc32_table_le.h \
            ./liblzma/check/crc64_table_be.h \
            ./liblzma/check/crc64_table_le.h \
            ./liblzma/check/crc_macros.h \
            ./liblzma/common/alone_decoder.h \
            ./liblzma/common/block_buffer_encoder.h \
            ./liblzma/common/block_decoder.h \
            ./liblzma/common/block_encoder.h \
            ./liblzma/common/common.h \
            ./liblzma/common/easy_preset.h \
            ./liblzma/common/filter_common.h \
            ./liblzma/common/filter_decoder.h \
            ./liblzma/common/filter_encoder.h \
            ./liblzma/common/index.h \
            ./liblzma/common/index_encoder.h \
            ./liblzma/common/memcmplen.h \
            ./liblzma/common/outqueue.h \
            ./liblzma/common/stream_decoder.h \
            ./liblzma/common/stream_flags_common.h \
            ./liblzma/delta/delta_common.h \
            ./liblzma/delta/delta_decoder.h \
            ./liblzma/delta/delta_encoder.h \
            ./liblzma/delta/delta_private.h \
            ./liblzma/lz/lz_decoder.h \
            ./liblzma/lz/lz_encoder.h \
            ./liblzma/lz/lz_encoder_hash.h \
            ./liblzma/lz/lz_encoder_hash_table.h \
            ./liblzma/lzma/fastpos.h \
            ./liblzma/lzma/lzma2_decoder.h \
            ./liblzma/lzma/lzma2_encoder.h \
            ./liblzma/lzma/lzma_common.h \
            ./liblzma/lzma/lzma_decoder.h \
            ./liblzma/lzma/lzma_encoder.h \
            ./liblzma/lzma/lzma_encoder_private.h \
            ./liblzma/rangecoder/price.h \
            ./liblzma/rangecoder/range_common.h \
            ./liblzma/rangecoder/range_decoder.h \
            ./liblzma/rangecoder/range_encoder.h \
            ./liblzma/simple/simple_coder.h \
            ./liblzma/simple/simple_decoder.h \
            ./liblzma/simple/simple_encoder.h \
            ./liblzma/simple/simple_private.h

配置源文件:

#源文件
SOURCES +=  ./common/tuklib_cpucores.c \
            ./common/tuklib_physmem.c \
            ./liblzma/check/check.c \
            ./liblzma/check/crc32_fast.c \
            ./liblzma/check/crc32_table.c \
            ./liblzma/check/crc64_fast.c \
            ./liblzma/check/crc64_table.c \
            ./liblzma/check/sha256.c \
            ./liblzma/common/alone_decoder.c \
            ./liblzma/common/alone_encoder.c \
            ./liblzma/common/auto_decoder.c \
            ./liblzma/common/block_buffer_decoder.c \
            ./liblzma/common/block_buffer_encoder.c \
            ./liblzma/common/block_decoder.c \
            ./liblzma/common/block_encoder.c \
            ./liblzma/common/block_header_decoder.c \
            ./liblzma/common/block_header_encoder.c \
            ./liblzma/common/block_util.c \
            ./liblzma/common/common.c \
            ./liblzma/common/easy_buffer_encoder.c \
            ./liblzma/common/easy_decoder_memusage.c \
            ./liblzma/common/easy_encoder.c \
            ./liblzma/common/easy_encoder_memusage.c \
            ./liblzma/common/easy_preset.c \
            ./liblzma/common/filter_buffer_decoder.c \
            ./liblzma/common/filter_buffer_encoder.c \
            ./liblzma/common/filter_common.c \
            ./liblzma/common/filter_decoder.c \
            ./liblzma/common/filter_encoder.c \
            ./liblzma/common/filter_flags_decoder.c \
            ./liblzma/common/filter_flags_encoder.c \
            ./liblzma/common/hardware_cputhreads.c \
            ./liblzma/common/hardware_physmem.c \
            ./liblzma/common/index.c \
            ./liblzma/common/index_decoder.c \
            ./liblzma/common/index_encoder.c \
            ./liblzma/common/index_hash.c \
            ./liblzma/common/outqueue.c \
            ./liblzma/common/stream_buffer_decoder.c \
            ./liblzma/common/stream_buffer_encoder.c \
            ./liblzma/common/stream_decoder.c \
            ./liblzma/common/stream_encoder.c \
            ./liblzma/common/stream_encoder_mt.c \
            ./liblzma/common/stream_flags_common.c \
            ./liblzma/common/stream_flags_decoder.c \
            ./liblzma/common/stream_flags_encoder.c \
            ./liblzma/common/vli_decoder.c \
            ./liblzma/common/vli_encoder.c \
            ./liblzma/common/vli_size.c \
            ./liblzma/delta/delta_common.c \
            ./liblzma/delta/delta_decoder.c \
            ./liblzma/delta/delta_encoder.c \
            ./liblzma/lz/lz_decoder.c \
            ./liblzma/lz/lz_encoder.c \
            ./liblzma/lz/lz_encoder_mf.c \
            ./liblzma/lzma/fastpos_table.c \
            ./liblzma/lzma/lzma2_decoder.c \
            ./liblzma/lzma/lzma2_encoder.c \
            ./liblzma/lzma/lzma_decoder.c \
            ./liblzma/lzma/lzma_encoder.c \
            ./liblzma/lzma/lzma_encoder_optimum_fast.c \
            ./liblzma/lzma/lzma_encoder_optimum_normal.c \
            ./liblzma/lzma/lzma_encoder_presets.c \
            ./liblzma/rangecoder/price_table.c \
            ./liblzma/simple/arm.c \
            ./liblzma/simple/armthumb.c \
            ./liblzma/simple/ia64.c \
            ./liblzma/simple/powerpc.c \
            ./liblzma/simple/simple_coder.c \
            ./liblzma/simple/simple_decoder.c \
            ./liblzma/simple/simple_encoder.c \
            ./liblzma/simple/sparc.c \
            ./liblzma/simple/x86.c

预定义项设置:

DEFINES -= UNICODE
DEFINES += DLL_EXPORT

# Prefix for symbols exported by tuklib_*.c files
DEFINES += TUKLIB_SYMBOL_PREFIX="lzma_"
# How many MiB of RAM to assume if the real amount cannot be determined.
DEFINES += ASSUME_RAM=128
# Define to 1 if crc32 integrity check is enabled.
DEFINES += HAVE_CHECK_CRC32
# Define to 1 if crc64 integrity check is enabled.
DEFINES += HAVE_CHECK_CRC64
# Define to 1 if sha256 integrity check is enabled.
DEFINES += HAVE_CHECK_SHA256
# Define to 1 if any of HAVE_DECODER_foo have been defined.
DEFINES += HAVE_DECODERS
# Define to 1 if arm decoder is enabled.
DEFINES += HAVE_DECODER_ARM
# Define to 1 if armthumb decoder is enabled.
DEFINES += HAVE_DECODER_ARMTHUMB
# Define to 1 if delta decoder is enabled.
DEFINES += HAVE_DECODER_DELTA
# Define to 1 if ia64 decoder is enabled.
DEFINES += HAVE_DECODER_IA64
# Define to 1 if lzma1 decoder is enabled.
DEFINES += HAVE_DECODER_LZMA1
# Define to 1 if lzma2 decoder is enabled.
DEFINES += HAVE_DECODER_LZMA2
# Define to 1 if powerpc decoder is enabled.
DEFINES += HAVE_DECODER_POWERPC
# Define to 1 if sparc decoder is enabled.
DEFINES += HAVE_DECODER_SPARC
# Define to 1 if x86 decoder is enabled.
DEFINES += HAVE_DECODER_X86
# Define to 1 if any of HAVE_ENCODER_foo have been defined.
DEFINES += HAVE_ENCODERS
# Define to 1 if arm encoder is enabled.
DEFINES += HAVE_ENCODER_ARM
# Define to 1 if armthumb encoder is enabled.
DEFINES += HAVE_ENCODER_ARMTHUMB
# Define to 1 if delta encoder is enabled.
DEFINES += HAVE_ENCODER_DELTA
# Define to 1 if ia64 encoder is enabled.
DEFINES += HAVE_ENCODER_IA64
# Define to 1 if lzma1 encoder is enabled.
DEFINES += HAVE_ENCODER_LZMA1
# Define to 1 if lzma2 encoder is enabled.
DEFINES += HAVE_ENCODER_LZMA2
# Define to 1 if powerpc encoder is enabled.
DEFINES += HAVE_ENCODER_POWERPC
# Define to 1 if sparc encoder is enabled.
DEFINES += HAVE_ENCODER_SPARC
# Define to 1 if x86 encoder is enabled.
DEFINES += HAVE_ENCODER_X86
# Define to 1 if you have the <inttypes.h> header file.
DEFINES += HAVE_INTTYPES_H
# Define to 1 if you have the <limits.h> header file.
DEFINES += HAVE_LIMITS_H
# Define to 1 to enable bt2 match finder.
DEFINES += HAVE_MF_BT2
# Define to 1 to enable bt3 match finder.
DEFINES += HAVE_MF_BT3
# Define to 1 to enable bt4 match finder.
DEFINES += HAVE_MF_BT4
# Define to 1 to enable hc3 match finder.
DEFINES += HAVE_MF_HC3
# Define to 1 to enable hc4 match finder.
DEFINES += HAVE_MF_HC4
# Define to 1 if stdbool.h conforms to C99.
DEFINES += HAVE_STDBOOL_H
# Define to 1 if you have the <stdint.h> header file.
DEFINES += HAVE_STDINT_H
# Define to 1 if you have the <stdlib.h> header file.
DEFINES += HAVE_STDLIB_H
# Define to 1 if you have the <string.h> header file.
DEFINES += HAVE_STRING_H
# Define to 1 or 0, depending whether the compiler supports simple visibility declarations.
DEFINES += HAVE_VISIBILITY=0
# Define to 1 if the system has the type `_Bool'.
DEFINES += HAVE__BOOL
# The size of `size_t', as computed by sizeof.
DEFINES += SIZEOF_SIZE_T=8
# Define to 1 if the system supports fast unaligned access to 16-bit and 32-bit integers.
DEFINES += TUKLIB_FAST_UNALIGNED_ACCESS

win32 {
    DEFINES += MYTHREAD_WIN95
    DEFINES += _CRT_SECURE_NO_DEPRECATE _CRT_NONSTDC_NO_DEPRECATE
}
linux* {
    DEFINES += MYTHREAD_POSIX
}
macx {
    DEFINES += MYTHREAD_POSIX
}

形成005.lzma-5.2.7.pro文件:

QT += core

TEMPLATE = lib
CONFIG += c++17

DESTDIR = ../QGIS
CONFIG(debug, debug|release){
    MOC_DIR = ../build-QGIS/liblzma/Debug/moc
    RCC_DIR = ../build-QGIS/liblzma/Debug/rcc
    UI_DIR = ../build-QGIS/liblzma/Debug/ui
    OBJECTS_DIR = ../build-QGIS/liblzma/Debug/obj
}else{
    MOC_DIR = ../build-QGIS/liblzma/Release/moc
    RCC_DIR = ../build-QGIS/liblzma/Release/rcc
    UI_DIR = ../build-QGIS/liblzma/Release/ui
    OBJECTS_DIR = ../build-QGIS/liblzma/Release/obj
}

CONFIG(debug, debug|release){
    TARGET = liblzmad
}else{
    TARGET = liblzma
}

DEFINES -= UNICODE
DEFINES += DLL_EXPORT

# Prefix for symbols exported by tuklib_*.c files
DEFINES += TUKLIB_SYMBOL_PREFIX="lzma_"
# How many MiB of RAM to assume if the real amount cannot be determined.
DEFINES += ASSUME_RAM=128
# Define to 1 if crc32 integrity check is enabled.
DEFINES += HAVE_CHECK_CRC32
# Define to 1 if crc64 integrity check is enabled.
DEFINES += HAVE_CHECK_CRC64
# Define to 1 if sha256 integrity check is enabled.
DEFINES += HAVE_CHECK_SHA256
# Define to 1 if any of HAVE_DECODER_foo have been defined.
DEFINES += HAVE_DECODERS
# Define to 1 if arm decoder is enabled.
DEFINES += HAVE_DECODER_ARM
# Define to 1 if armthumb decoder is enabled.
DEFINES += HAVE_DECODER_ARMTHUMB
# Define to 1 if delta decoder is enabled.
DEFINES += HAVE_DECODER_DELTA
# Define to 1 if ia64 decoder is enabled.
DEFINES += HAVE_DECODER_IA64
# Define to 1 if lzma1 decoder is enabled.
DEFINES += HAVE_DECODER_LZMA1
# Define to 1 if lzma2 decoder is enabled.
DEFINES += HAVE_DECODER_LZMA2
# Define to 1 if powerpc decoder is enabled.
DEFINES += HAVE_DECODER_POWERPC
# Define to 1 if sparc decoder is enabled.
DEFINES += HAVE_DECODER_SPARC
# Define to 1 if x86 decoder is enabled.
DEFINES += HAVE_DECODER_X86
# Define to 1 if any of HAVE_ENCODER_foo have been defined.
DEFINES += HAVE_ENCODERS
# Define to 1 if arm encoder is enabled.
DEFINES += HAVE_ENCODER_ARM
# Define to 1 if armthumb encoder is enabled.
DEFINES += HAVE_ENCODER_ARMTHUMB
# Define to 1 if delta encoder is enabled.
DEFINES += HAVE_ENCODER_DELTA
# Define to 1 if ia64 encoder is enabled.
DEFINES += HAVE_ENCODER_IA64
# Define to 1 if lzma1 encoder is enabled.
DEFINES += HAVE_ENCODER_LZMA1
# Define to 1 if lzma2 encoder is enabled.
DEFINES += HAVE_ENCODER_LZMA2
# Define to 1 if powerpc encoder is enabled.
DEFINES += HAVE_ENCODER_POWERPC
# Define to 1 if sparc encoder is enabled.
DEFINES += HAVE_ENCODER_SPARC
# Define to 1 if x86 encoder is enabled.
DEFINES += HAVE_ENCODER_X86
# Define to 1 if you have the <inttypes.h> header file.
DEFINES += HAVE_INTTYPES_H
# Define to 1 if you have the <limits.h> header file.
DEFINES += HAVE_LIMITS_H
# Define to 1 to enable bt2 match finder.
DEFINES += HAVE_MF_BT2
# Define to 1 to enable bt3 match finder.
DEFINES += HAVE_MF_BT3
# Define to 1 to enable bt4 match finder.
DEFINES += HAVE_MF_BT4
# Define to 1 to enable hc3 match finder.
DEFINES += HAVE_MF_HC3
# Define to 1 to enable hc4 match finder.
DEFINES += HAVE_MF_HC4
# Define to 1 if stdbool.h conforms to C99.
DEFINES += HAVE_STDBOOL_H
# Define to 1 if you have the <stdint.h> header file.
DEFINES += HAVE_STDINT_H
# Define to 1 if you have the <stdlib.h> header file.
DEFINES += HAVE_STDLIB_H
# Define to 1 if you have the <string.h> header file.
DEFINES += HAVE_STRING_H
# Define to 1 or 0, depending whether the compiler supports simple visibility declarations.
DEFINES += HAVE_VISIBILITY=0
# Define to 1 if the system has the type `_Bool'.
DEFINES += HAVE__BOOL
# The size of `size_t', as computed by sizeof.
DEFINES += SIZEOF_SIZE_T=8
# Define to 1 if the system supports fast unaligned access to 16-bit and 32-bit integers.
DEFINES += TUKLIB_FAST_UNALIGNED_ACCESS

win32 {
    DEFINES += MYTHREAD_WIN95
    DEFINES += _CRT_SECURE_NO_DEPRECATE _CRT_NONSTDC_NO_DEPRECATE
}
linux* {
    DEFINES += MYTHREAD_POSIX
}
macx {
    DEFINES += MYTHREAD_POSIX
}

# You can make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0

#当前目录
INCLUDEPATH += ./ ./liblzma/api ./liblzma/common ./liblzma/check ./liblzma/lz \
            ./liblzma/rangecoder ./liblzma/lzma ./liblzma/delta ./liblzma/simple ./common

#头文件
HEADERS +=  ./common/mythread.h \
            ./common/sysdefs.h \
            ./common/tuklib_common.h \
            ./common/tuklib_config.h \
            ./common/tuklib_cpucores.h \
            ./common/tuklib_integer.h \
            ./common/tuklib_physmem.h \
            ./liblzma/api/lzma.h \
            ./liblzma/api/lzma/base.h \
            ./liblzma/api/lzma/bcj.h \
            ./liblzma/api/lzma/block.h \
            ./liblzma/api/lzma/check.h \
            ./liblzma/api/lzma/container.h \
            ./liblzma/api/lzma/delta.h \
            ./liblzma/api/lzma/filter.h \
            ./liblzma/api/lzma/hardware.h \
            ./liblzma/api/lzma/index.h \
            ./liblzma/api/lzma/index_hash.h \
            ./liblzma/api/lzma/lzma12.h \
            ./liblzma/api/lzma/stream_flags.h \
            ./liblzma/api/lzma/version.h \
            ./liblzma/api/lzma/vli.h \
            ./liblzma/check/check.h \
            ./liblzma/check/crc32_table_be.h \
            ./liblzma/check/crc32_table_le.h \
            ./liblzma/check/crc64_table_be.h \
            ./liblzma/check/crc64_table_le.h \
            ./liblzma/check/crc_macros.h \
            ./liblzma/common/alone_decoder.h \
            ./liblzma/common/block_buffer_encoder.h \
            ./liblzma/common/block_decoder.h \
            ./liblzma/common/block_encoder.h \
            ./liblzma/common/common.h \
            ./liblzma/common/easy_preset.h \
            ./liblzma/common/filter_common.h \
            ./liblzma/common/filter_decoder.h \
            ./liblzma/common/filter_encoder.h \
            ./liblzma/common/index.h \
            ./liblzma/common/index_encoder.h \
            ./liblzma/common/memcmplen.h \
            ./liblzma/common/outqueue.h \
            ./liblzma/common/stream_decoder.h \
            ./liblzma/common/stream_flags_common.h \
            ./liblzma/delta/delta_common.h \
            ./liblzma/delta/delta_decoder.h \
            ./liblzma/delta/delta_encoder.h \
            ./liblzma/delta/delta_private.h \
            ./liblzma/lz/lz_decoder.h \
            ./liblzma/lz/lz_encoder.h \
            ./liblzma/lz/lz_encoder_hash.h \
            ./liblzma/lz/lz_encoder_hash_table.h \
            ./liblzma/lzma/fastpos.h \
            ./liblzma/lzma/lzma2_decoder.h \
            ./liblzma/lzma/lzma2_encoder.h \
            ./liblzma/lzma/lzma_common.h \
            ./liblzma/lzma/lzma_decoder.h \
            ./liblzma/lzma/lzma_encoder.h \
            ./liblzma/lzma/lzma_encoder_private.h \
            ./liblzma/rangecoder/price.h \
            ./liblzma/rangecoder/range_common.h \
            ./liblzma/rangecoder/range_decoder.h \
            ./liblzma/rangecoder/range_encoder.h \
            ./liblzma/simple/simple_coder.h \
            ./liblzma/simple/simple_decoder.h \
            ./liblzma/simple/simple_encoder.h \
            ./liblzma/simple/simple_private.h

#源文件
SOURCES +=  ./common/tuklib_cpucores.c \
            ./common/tuklib_physmem.c \
            ./liblzma/check/check.c \
            ./liblzma/check/crc32_fast.c \
            ./liblzma/check/crc32_table.c \
            ./liblzma/check/crc64_fast.c \
            ./liblzma/check/crc64_table.c \
            ./liblzma/check/sha256.c \
            ./liblzma/common/alone_decoder.c \
            ./liblzma/common/alone_encoder.c \
            ./liblzma/common/auto_decoder.c \
            ./liblzma/common/block_buffer_decoder.c \
            ./liblzma/common/block_buffer_encoder.c \
            ./liblzma/common/block_decoder.c \
            ./liblzma/common/block_encoder.c \
            ./liblzma/common/block_header_decoder.c \
            ./liblzma/common/block_header_encoder.c \
            ./liblzma/common/block_util.c \
            ./liblzma/common/common.c \
            ./liblzma/common/easy_buffer_encoder.c \
            ./liblzma/common/easy_decoder_memusage.c \
            ./liblzma/common/easy_encoder.c \
            ./liblzma/common/easy_encoder_memusage.c \
            ./liblzma/common/easy_preset.c \
            ./liblzma/common/filter_buffer_decoder.c \
            ./liblzma/common/filter_buffer_encoder.c \
            ./liblzma/common/filter_common.c \
            ./liblzma/common/filter_decoder.c \
            ./liblzma/common/filter_encoder.c \
            ./liblzma/common/filter_flags_decoder.c \
            ./liblzma/common/filter_flags_encoder.c \
            ./liblzma/common/hardware_cputhreads.c \
            ./liblzma/common/hardware_physmem.c \
            ./liblzma/common/index.c \
            ./liblzma/common/index_decoder.c \
            ./liblzma/common/index_encoder.c \
            ./liblzma/common/index_hash.c \
            ./liblzma/common/outqueue.c \
            ./liblzma/common/stream_buffer_decoder.c \
            ./liblzma/common/stream_buffer_encoder.c \
            ./liblzma/common/stream_decoder.c \
            ./liblzma/common/stream_encoder.c \
            ./liblzma/common/stream_encoder_mt.c \
            ./liblzma/common/stream_flags_common.c \
            ./liblzma/common/stream_flags_decoder.c \
            ./liblzma/common/stream_flags_encoder.c \
            ./liblzma/common/vli_decoder.c \
            ./liblzma/common/vli_encoder.c \
            ./liblzma/common/vli_size.c \
            ./liblzma/delta/delta_common.c \
            ./liblzma/delta/delta_decoder.c \
            ./liblzma/delta/delta_encoder.c \
            ./liblzma/lz/lz_decoder.c \
            ./liblzma/lz/lz_encoder.c \
            ./liblzma/lz/lz_encoder_mf.c \
            ./liblzma/lzma/fastpos_table.c \
            ./liblzma/lzma/lzma2_decoder.c \
            ./liblzma/lzma/lzma2_encoder.c \
            ./liblzma/lzma/lzma_decoder.c \
            ./liblzma/lzma/lzma_encoder.c \
            ./liblzma/lzma/lzma_encoder_optimum_fast.c \
            ./liblzma/lzma/lzma_encoder_optimum_normal.c \
            ./liblzma/lzma/lzma_encoder_presets.c \
            ./liblzma/rangecoder/price_table.c \
            ./liblzma/simple/arm.c \
            ./liblzma/simple/armthumb.c \
            ./liblzma/simple/ia64.c \
            ./liblzma/simple/powerpc.c \
            ./liblzma/simple/simple_coder.c \
            ./liblzma/simple/simple_decoder.c \
            ./liblzma/simple/simple_encoder.c \
            ./liblzma/simple/sparc.c \
            ./liblzma/simple/x86.c

# Default rules for deployment.
#unix {
#    target.path = /usr/lib
#}
#!isEmpty(target.path): INSTALLS += target


五、编译实践

用QtCreator程序,打开005.lzma-5.2.7.pro文件:在这里插入图片描述
在windows下编译,形成:
在这里插入图片描述

在linux下编译,形成:
在这里插入图片描述
在macos下编译,形成:
在这里插入图片描述

文章来源:https://blog.csdn.net/LuckyHanMo/article/details/135756772
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。