From ad84c6ceb5c1d140c4264961e9268273e3788ba8 Mon Sep 17 00:00:00 2001 From: enrpadilla Date: Sat, 5 Apr 2025 21:58:29 -0500 Subject: [PATCH 1/9] Use a specific version of zlib --- CONTRIBUTING.md | 2 +- README.md | 37 ++++++++++++++++++++++++++----------- dependencies.yml | 2 ++ 3 files changed, 29 insertions(+), 12 deletions(-) create mode 100644 dependencies.yml diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 223be93f..e7e5a432 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 0ba06207..ef1d853f 100644 --- a/README.md +++ b/README.md @@ -35,14 +35,16 @@ quazip/(un)zip.h files for details, but basically it's the zlib license. ## Dependencies You need at least the following dependencies: -- zlib +- miniconda +- `cmake>=3.15` - Qt6 or Qt5 (searched in that order) + ## Linux ``` -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=quazip_project_directory/zlib/Library -B build +cmake --build build --config Release ``` ## Windows @@ -56,14 +58,16 @@ Qt is not installed as a dependency of either vcpkg or conan. ### x64 Using vcpkg ``` -cmake --preset vcpkg +conda env create -f dependencies.yml --prefix zlib +cmake -DZLIB_ROOT=quazip_project_directory\zlib\Library -B build --preset vcpkg cmake --build build --config Release ``` Using conan v2 ``` +conda env create -f dependencies.yml --prefix zlib conan install . -of build -s build_type=Release -o *:shared=False --build=missing -cmake --preset conan +cmake -DZLIB_ROOT=quazip_project_directory\zlib\Library -B build --preset conan cmake --build build --config Release ``` @@ -72,24 +76,35 @@ Only Qt5 is tested on x86. Using vcpkg ``` -cmake --preset vcpkg_x86 +conda env create -f dependencies.yml --prefix zlib +cmake -DZLIB_ROOT=quazip_project_directory\zlib\Library -B build --preset vcpkg_x86 cmake --build build --config Release ``` Using conan v2 ``` +conda env create -f dependencies.yml --prefix zlib conan install . -of build -s build_type=Release -s:h arch=x86 -o *:shared=False --build=missing -cmake --preset conan_x86 +cmake -DZLIB_ROOT=quazip_project_directory\zlib\Library -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/dependencies.yml b/dependencies.yml new file mode 100644 index 00000000..5fd4f16b --- /dev/null +++ b/dependencies.yml @@ -0,0 +1,2 @@ +dependencies: + - zlib=1.2.13 \ No newline at end of file From b87e5875f1a1ca07ec5322a6628c5f694db5871e Mon Sep 17 00:00:00 2001 From: enrpadilla Date: Tue, 8 Apr 2025 23:56:43 -0500 Subject: [PATCH 2/9] Specify versions for zlib and bzip2 in vcpkg.json to be the same as conan.py --- vcpkg.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vcpkg.json b/vcpkg.json index f5fc8188..36f0f8f4 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": { From b8f7de94ad743f1306037366cfd0430ad08bf258 Mon Sep 17 00:00:00 2001 From: enrpadilla Date: Tue, 8 Apr 2025 23:57:25 -0500 Subject: [PATCH 3/9] Pin bzip2 in the conda dependencies.yml file --- dependencies.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dependencies.yml b/dependencies.yml index 5fd4f16b..9fc7eec6 100644 --- a/dependencies.yml +++ b/dependencies.yml @@ -1,2 +1,3 @@ dependencies: - - zlib=1.2.13 \ No newline at end of file + - zlib=1.3.1 + - bzip2=1.0.8 \ No newline at end of file From a3e387f66c2cd9624aed82f51fad9edefe6bc44d Mon Sep 17 00:00:00 2001 From: enrpadilla Date: Wed, 9 Apr 2025 00:04:26 -0500 Subject: [PATCH 4/9] Remove specifying the zlib root when building with vcpkg and conan --- README.md | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index ef1d853f..1bde02c2 100644 --- a/README.md +++ b/README.md @@ -35,11 +35,9 @@ quazip/(un)zip.h files for details, but basically it's the zlib license. ## Dependencies You need at least the following dependencies: -- miniconda - `cmake>=3.15` - Qt6 or Qt5 (searched in that order) - ## Linux ``` conda env create -f dependencies.yml --prefix zlib @@ -58,16 +56,14 @@ Qt is not installed as a dependency of either vcpkg or conan. ### x64 Using vcpkg ``` -conda env create -f dependencies.yml --prefix zlib -cmake -DZLIB_ROOT=quazip_project_directory\zlib\Library -B build --preset vcpkg +cmake -B build --preset vcpkg cmake --build build --config Release ``` Using conan v2 ``` -conda env create -f dependencies.yml --prefix zlib conan install . -of build -s build_type=Release -o *:shared=False --build=missing -cmake -DZLIB_ROOT=quazip_project_directory\zlib\Library -B build --preset conan +cmake --preset conan cmake --build build --config Release ``` @@ -76,16 +72,14 @@ Only Qt5 is tested on x86. Using vcpkg ``` -conda env create -f dependencies.yml --prefix zlib -cmake -DZLIB_ROOT=quazip_project_directory\zlib\Library -B build --preset vcpkg_x86 +cmake -B build --preset vcpkg_x86 cmake --build build --config Release ``` Using conan v2 ``` -conda env create -f dependencies.yml --prefix zlib conan install . -of build -s build_type=Release -s:h arch=x86 -o *:shared=False --build=missing -cmake -DZLIB_ROOT=quazip_project_directory\zlib\Library -B build --preset conan_x86 +cmake -B build --preset conan_x86 cmake --build build --config Release ``` From 1cb4e3872cc51be9606faa9728753414bd86f9d3 Mon Sep 17 00:00:00 2001 From: enrpadilla Date: Wed, 9 Apr 2025 00:15:10 -0500 Subject: [PATCH 5/9] Update README.md to include miniconda for Linux and Windows builds and updating Linux builds to have the option to build using vcpkg and conan --- README.md | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 1bde02c2..a939db72 100644 --- a/README.md +++ b/README.md @@ -37,11 +37,29 @@ quazip/(un)zip.h files for details, but basically it's the zlib license. You need at least the following dependencies: - `cmake>=3.15` - Qt6 or Qt5 (searched in that order) +- Optional dependencies (choose one): + * `miniconda` + * `conan` + * `vcpkg` ## Linux +Using miniconda ``` conda env create -f dependencies.yml --prefix zlib -cmake -DZLIB_ROOT=quazip_project_directory/zlib/Library -B build +cmake -DZLIB_ROOT=/quazip_project_root_dir/zlib/Library -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 ``` @@ -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 -B build --preset vcpkg +conda env create -f dependencies.yml --prefix dependencies +cmake -DZLIB_ROOT=quazip_project_root_dir\dependencies\Library -B build cmake --build build --config Release ``` @@ -67,6 +86,12 @@ 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. From 44d6d271582ab3d934998ba29c28063447792788 Mon Sep 17 00:00:00 2001 From: enrpadilla Date: Wed, 9 Apr 2025 01:07:44 -0500 Subject: [PATCH 6/9] Remove bzip2 from buidling with miniconda, since it does not include a full installation --- dependencies.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dependencies.yml b/dependencies.yml index 9fc7eec6..f68bc5f0 100644 --- a/dependencies.yml +++ b/dependencies.yml @@ -1,3 +1,2 @@ dependencies: - - zlib=1.3.1 - - bzip2=1.0.8 \ No newline at end of file + - zlib=1.3.1. \ No newline at end of file From fe698e74e11f349979021e72286dabb635f4c7b0 Mon Sep 17 00:00:00 2001 From: enrpadilla Date: Wed, 9 Apr 2025 01:16:58 -0500 Subject: [PATCH 7/9] Use the bzip2-1.0.8 release tag --- cmake/clone-repo.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/clone-repo.cmake b/cmake/clone-repo.cmake index 2ffb4b2b..beaf6142 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}") From c71f09c769c88f1a34df28eab69b2e8ca6f2c5fc Mon Sep 17 00:00:00 2001 From: enrpadilla Date: Wed, 9 Apr 2025 01:18:04 -0500 Subject: [PATCH 8/9] Specify the version of zlib and bzip2 (if it is being set to on) needed --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 188e994e..7c3e4752 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) From 7943f90735034e4ca0d71f6dcfc77a1ceb5201df Mon Sep 17 00:00:00 2001 From: enrpadilla Date: Sun, 13 Apr 2025 09:46:15 -0500 Subject: [PATCH 9/9] Fix paths for specifying the zlib root directory --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index a939db72..9fabe97f 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ You need at least the following dependencies: Using miniconda ``` conda env create -f dependencies.yml --prefix zlib -cmake -DZLIB_ROOT=/quazip_project_root_dir/zlib/Library -B build +cmake -DZLIB_ROOT=./zlib/bin -B build cmake --build build --config Release ``` @@ -74,8 +74,8 @@ Qt is not installed as a dependency of either vcpkg or conan. ### x64 Using miniconda ``` -conda env create -f dependencies.yml --prefix dependencies -cmake -DZLIB_ROOT=quazip_project_root_dir\dependencies\Library -B build +conda env create -f dependencies.yml --prefix zlib +cmake -DZLIB_ROOT=%cd%\zlib\Library -B build cmake --build build --config Release ```