From 7df285bdad15b4bc99244f3428e0134a306106d0 Mon Sep 17 00:00:00 2001 From: Jakub Melka Date: Tue, 2 Jul 2024 10:28:33 +0200 Subject: [PATCH] Update of windows/linux install workflow --- .github/workflows/LinuxInstall.yml | 29 +++-- .github/workflows/WindowsInstall.yml | 120 ++++++++++++++---- AppxManifest.xml.in | 20 +-- CMakeLists.txt | 13 +- .../io.github.JakubMelka.Pdf4qt.appdata.xml | 15 +-- WixInstaller/Product.wxs.in | 52 ++++---- version.txt.in | 1 + 7 files changed, 167 insertions(+), 83 deletions(-) create mode 100644 version.txt.in diff --git a/.github/workflows/LinuxInstall.yml b/.github/workflows/LinuxInstall.yml index 0a18002..75d4b00 100644 --- a/.github/workflows/LinuxInstall.yml +++ b/.github/workflows/LinuxInstall.yml @@ -1,7 +1,7 @@ name: Linux_AppImage on: - create: + push: tags: - 'v*' @@ -18,6 +18,7 @@ jobs: sudo apt-get install -y libxcb-cursor0 sudo apt-get install -y libspeechd2 sudo apt-get install -y gnupg2 wget + sudo apt-get install -y appstream wget -c "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage" chmod +x appimagetool-x86_64.AppImage sudo mv appimagetool-x86_64.AppImage /usr/local/bin/appimagetool @@ -106,6 +107,16 @@ jobs: cmake --build build -j6 cmake --install build + - name: Read version + id: get_version + run: | + version=$(cat "pdf4qt/build/version.txt") + echo "Version: $version" + echo "appimagefilename=PDF4QT-$version-x86_64.AppImage" >> $GITHUB_ENV + echo "AppImage file name: PDF4QT-$version-x86_64.AppImage" + env: + appimagefilename: ${{ env.appimagefilename }} + - name: 'Linux Deploy Qt' working-directory: pdf4qt/build run: | @@ -117,30 +128,30 @@ jobs: - name: Sign and Repack AppImage working-directory: pdf4qt/build run: | - export GPG_TTY=$(tty) - echo "${{ secrets.PGP_PASSPHRASE }}" | appimagetool -s --sign-key "${{ secrets.PGP_KEY_ID }}" install/ io.github.JakubMelka.Pdf4qt.AppImage + appimagetool -s --sign-key "${{ secrets.PGP_KEY_ID }}" install/ ${{ env.appimagefilename }} - name: Manual signature run: | - gpg --batch --yes --verbose --pinentry-mode loopback --detach-sign --passphrase "${{ secrets.PGP_PASSPHRASE }}" --local-user "${{ secrets.PGP_KEY_ID }}" --output pdf4qt/build/io.github.JakubMelka.Pdf4qt.AppImage.sig pdf4qt/build/io.github.JakubMelka.Pdf4qt.AppImage + gpg --batch --yes --verbose --pinentry-mode loopback --detach-sign --passphrase "${{ secrets.PGP_PASSPHRASE }}" --local-user "${{ secrets.PGP_KEY_ID }}" --output pdf4qt/build/${{ env.appimagefilename }}.sig pdf4qt/build/${{ env.appimagefilename }} - name: Verify AppImage Detached Signature run: | echo "${{ secrets.PGP_PUBLIC_KEY }}" | gpg --batch --import - gpg --verify pdf4qt/build/io.github.JakubMelka.Pdf4qt.AppImage.sig pdf4qt/build/io.github.JakubMelka.Pdf4qt.AppImage + gpg --verify pdf4qt/build/${{ env.appimagefilename }}.sig pdf4qt/build/${{ env.appimagefilename }} - name: Upload AppImage Package uses: actions/upload-artifact@v4 with: - name: ubuntu-appimage - path: ./pdf4qt/build/io.github.JakubMelka.Pdf4qt.AppImage + name: ${{ env.appimagefilename }} + path: ./pdf4qt/build/${{ env.appimagefilename }} retention-days: 30 + compression-level: 0 - name: Upload AppImage Signature File uses: actions/upload-artifact@v4 with: - name: ubuntu-appimage-sig - path: ./pdf4qt/build/io.github.JakubMelka.Pdf4qt.AppImage.sig + name: ${{ env.appimagefilename }}.sig + path: ./pdf4qt/build/${{ env.appimagefilename }}.sig retention-days: 30 if-no-files-found: warn compression-level: 0 diff --git a/.github/workflows/WindowsInstall.yml b/.github/workflows/WindowsInstall.yml index 585c6a7..9569af1 100644 --- a/.github/workflows/WindowsInstall.yml +++ b/.github/workflows/WindowsInstall.yml @@ -16,7 +16,40 @@ jobs: uses: actions/checkout@v4 with: path: pdf4qt - + + - name: Add MakeAppx to PATH + shell: pwsh + run: | + # Define the base path to Windows Kits + $basePath = "C:\Program Files (x86)\Windows Kits\10\bin" + + # Get directories in the base path and sort them by version number + $sdkDirs = Get-ChildItem -Path $basePath -Directory | Sort-Object Name -Descending + + # Find the first directory that contains the MakeAppx.exe + $sdkPath = $null + foreach ($dir in $sdkDirs) { + $path = Join-Path $dir.FullName "x64" + if (Test-Path (Join-Path $path "MakeAppx.exe")) { + $sdkPath = $path + break + } + } + + # Add the highest version SDK path to the PATH environment variable + if ($sdkPath) { + Write-Host "Adding $sdkPath to PATH" + echo "PATH=$env:PATH;$sdkPath" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + } else { + Write-Error "MakeAppx.exe not found in any Windows SDK directories" + } + + - name: Verify MakeAppx Path + shell: pwsh + run: | + $makeAppxPath = Get-Command MakeAppx.exe | Select-Object -ExpandProperty Definition + Write-Host "MakeAppx.exe found at: $makeAppxPath" + - name: 'VCPKG: Set up VCPKG' run: | git clone --depth=1 https://github.com/microsoft/vcpkg.git @@ -39,7 +72,7 @@ jobs: - name: 'VCPKG: Install project dependencies' run: | - .\vcpkg install tbb openssl lcms zlib openjpeg freetype ijg-libjpeg libpng blend2d --triplet x64-windows + .\vcpkg install tbb openssl lcms zlib openjpeg freetype ijg-libjpeg libpng blend2d brotli bzip2 hwloc vcpkg-cmake vcpkg-cmake-config vcpkg-cmake-get-vars --triplet x64-windows working-directory: vcpkg - name: Install Qt @@ -50,9 +83,33 @@ jobs: target: 'desktop' dir: '${{ github.workspace }}/qt/' install-deps: 'true' - modules: 'qtspeech qtmultimedia' + modules: 'qtspeech qtmultimedia qtimageformats' cache: 'true' cache-key-prefix: ${{ runner.os }}-qt-672 + + + - name: Find VC Redistributable Directories + shell: pwsh + run: | + # Define the base path to the VC redistributable directories + $basePath = "C:\Program Files\Microsoft Visual Studio\2022\*\VC\Redist\MSVC" + + # Find directories that match the pattern for VC redistributables + $redistDirs = Get-ChildItem -Path $basePath -Recurse -Directory -Filter "Microsoft.VC*.CRT" | Where-Object { $_.FullName -notmatch "debug_nonredist" } + + # Extract the toolset version from the directory names + if ($redistDirs) { + $firstRedistDir = $redistDirs | Select-Object -First 1 + $toolsetVersion = $firstRedistDir.Name -replace '^Microsoft\.VC(\d+)\.CRT$', '$1' + Write-Host "Found MSVC Toolset Version: $toolsetVersion" + Write-Host "Found MSVC Redistributable Full Path: $firstRedistDir" + echo "MSVC_TOOLSET_VERSION=$toolsetVersion" >> $env:GITHUB_ENV + echo "VCToolsRedistDir=$($firstRedistDir.Parent.Parent.Parent.FullName)" >> $env:GITHUB_ENV + echo "VSCMD_ARG_TGT_ARCH=x64" >> $env:GITHUB_ENV + echo "MSVC_REDISTRIBUTABLES_PATH=$firstRedistDir" >> $env:GITHUB_ENV + } else { + Write-Error "No valid redistributable directories found." + } - name: Build project working-directory: pdf4qt @@ -61,34 +118,51 @@ jobs: cmake -B build -S . -DCMAKE_BUILD_TYPE=Release -DCMAKE_VCPKG_BUILD_TYPE=Release -DPDF4QT_INSTALL_QT_DEPENDENCIES=ON -DPDF4QT_INSTALL_DEPENDENCIES=ON -DCMAKE_TOOLCHAIN_FILE="${env:GITHUB_WORKSPACE}\vcpkg\scripts\buildsystems\vcpkg.cmake" -DPDF4QT_QT_ROOT="${env:Qt6_DIR}" -DPDF4QT_INSTALL_MSVC_REDISTRIBUTABLE=ON -DPDF4QT_INSTALL_PREPARE_WIX_INSTALLER=ON -DPDF4QT_INSTALL_TO_USR=ON cmake --build build --config Release -j6 cmake --install build - + env: + VCToolsRedistDir: ${{ env.VCToolsRedistDir }} + VSCMD_ARG_TGT_ARCH: ${{ env.VSCMD_ARG_TGT_ARCH }} + MSVC_TOOLSET_VERSION: ${{ env.MSVC_TOOLSET_VERSION }} + MSVC_REDISTRIBUTABLES_PATH: ${{ env.MSVC_REDISTRIBUTABLES_PATH }} + - name: Read version id: get_version + shell: pwsh run: | - version=$(cat ".\pdf4qt\build\version.txt") - echo "Version: $version" - echo "pdf4qt_version=$version" >> $GITHUB_ENV - env: - pdf4qt_version: ${{ env.pdf4qt_version }} - - - name: Install WiX Toolset - run: choco install wix - + $version = Get-Content -Path ".\pdf4qt\build\version.txt" -Raw + $version = $version.Trim() # Odstraní případné prázdné znaky kolem verze + Write-Host "Version: $version" + echo "pdf4qt_version=$version" >> $env:GITHUB_ENV + echo "msipackagefilename=JakubMelka.PDF4QT_${version}.msi" >> $env:GITHUB_ENV + Write-Host "MSI package file name: JakubMelka.PDF4QT_${version}.msi" + + - name: Find WiXUIExtension.dll + id: find_wixui_extension + shell: pwsh + run: | + $wixPath = "C:\Program Files (x86)\WiX Toolset v3.*\bin\WiXUIExtension.dll" + $wixUIExtensionPath = Get-ChildItem -Path $wixPath -ErrorAction SilentlyContinue | Select-Object -First 1 + + if ($null -ne $wixUIExtensionPath) { + Write-Output "Found WiXUIExtension.dll at: $($wixUIExtensionPath.FullName)" + echo "wixuiextpath=$($wixUIExtensionPath.FullName)" >> $env:GITHUB_ENV + } else { + Write-Error "WiXUIExtension.dll not found in the expected path." + } + + - name: Create MSI Package + working-directory: pdf4qt\build\WixInstaller + run: | + candle -v -d"SolutionDir=." -d"SolutionExt=.sln" -d"SolutionFileName=PDF4QT.sln" -d"SolutionName=PDF4QT" -d"SolutionPath=PDF4QT.sln" -d"Configuration=Release" -d"OutDir=bin\Release\" -d"Platform=x86" -d"ProjectDir=." -d"ProjectExt=.wixproj" -d"ProjectFileName=PDF4QT.wixproj" -d"ProjectName=PDF4QT" -d"ProjectPath=PDF4QT.wixproj" -d"TargetDir=bin\Release\" -d"TargetExt=.msi" -d"TargetFileName=${{ env.msipackagefilename }}" -d"TargetName=PDF4QT" -d"TargetPath=bin\Release\${{ env.msipackagefilename }}" -out obj\Release\ -arch x86 -ext "${{ env.wixuiextpath }}" Product.wxs + Light -v -out ${{ github.workspace }}\pdf4qt\build\install\${{ env.msipackagefilename }} -pdbout .\bin\Release\PDF4QT.wixpdb -cultures:null -ext "${{ env.wixuiextpath }}" -contentsfile obj\Release\PDF4QT.wixproj.BindContentsFileListnull.txt -outputsfile obj\Release\PDF4QT.wixproj.BindOutputsFileListnull.txt -builtoutputsfile obj\Release\PDF4QT.wixproj.BindBuiltOutputsFileListnull.txt -wixprojectfile .\PDF4QT.wixproj obj\Release\Product.wixobj + - name: Create MSIX Package run: | MakeAppx pack /d ".\pdf4qt\build\install\usr\bin" /p ".\pdf4qt\build\install\JakubMelka.PDF4QT_${{ env.pdf4qt_version }}.msix" - - name: Create MSI Package - working-directory: pdf4qt\WixInstaller - run: | - candle -d"SolutionDir=." -d"SolutionExt=.sln" -d"SolutionFileName=PDF4QT.sln" -d"SolutionName=PDF4QT" -d"SolutionPath=PDF4QT.sln" -d"Configuration=Release" -d"OutDir=bin\Release\" -d"Platform=x86" -d"ProjectDir=." -d"ProjectExt=.wixproj" -d"ProjectFileName=PDF4QT.wixproj" -d"ProjectName=PDF4QT" -d"ProjectPath=PDF4QT.wixproj" -d"TargetDir=bin\Release\" -d"TargetExt=.msi" -d"TargetFileName=PDF4QT.msi" -d"TargetName=PDF4QT" -d"TargetPath=bin\Release\PDF4QT.msi" -out obj\Release\ -arch x86 -ext "C:\Program Files (x86)\WiX Toolset v3.11\bin\\WixUIExtension.dll" Product.wxs - Light -out .\pdf4qt\build\install\PDF4QT.msi -pdbout .\bin\Release\PDF4QT.wixpdb -cultures:null -ext "C:\Program Files (x86)\WiX Toolset v3.11\bin\\WixUIExtension.dll" -contentsfile obj\Release\PDF4QT.wixproj.BindContentsFileListnull.txt -outputsfile obj\Release\PDF4QT.wixproj.BindOutputsFileListnull.txt -builtoutputsfile obj\Release\PDF4QT.wixproj.BindBuiltOutputsFileListnull.txt -wixprojectfile .\PDF4QT.wixproj obj\Release\Product.wixobj - - - name: Upload ZIP directory uses: actions/upload-artifact@v4 with: - name: 'pdf4qt-${{ runner.os }}.zip' + name: 'PDF4QT-${{ runner.os }}-${{ env.pdf4qt_version }}.zip' path: .\pdf4qt\build\install\usr\bin retention-days: 30 @@ -102,6 +176,6 @@ jobs: - name: Upload MSI package uses: actions/upload-artifact@v4 with: - name: 'JakubMelka.PDF4QT_${{ env.pdf4qt_version }}.msi' - path: .\pdf4qt\build\install\PDF4QT.msi + name: '${{ env.msipackagefilename }}' + path: .\pdf4qt\build\install\${{ env.msipackagefilename }} retention-days: 30 \ No newline at end of file diff --git a/AppxManifest.xml.in b/AppxManifest.xml.in index 4a1dd5e..8f4995c 100644 --- a/AppxManifest.xml.in +++ b/AppxManifest.xml.in @@ -1,6 +1,6 @@ - + PDF4QT Jakub Melka @@ -39,18 +39,18 @@ + Description="Take control of your documents. Manage whole documents or individual pages with ease. Merge documents into a single file, or split them into multiple ones. You can also move, clone, or add pages with a few clicks, all within an intuitive user interface." + BackgroundColor="transparent" + Square150x150Logo="assets\150x150\io.github.JakubMelka.Pdf4qt.Pdf4QtPageMaster.png" + Square44x44Logo="assets\44x44\io.github.JakubMelka.Pdf4qt.Pdf4QtPageMaster.png"> - + diff --git a/CMakeLists.txt b/CMakeLists.txt index c67aa78..ea5518d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,7 +17,7 @@ cmake_minimum_required(VERSION 3.16) -set(PDF4QT_VERSION 1.4.0) +set(PDF4QT_VERSION 1.4.0.0) message(STATUS "Build type - CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}") project(PDF4QT VERSION ${PDF4QT_VERSION} LANGUAGES CXX) @@ -143,6 +143,8 @@ endif() message("CMAKE_PREFIX_PATH = " ${CMAKE_PREFIX_PATH}) message("CMAKE_TOOLCHAIN_FILE = " ${CMAKE_TOOLCHAIN_FILE}) +configure_file(version.txt.in version.txt) + if(NOT PDF4QT_BUILD_ONLY_CORE_LIBRARY) if(WIN32) install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/Desktop/44x44/ @@ -254,8 +256,13 @@ if(PDF4QT_INSTALL_DEPENDENCIES AND NOT PDF4QT_BUILD_ONLY_CORE_LIBRARY) endif() if(WIN32 AND MSVC AND PDF4QT_INSTALL_MSVC_REDISTRIBUTABLE) - get_filename_component(MSVC_REDISTRIBUTABLES_PATH $ENV{VCToolsRedistDir}/$ENV{VSCMD_ARG_TGT_ARCH}/Microsoft.VC${MSVC_TOOLSET_VERSION}.CRT/ ABSOLUTE) - message(STATUS "MSVC Redistributable Package Path = ${MSVC_REDISTRIBUTABLES_PATH}") + if(DEFINED ENV{MSVC_REDISTRIBUTABLES_PATH}) + set(MSVC_REDISTRIBUTABLES_PATH $ENV{MSVC_REDISTRIBUTABLES_PATH}) + message(STATUS "Using existing MSVC Redistributable Package Path = ${MSVC_REDISTRIBUTABLES_PATH}") + else() + get_filename_component(MSVC_REDISTRIBUTABLES_PATH $ENV{VCToolsRedistDir}/$ENV{VSCMD_ARG_TGT_ARCH}/Microsoft.VC${MSVC_TOOLSET_VERSION}.CRT/ ABSOLUTE) + message(STATUS "MSVC Redistributable Package Path = ${MSVC_REDISTRIBUTABLES_PATH}") + endif() install(DIRECTORY ${MSVC_REDISTRIBUTABLES_PATH}/ RUNTIME DESTINATION ${PDF4QT_INSTALL_LIB_DIR}/ diff --git a/Desktop/io.github.JakubMelka.Pdf4qt.appdata.xml b/Desktop/io.github.JakubMelka.Pdf4qt.appdata.xml index 2344c5d..86aaca5 100644 --- a/Desktop/io.github.JakubMelka.Pdf4qt.appdata.xml +++ b/Desktop/io.github.JakubMelka.Pdf4qt.appdata.xml @@ -24,7 +24,7 @@ io.github.JakubMelka.Pdf4qt.desktop - + @@ -36,14 +36,11 @@ - - offline-only - - Browse PDF files easily and efficientlyhttps://jakubmelka.github.io/assets/flatpak/profi-default.png - Utilize the 'magnifying glass' feature to zoom in on specific sections of the pagehttps://jakubmelka.github.io/assets/flatpak/profi-magnifier.png - Display statistics for various content types within the PDF filehttps://jakubmelka.github.io/assets/flatpak/profi-object-statistics.png - View the document detailshttps://jakubmelka.github.io/assets/flatpak/profi-properties.png - List of add-ons available for the PDF editorhttps://jakubmelka.github.io/assets/flatpak/profi-addons.png + Browse PDF files easily and efficientlyhttps://jakubmelka.github.io/assets/flatpak/profi-default.png + Utilize the 'magnifying glass' feature to zoom in on specific sections of the pagehttps://jakubmelka.github.io/assets/flatpak/profi-magnifier.png + Display statistics for various content types within the PDF filehttps://jakubmelka.github.io/assets/flatpak/profi-object-statistics.png + View the document detailshttps://jakubmelka.github.io/assets/flatpak/profi-properties.png + List of add-ons available for the PDF editorhttps://jakubmelka.github.io/assets/flatpak/profi-addons.png diff --git a/WixInstaller/Product.wxs.in b/WixInstaller/Product.wxs.in index c84c0a9..40e6348 100644 --- a/WixInstaller/Product.wxs.in +++ b/WixInstaller/Product.wxs.in @@ -14,24 +14,24 @@ - - + + - - + + - - + + - - + + - - + + @@ -69,8 +69,8 @@ - - + + @@ -132,8 +132,8 @@ - - + + @@ -174,12 +174,6 @@ - - - - - - @@ -211,10 +205,10 @@ - + - + @@ -230,10 +224,10 @@ - + - + @@ -249,10 +243,10 @@ - + - + @@ -263,10 +257,10 @@ - + - + @@ -277,7 +271,7 @@ - + diff --git a/version.txt.in b/version.txt.in new file mode 100644 index 0000000..8f32c33 --- /dev/null +++ b/version.txt.in @@ -0,0 +1 @@ +${PDF4QT_VERSION} \ No newline at end of file