Skip to content

Building the library

Oz edited this page Dec 14, 2024 · 36 revisions

🧰 Requirements

  • Operating System: Windows, Linux, macOS.
  • Compiler: MSVC 2015 or later, MinGW v6.4 or later, GCC v4.9 or later, Clang 3.5 or later.
  • Build Automation: CMake v3.11 or later
  • Third-party libraries: 7-zip's source code (any version, e.g. v23.01)

Note

  • MSVC 2010 was supported until v2.x, MSVC 2012/2013 until v3.x.
  • Since the stable v4, the source code of 7-zip is automatically downloaded when configuring/using the bit7z project via CMake; you can specify the version of 7-zip to be used for compiling bit7z by passing the option BIT7Z_7ZIP_VERSION to CMake (e.g., -DBIT7Z_7ZIP_VERSION="22.01").
    • Alternatively, you can manually specify the path to the 7-zip source code using the BIT7Z_CUSTOM_7ZIP_PATH CMake option.
    • You should preferably use the same 7-zip version used to build the shared libraries you are going to employ in your software.

⚙️ How to Build

The library can be built using CMake:

cd <bit7z folder>
mkdir build && cd build
cmake ../ -DCMAKE_BUILD_TYPE=Release # Specify other bit7z build options here, e.g., -DBIT7Z_AUTO_FORMAT=ON
cmake --build . -j --config Release

A .lib/.a library file will be produced in the <bit7z folder>/lib/<arch>/ folder.

Once built, you can integrate the library in your project by manually link it.

🛠️ Build options

The library is highly customizable; you can find a detailed description of the available build options here.

Clone this wiki locally