diff --git a/Build-Instructions-for-Windows.md b/Build-Instructions-for-Windows.md index 8b1c915..62270c2 100644 --- a/Build-Instructions-for-Windows.md +++ b/Build-Instructions-for-Windows.md @@ -1,47 +1,96 @@ -## Build Zeal with vcpkg +## Build Dependencies + +### Compiler + +Any C++17 compatible compiler should work. Microsoft Visual C++ is recommended. + +### Build Tools + +* [CMake](https://cmake.org/) +* [Ninja](https://ninja-build.org/) (optional) + +Install with [Scoop](https://scoop.sh/): -Use vcpkg install dependencies, then build ```powershell -git clone https://github.com/microsoft/vcpkg.git --depth=1 -.\vcpkg\bootstrap-vcpkg.bat -.\vcpkg\vcpkg install --triplet=x64-windows -cmake -B ./build -S . "-DCMAKE_TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake" -cmake --build ./build +scoop install cmake ninja ``` -## Installing dependencies -Qt 5.5 mingw version: [https://download.qt.io/new_archive/qt/5.5/5.5.1/qt-opensource-windows-x86-mingw492-5.5.1.exe](https://github.com/EclipseFond/eclipse-collections/releases/download/v2.0.15/AppLauncher-inst-win64.zip) +Install with [Windows Package Manager](https://learn.microsoft.com/en-us/windows/package-manager/): -libarchive: [https://bintray.com/zealdocs/windows-ci/download_file?file_path=libarchive-3.2.1-win32-mingw492.7z](https://github.com/EclipseFond/eclipse-collections/releases/download/v2.0.15/AppLauncher-inst-win64.zip) - -sqlite3: [http://sqlite.org/2016/sqlite-amalgamation-3140200.zip](https://github.com/EclipseFond/eclipse-collections/releases/download/v2.0.15/AppLauncher-inst-win64.zip) - - -## Building Zeal (Use the path setting above) ```powershell -# Set Qt Install dir -Set-Variable -Name "qt_dir" -Value "C:\Qt\Qt5.5.1" +winget install -e --id Kitware.CMake +winget install -e --id Ninja-build.Ninja +``` -$env:Path = "${qt_dir}\5.5\mingw492_32\bin;${qt_dir}\Tools\mingw492_32\bin;C:\Program Files\7-Zip;$env:Path" +### Vcpkg -# Put libarchive to mingw path -7z x libarchive-3.2.1-win32-mingw492.7z -o${qt_dir}\Tools\mingw492_32\i686-w64-mingw32 +[Vcpkg](https://vcpkg.io/en/) makes it easy to manage, build and deploy dependencies on Windows. -# Building sqlite and Put it to mingw path -7z x sqlite-amalgamation-3140200.zip -cd sqlite-amalgamation-3140200 -gcc -c sqlite3.c -ar rcs libsqlite3.a sqlite3.o -cp *.h ${qt_dir}\Tools\mingw492_32\i686-w64-mingw32\include -cp *.a ${qt_dir}\Tools\mingw492_32\i686-w64-mingw32\lib +To install vcpkg follow the [official guide](https://vcpkg.io/en/getting-started.html). -# Get and building zeal -git clone -q --branch=master https://github.com/zealdocs/zeal.git C:\projects\zeal -qmake -r -spec win32-g++ -mingw32-make +Here is how vcpkg can be installed in `c:\dev\vcpkg` directory: + +```powershell +New-Item -ItemType Directory -Path c:\dev\vcpkg -Force +cd c:\dev\vcpkg +git clone https://github.com/microsoft/vcpkg.git +.\vcpkg\bootstrap-vcpkg.bat +``` + +### Qt + +Building [Qt](https://www.qt.io/) with vcpkg is possible, but requires significant time investment and processing power. + +Installing official [Qt SDK](https://www.qt.io/download-qt-installer-oss) is recommended. Qt 6.5.2 or later is required to build installer package. + +Alternatively, [aqtinstall](https://github.com/miurahr/aqtinstall) is a handy tool to download official Qt binaries without installer: + +```powershell +aqt install-qt -O c:/dev/qt windows desktop 6.5.2 win64_msvc2019_64 --modules qtwebchannel qtwebengine qtpositioning qtimageformats +``` + +## Build Zeal + +Set the following environment variables (update paths accordingly): + +```powershell +$Env:VCPKG_ROOT="c:/dev/vcpkg" +$Env:VCPKG_DEFAULT_TRIPLET="x64-windows-release" +$Env:QT_DIR="c:/dev/qt/6.5.2/msvc2019_64" +$Env:Qt6_DIR="c:/dev/qt/6.5.2/msvc2019_64" +``` + +All the commands listed below need to be executed in the directory where source code of Zeal is located, e.g. `c:\dev\zeal`. + +While not required, it is recommended to use [CMake presets](https://cmake.org/cmake/help/latest/manual/cmake-presets.7.html) for building. In this scenario, Zeal can be built with one command: + +```powershell +cmake --build build --preset ninja-multi-vcpkg-release +``` + +Replace preset with `ninja-multi-vcpkg-portable` if interested in portable build. + +If not using presets, use the following commands: + +```powershell +cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_TOOLCHAIN_FILE="$Env:VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake" +cmake --build build ``` ## Packaging -to be added -You can use Qt Creator run and debug the program now. \ No newline at end of file +To produce MSI package (not applicable to portable build), install [WiX toolset](https://wixtoolset.org/). Make sure installed binaries are available in `%PATH%`. + +WiX toolset can be installed with Scoop: + +```powershell +scoop install wixtoolset +``` + +*Note:* CMake (CPack) currently [only supports](https://gitlab.kitware.com/cmake/cmake/-/issues/23910) version 3 of the WiX toolset. + +Now both ZIP and MSI packages can be built: + +```powershell +cmake --build build --preset ninja-multi-vcpkg-release --target package +``` \ No newline at end of file