diff --git a/CMakeLists.txt b/CMakeLists.txt index 188e994..7c3e475 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -143,7 +143,7 @@ if(NOT QUAZIP_QT_ZLIB_USED) set(QUAZIP_LIB_LIBRARIES ${QUAZIP_LIB_LIBRARIES} ${ZLIB_LIBRARY}) else() - find_package(ZLIB REQUIRED) + find_package(ZLIB 1.3.1 EXACT REQUIRED) set(QUAZIP_LIB_LIBRARIES ${QUAZIP_LIB_LIBRARIES} ZLIB::ZLIB) endif() endif() @@ -162,7 +162,7 @@ if(QUAZIP_BZIP2) set(QUAZIP_BZIP2 ON) if(NOT QUAZIP_FORCE_FETCH_LIBS) - find_package(BZip2 QUIET) + find_package(BZip2 1.0.8 EXACT QUIET) endif() if(BZIP2_FOUND AND NOT QUAZIP_FORCE_FETCH_LIBS) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 223be93..e7e5a43 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -23,7 +23,7 @@ some guidelines. 1. Changes should be backwards-compatible. Don't just change method names and their signatures randomly. Don't just remove deprecated features—some -of them are there to keep compatibility with old Qt versions. Even Qt 4 is +of them are there to keep compatibility with old Qt versions. Even Qt 5 is still supported! Unless you're working on some sort of `pre2.0` branch or something like that, you should keep ABI compatibility as well! Meaning, no adding virtual functions, no changing parameter types, even if it's diff --git a/README.md b/README.md index 0ba0620..9fabe97 100644 --- a/README.md +++ b/README.md @@ -35,14 +35,32 @@ quazip/(un)zip.h files for details, but basically it's the zlib license. ## Dependencies You need at least the following dependencies: -- zlib +- `cmake>=3.15` - Qt6 or Qt5 (searched in that order) +- Optional dependencies (choose one): + * `miniconda` + * `conan` + * `vcpkg` ## Linux +Using miniconda ``` -sudo apt-get install zlib1g-dev libbz2-dev -cmake -B build -cmake --build build +conda env create -f dependencies.yml --prefix zlib +cmake -DZLIB_ROOT=./zlib/bin -B build +cmake --build build --config Release +``` + +Using conan v2 +``` +conan install . -of build -s build_type=Release -o *:shared=False --build=missing +cmake --preset conan +cmake --build build --config Release +``` + +Using vcpkg +``` +cmake -B build --preset vcpkg +cmake --build build --config Release ``` ## Windows @@ -54,9 +72,10 @@ If you don't use a package manager you will have to add library and include dire Qt is not installed as a dependency of either vcpkg or conan. ### x64 -Using vcpkg +Using miniconda ``` -cmake --preset vcpkg +conda env create -f dependencies.yml --prefix zlib +cmake -DZLIB_ROOT=%cd%\zlib\Library -B build cmake --build build --config Release ``` @@ -67,29 +86,44 @@ cmake --preset conan cmake --build build --config Release ``` +Using vcpkg +``` +cmake -B build --preset vcpkg +cmake --build build --config Release +``` + ### x86 Only Qt5 is tested on x86. Using vcpkg ``` -cmake --preset vcpkg_x86 +cmake -B build --preset vcpkg_x86 cmake --build build --config Release ``` Using conan v2 ``` conan install . -of build -s build_type=Release -s:h arch=x86 -o *:shared=False --build=missing -cmake --preset conan_x86 +cmake -B build --preset conan_x86 cmake --build build --config Release ``` ## Additional build options -If you built Qt from source and installed it, you might need to tell CMake where to find it, for example: `-DCMAKE_PREFIX_PATH="/usr/local/Qt-6.8.2"`. -Alternatively, if you did not install the source build it might look something like: `-DCMAKE_PREFIX_PATH="/home/you/qt-everywhere-src-6.8.2/qtbase/lib/cmake"`. -Replace `qtbase` if you used a custom prefix at `configure` step. +If you built Qt from source and installed it, you might need to tell CMake where to find it, for example: `-DCMAKE_PREFIX_PATH="/usr/local/Qt-6.8.2"`. Alternatively, if you did not install the source build it might look something like: `-DCMAKE_PREFIX_PATH="/home/you/qt-everywhere-src-6.8.2/qtbase/lib/cmake"`. Replace `qtbase` if you used a custom prefix at `configure` step. Qt installed through Linux distribution packages or official Qt online installer should be detected automatically. +If you wish to build in debug mode, then in the cmake configuration command add: `-DCMAKE_BUILD_TYPE=Debug` and in the cmake build command and change `Release` to `Debug`: `cmake --build build --config Debug`. + +You may also build without BZIP2 when configuring the project with cmake: `-DQUAZIP_BZIP2=OFF`. + +Specifying a directory to install the build is also possible when running the cmake configure and build commands, like so: + +``` +cmake -DCMAKE_INSTALL_PREFIX=/path/to/install +cmake --build build --config Release --target install +``` + CMake is used to configure and build the project. A typical configure, build, install and clean is shown below. ``` diff --git a/cmake/clone-repo.cmake b/cmake/clone-repo.cmake index 2ffb4b2..beaf614 100644 --- a/cmake/clone-repo.cmake +++ b/cmake/clone-repo.cmake @@ -7,7 +7,7 @@ macro(clone_repo name url) set(${name_upper}_REPOSITORY ${url}) endif() if(NOT ${name_upper}_TAG) - set(${name_upper}_TAG master) + set(${name_upper}_TAG bzip2-1.0.8) endif() message(STATUS "Fetching ${name} ${${name_upper}_REPOSITORY} ${${name_upper}_TAG}") diff --git a/dependencies.yml b/dependencies.yml new file mode 100644 index 0000000..f68bc5f --- /dev/null +++ b/dependencies.yml @@ -0,0 +1,2 @@ +dependencies: + - zlib=1.3.1. \ No newline at end of file diff --git a/vcpkg.json b/vcpkg.json index f5fc818..36f0f8f 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -2,8 +2,8 @@ "version": "1.5", "name": "quazip", "dependencies": [ - "zlib", - "bzip2" + {"name": "zlib", "version": "1.3.1"}, + {"name": "bzip2", "version": "1.0.8"} ], "vcpkg-configuration": { "default-registry": {