diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7935900c..d866bd15 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -41,10 +41,10 @@ jobs: needs: initialization steps: - uses: actions/checkout@v4 - + - name: Install dependencies run: brew install clang-format - + - name: Run clang-format run: | find . \( -name '*.h' -or -name '*.cpp' -or -name '*.c' -or -name '*.mm' -or -name '*.m' \) -print0 | xargs -0 clang-format -style=file -i @@ -74,13 +74,14 @@ jobs: - name: Build run: | - export DEFINES_VAR=DEFINES+=\"BUILD_NUMBER=\\\\\\\"${{ needs.initialization.outputs.build_number }}\\\\\\\"\" - qmake CONFIG+="unarr" $DEFINES_VAR - qmake -v - make + cmake -B build \ + -DDECOMPRESSION_BACKEND=unarr \ + -DBUILD_NUMBER="${{ needs.initialization.outputs.build_number }}" \ + -DCMAKE_BUILD_TYPE=Release + cmake --build build --parallel 2 - name: Run tests - run: make check TESTARGS="-maxwarnings 100000" + run: ctest --test-dir build --output-on-failure # Linux Qt6 with 7zip linux-qt6-7zip: @@ -93,11 +94,8 @@ jobs: - name: Install dependencies run: | sudo apt-get update - sudo apt-get install -y libunarr-dev libgl-dev libgles2-mesa-dev \ + sudo apt-get install -y libgl-dev libgles2-mesa-dev \ libfontconfig1-dev libfreetype-dev libxkbcommon-dev libpoppler-qt6-dev - mkdir -p ${{ github.workspace }}/compressed_archive - wget "https://github.com/YACReader/yacreader-7z-deps/blob/main/7z2301-src.7z?raw=true" -O ${{ github.workspace }}/compressed_archive/7z2301-src.7z - 7z x ${{ github.workspace }}/compressed_archive/7z2301-src.7z -o${{ github.workspace }}/compressed_archive/lib7zip - name: Install Qt uses: jurplel/install-qt-action@v4 @@ -108,13 +106,14 @@ jobs: - name: Build run: | - export DEFINES_VAR=DEFINES+=\"BUILD_NUMBER=\\\\\\\"${{ needs.initialization.outputs.build_number }}\\\\\\\"\" - qmake CONFIG+="7zip" $DEFINES_VAR - qmake -v - make + cmake -B build \ + -DDECOMPRESSION_BACKEND=7zip \ + -DBUILD_NUMBER="${{ needs.initialization.outputs.build_number }}" \ + -DCMAKE_BUILD_TYPE=Release + cmake --build build --parallel 2 - name: Run tests - run: make check TESTARGS="-maxwarnings 100000" + run: ctest --test-dir build --output-on-failure # macOS Qt6 Universal build macos-qt6-universal: @@ -135,9 +134,6 @@ jobs: python3 -m aqt install-qt mac desktop 6.9.3 -m qt5compat qtmultimedia qtimageformats qtshadertools echo "${{ github.workspace }}/6.9.3/macos/bin" >> $GITHUB_PATH npm install -g appdmg - mkdir -p ${{ github.workspace }}/compressed_archive - wget "https://github.com/YACReader/yacreader-7z-deps/blob/main/7z2301-src.7z?raw=true" -O ${{ github.workspace }}/compressed_archive/7z2301-src.7z - 7z x ${{ github.workspace }}/compressed_archive/7z2301-src.7z -o${{ github.workspace }}/compressed_archive/lib7zip - name: Import Code Signing Certificate if: github.repository == 'YACReader/yacreader' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop') @@ -155,11 +151,8 @@ jobs: SKIP_CODESIGN=$(echo "$SKIP_CODESIGN" | tr '[:upper:]' '[:lower:]') ./compileOSX.sh $VERSION ${{ needs.initialization.outputs.build_number }} $SKIP_CODESIGN Qt6 universal - - name: Build and run tests - run: | - cd tests - qmake - make check TESTARGS="-maxwarnings 100000" + - name: Run tests + run: ctest --test-dir build --output-on-failure - name: Notarize if: github.repository == 'YACReader/yacreader' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop') @@ -180,13 +173,13 @@ jobs: needs: [initialization, code-format-validation] steps: - uses: actions/checkout@v4 - + - name: Setup Python uses: actions/setup-python@v5 with: python-version: '3.10' architecture: 'x64' - + - name: Install dependencies shell: cmd run: | @@ -197,43 +190,23 @@ jobs: dir C:\Qt\6.9.3\msvc2022_64\bin choco install -y wget choco install innosetup - mkdir %GITHUB_WORKSPACE%\compressed_archive - wget "https://github.com/YACReader/yacreader-7z-deps/blob/main/7z2301-src.7z?raw=true" -O %GITHUB_WORKSPACE%\compressed_archive\7z2301-src.7z - 7z x %GITHUB_WORKSPACE%\compressed_archive\7z2301-src.7z -o%GITHUB_WORKSPACE%\compressed_archive\lib7zip wget "https://aka.ms/vs/17/release/vc_redist.x64.exe" -O %GITHUB_WORKSPACE%\vc_redist.x64.exe - - - name: Check MSVC installations - shell: pwsh - run: | - Write-Host "=== Checking for VS 2019 installation ===" - if (Test-Path "C:\Program Files (x86)\Microsoft Visual Studio\2019") { - Get-ChildItem "C:\Program Files (x86)\Microsoft Visual Studio\2019" -Recurse -Depth 2 - } else { - Write-Host "VS 2019 path does not exist" - } - Write-Host "`n=== Checking VS 2022 MSVC Tools ===" - if (Test-Path "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC") { - Get-ChildItem "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC" - } - Write-Host "`n=== Testing vcvars with -vcvars_ver=14.29 ===" - cmd /c '"C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat" -vcvars_ver=14.29 && set' | Select-String -Pattern "MSVC|VCTools" - + - name: Build shell: cmd run: | call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat" set PATH=C:\Qt\6.9.3\msvc2022_64\bin;%PATH% - set DEFINES_VAR=DEFINES+="BUILD_NUMBER=\\\\\\\"${{ needs.initialization.outputs.build_number }}\\\\\\\"" - qmake CONFIG+="7zip" %DEFINES_VAR% - nmake - + cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DDECOMPRESSION_BACKEND=7zip -DBUILD_NUMBER="${{ needs.initialization.outputs.build_number }}" -DCMAKE_PREFIX_PATH=C:\Qt\6.9.3\msvc2022_64 + cmake --build build --parallel + - name: Run tests shell: cmd run: | call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat" set PATH=C:\Qt\6.9.3\msvc2022_64\bin;%PATH% - nmake check TESTARGS="-maxwarnings 100000" - + ctest --test-dir build --output-on-failure + - name: Upload executables for signing if: github.repository == 'YACReader/yacreader' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop') uses: actions/upload-artifact@v4 @@ -241,10 +214,10 @@ jobs: with: name: windows-x64-qt6-executables-unsigned-${{ needs.initialization.outputs.build_number }} path: | - release64/YACReader.exe - release64/YACReaderLibrary.exe - release64/YACReaderLibraryServer.exe - + build/bin/YACReader.exe + build/bin/YACReaderLibrary.exe + build/bin/YACReaderLibraryServer.exe + - name: Sign executables with SignPath if: github.repository == 'YACReader/yacreader' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop') uses: signpath/github-action-submit-signing-request@v1 @@ -257,22 +230,22 @@ jobs: github-artifact-id: ${{ steps.upload_executables.outputs.artifact-id }} wait-for-completion: true wait-for-completion-timeout-in-seconds: "7200" - output-artifact-directory: release64/signed - + output-artifact-directory: build/bin/signed + - name: Replace with signed executables if: github.repository == 'YACReader/yacreader' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop') shell: pwsh run: | Write-Host "=== Replacing executables with signed versions ===" - Get-ChildItem -Path "release64/signed" -Filter "*.exe" | ForEach-Object { - $destPath = "release64/$($_.Name)" + Get-ChildItem -Path "build/bin/signed" -Filter "*.exe" | ForEach-Object { + $destPath = "build/bin/$($_.Name)" Write-Host "Moving signed: $($_.Name) -> $destPath" Move-Item -Path $_.FullName -Destination $destPath -Force Write-Host " Moved successfully" } - Remove-Item -Path "release64/signed" -Recurse -Force -ErrorAction SilentlyContinue + Remove-Item -Path "build/bin/signed" -Recurse -Force -ErrorAction SilentlyContinue Write-Host "Signed executables are ready for installer creation" - + - name: Create installer shell: cmd working-directory: ci/win @@ -280,7 +253,7 @@ jobs: call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat" set PATH=C:\Qt\6.9.3\msvc2022_64\bin;%PATH% .\create_installer.cmd x64 7z ${{ needs.initialization.outputs.build_number }} - + - name: Verify installer was created if: github.repository == 'YACReader/yacreader' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop') shell: pwsh @@ -289,7 +262,7 @@ jobs: throw "Installer file was not created" } Get-ChildItem "ci/win/Output/YACReader*.exe" - + - name: Upload unsigned installer if: github.repository == 'YACReader/yacreader' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop') uses: actions/upload-artifact@v4 @@ -297,7 +270,7 @@ jobs: with: name: windows-x64-qt6-unsigned-${{ needs.initialization.outputs.build_number }} path: ci/win/Output/YACReader*.exe - + - name: Submit to SignPath if: github.repository == 'YACReader/yacreader' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop') uses: signpath/github-action-submit-signing-request@v1 @@ -311,14 +284,14 @@ jobs: wait-for-completion: true wait-for-completion-timeout-in-seconds: "7200" output-artifact-directory: ci/win/Output/signed - + - name: Replace with signed installer if: github.repository == 'YACReader/yacreader' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop') shell: pwsh run: | Write-Host "=== Files in signed directory before move ===" Get-ChildItem -Path "ci/win/Output/signed" -Filter "*.exe" | ForEach-Object { Write-Host " $($_.Name) - $($_.Length) bytes" } - + $signedFiles = Get-ChildItem -Path "ci/win/Output/signed" -Filter "*.exe" foreach ($signedFile in $signedFiles) { $destPath = "ci/win/Output/$($signedFile.Name)" @@ -326,13 +299,13 @@ jobs: Move-Item -Path $signedFile.FullName -Destination $destPath -Force Write-Host " Moved successfully" } - + Write-Host "=== Files in Output directory after move ===" Get-ChildItem -Path "ci/win/Output" -Filter "*.exe" | ForEach-Object { Write-Host " $($_.Name) - $($_.Length) bytes" } - + Remove-Item -Path "ci/win/Output/signed" -Recurse -Force -ErrorAction SilentlyContinue Write-Host "Cleaned up signed directory" - + - name: Upload installer uses: actions/upload-artifact@v4 with: @@ -346,13 +319,13 @@ jobs: needs: [initialization, code-format-validation] steps: - uses: actions/checkout@v4 - + - name: Setup Python uses: actions/setup-python@v5 with: python-version: '3.10' architecture: 'x64' - + - name: Install dependencies shell: cmd run: | @@ -363,26 +336,16 @@ jobs: dir C:\Qt\6.9.3\msvc2022_arm64\bin choco install -y wget choco install innosetup - mkdir %GITHUB_WORKSPACE%\compressed_archive - wget "https://github.com/YACReader/yacreader-7z-deps/blob/main/7z2301-src.7z?raw=true" -O %GITHUB_WORKSPACE%\compressed_archive\7z2301-src.7z - 7z x %GITHUB_WORKSPACE%\compressed_archive\7z2301-src.7z -o%GITHUB_WORKSPACE%\compressed_archive\lib7zip wget "https://aka.ms/vs/17/release/vc_redist.arm64.exe" -O %GITHUB_WORKSPACE%\vc_redist.arm64.exe - - - name: Prepare Build + + - name: Build shell: cmd run: | call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64_arm64 set PATH=C:\Qt\6.9.3\msvc2022_arm64\bin;%PATH% - set DEFINES_VAR=DEFINES+="BUILD_NUMBER=\\\\\\\"${{ needs.initialization.outputs.build_number }}\\\\\\\"" - qmake CONFIG+="7zip" %DEFINES_VAR% - - - name: Build - shell: cmd - run: | - call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64_arm64 - set PATH=C:\Qt\6.9.3\msvc2022_arm64\bin;%PATH% - nmake - + cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DDECOMPRESSION_BACKEND=7zip -DBUILD_NUMBER="${{ needs.initialization.outputs.build_number }}" -DCMAKE_PREFIX_PATH=C:\Qt\6.9.3\msvc2022_arm64 -DQT_HOST_PATH=C:\Qt\6.9.3\msvc2022_64 -DCMAKE_SYSTEM_PROCESSOR=ARM64 + cmake --build build --parallel + - name: Upload executables for signing if: github.repository == 'YACReader/yacreader' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop') uses: actions/upload-artifact@v4 @@ -390,10 +353,10 @@ jobs: with: name: windows-arm64-qt6-executables-unsigned-${{ needs.initialization.outputs.build_number }} path: | - release/YACReader.exe - release/YACReaderLibrary.exe - release/YACReaderLibraryServer.exe - + build/bin/YACReader.exe + build/bin/YACReaderLibrary.exe + build/bin/YACReaderLibraryServer.exe + - name: Submit to SignPath if: github.repository == 'YACReader/yacreader' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop') uses: signpath/github-action-submit-signing-request@v1 @@ -406,25 +369,25 @@ jobs: github-artifact-id: ${{ steps.upload_executables.outputs.artifact-id }} wait-for-completion: true wait-for-completion-timeout-in-seconds: "7200" - output-artifact-directory: 'release/signed' - + output-artifact-directory: 'build/bin/signed' + - name: Replace executables with signed versions if: github.repository == 'YACReader/yacreader' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop') shell: pwsh run: | - Copy-Item "release/signed/YACReader.exe" "release/YACReader.exe" -Force - Copy-Item "release/signed/YACReaderLibrary.exe" "release/YACReaderLibrary.exe" -Force - Copy-Item "release/signed/YACReaderLibraryServer.exe" "release/YACReaderLibraryServer.exe" -Force - Remove-Item -Path "release/signed" -Recurse -Force -ErrorAction SilentlyContinue + Copy-Item "build/bin/signed/YACReader.exe" "build/bin/YACReader.exe" -Force + Copy-Item "build/bin/signed/YACReaderLibrary.exe" "build/bin/YACReaderLibrary.exe" -Force + Copy-Item "build/bin/signed/YACReaderLibraryServer.exe" "build/bin/YACReaderLibraryServer.exe" -Force + Remove-Item -Path "build/bin/signed" -Recurse -Force -ErrorAction SilentlyContinue Write-Host "Signed executables are ready for installer creation" - + - name: Create installer shell: cmd working-directory: ci/win run: | set PATH=C:\Qt\6.9.3\msvc2022_64\bin;%PATH% .\create_installer.cmd arm64 7z ${{ needs.initialization.outputs.build_number }} - + - name: Verify installer was created if: github.repository == 'YACReader/yacreader' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop') shell: pwsh @@ -433,7 +396,7 @@ jobs: throw "Installer file was not created" } Get-ChildItem "ci/win/Output/YACReader*.exe" - + - name: Upload unsigned installer if: github.repository == 'YACReader/yacreader' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop') uses: actions/upload-artifact@v4 @@ -441,7 +404,7 @@ jobs: with: name: windows-arm64-qt6-unsigned-${{ needs.initialization.outputs.build_number }} path: ci/win/Output/YACReader*.exe - + - name: Submit to SignPath if: github.repository == 'YACReader/yacreader' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop') uses: signpath/github-action-submit-signing-request@v1 @@ -455,7 +418,7 @@ jobs: wait-for-completion: true wait-for-completion-timeout-in-seconds: "7200" output-artifact-directory: 'ci/win/Output/signed' - + - name: Replace with signed installer and cleanup if: github.repository == 'YACReader/yacreader' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop') shell: pwsh @@ -469,7 +432,7 @@ jobs: } Remove-Item -Path "signed" -Recurse -Force -ErrorAction SilentlyContinue Write-Host "Cleaned up signed directory" - + - name: Upload installer uses: actions/upload-artifact@v4 with: @@ -483,16 +446,16 @@ jobs: needs: [initialization, code-format-validation] steps: - uses: actions/checkout@v4 - + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - + - name: Build amd64 Image working-directory: docker run: | - docker build --no-cache --platform linux/amd64 -f Dockerfile -t yacreader/yacreaderlibraryserver:develop-amd64 . + docker build --no-cache --platform linux/amd64 -f Dockerfile --build-arg YACR_VERSION=${{ github.head_ref || github.ref_name }} -t yacreader/yacreaderlibraryserver:develop-amd64 . docker save yacreader/yacreaderlibraryserver:develop-amd64 -o amd64.tar - + - name: Upload Docker Image uses: actions/upload-artifact@v4 with: @@ -506,13 +469,13 @@ jobs: needs: [initialization, code-format-validation] steps: - uses: actions/checkout@v4 - + - name: Build arm64 Image (native) working-directory: docker run: | - docker build --no-cache -f Dockerfile.aarch64 -t yacreader/yacreaderlibraryserver:develop-arm64 . + docker build --no-cache -f Dockerfile.aarch64 --build-arg YACR_VERSION=${{ github.head_ref || github.ref_name }} -t yacreader/yacreaderlibraryserver:develop-arm64 . docker save yacreader/yacreaderlibraryserver:develop-arm64 -o arm64.tar - + - name: Upload Docker Image uses: actions/upload-artifact@v4 with: @@ -535,12 +498,12 @@ jobs: - docker-arm64 steps: - uses: actions/checkout@v4 - + - name: Download all artifacts uses: actions/download-artifact@v4 with: path: artifacts - + - name: List downloaded artifacts run: | echo "=== All artifacts downloaded ===" @@ -548,7 +511,7 @@ jobs: echo "" echo "=== Windows artifacts only ===" ls -l artifacts/windows-*/ - + - name: Flatten artifacts (exclude unsigned Windows installers) run: | mkdir -p staging @@ -560,20 +523,20 @@ jobs: echo "" echo "=== Windows installers in staging ===" ls -lh staging/YACReader*.exe || echo "No Windows installers found" - + - name: Verify Windows installer signatures run: | echo "=== Installing osslsigncode to verify signatures ===" sudo apt-get update sudo apt-get install -y osslsigncode - + echo "" echo "=== Checking signatures on Windows installers ===" for installer in staging/YACReader*.exe; do if [ -f "$installer" ]; then echo "Checking: $(basename $installer)" echo "File size: $(stat -c%s $installer) bytes" - + # Try to extract signature info if osslsigncode verify -in "$installer" 2>&1 | grep -q "Signature verification: ok"; then echo " ✓ SIGNED - Signature verified successfully" @@ -585,26 +548,26 @@ jobs: echo "" fi done - + echo "=== Summary ===" echo "Total installers in staging: $(ls staging/YACReader*.exe 2>/dev/null | wc -l)" - + - name: Get version id: version run: | VERSION="$(cat common/yacreader_global.h | grep '#define VERSION "' | tr -d '#define VERSION' | tr -d '"' ).${{ needs.initialization.outputs.build_number }}" echo "version=$VERSION" >> $GITHUB_OUTPUT echo "Version: $VERSION" - + - name: Login to Docker Hub uses: docker/login-action@v3 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - + - name: Push Docker Images run: | for arch in amd64 arm64; do @@ -612,12 +575,12 @@ jobs: docker push yacreader/yacreaderlibraryserver:develop-${arch} rm staging/${arch}.tar done - + docker buildx imagetools create \ -t yacreader/yacreaderlibraryserver:develop \ yacreader/yacreaderlibraryserver:develop-amd64 \ yacreader/yacreaderlibraryserver:develop-arm64 - + - name: Create GitHub Release uses: softprops/action-gh-release@v1 with: @@ -645,12 +608,12 @@ jobs: - docker-arm64 steps: - uses: actions/checkout@v4 - + - name: Download all artifacts uses: actions/download-artifact@v4 with: path: artifacts - + - name: List downloaded artifacts run: | echo "=== All artifacts downloaded ===" @@ -658,7 +621,7 @@ jobs: echo "" echo "=== Windows artifacts only ===" ls -l artifacts/windows-*/ - + - name: Flatten artifacts (exclude unsigned Windows installers) run: | mkdir -p staging @@ -670,20 +633,20 @@ jobs: echo "" echo "=== Windows installers in staging ===" ls -lh staging/YACReader*.exe || echo "No Windows installers found" - + - name: Verify Windows installer signatures run: | echo "=== Installing osslsigncode to verify signatures ===" sudo apt-get update sudo apt-get install -y osslsigncode - + echo "" echo "=== Checking signatures on Windows installers ===" for installer in staging/YACReader*.exe; do if [ -f "$installer" ]; then echo "Checking: $(basename $installer)" echo "File size: $(stat -c%s $installer) bytes" - + # Try to extract signature info if osslsigncode verify -in "$installer" 2>&1 | grep -q "Signature verification: ok"; then echo " ✓ SIGNED - Signature verified successfully" @@ -695,26 +658,26 @@ jobs: echo "" fi done - + echo "=== Summary ===" echo "Total installers in staging: $(ls staging/YACReader*.exe 2>/dev/null | wc -l)" - + - name: Get version id: version run: | VERSION="$(cat common/yacreader_global.h | grep '#define VERSION "' | tr -d '#define VERSION' | tr -d '"' )" echo "version=$VERSION" >> $GITHUB_OUTPUT echo "Version: $VERSION" - + - name: Login to Docker Hub uses: docker/login-action@v3 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - + - name: Push Docker Images run: | for arch in amd64 arm64; do @@ -723,17 +686,17 @@ jobs: docker push yacreader/yacreaderlibraryserver:latest-${arch} rm staging/${arch}.tar done - + docker buildx imagetools create \ -t yacreader/yacreaderlibraryserver:latest \ yacreader/yacreaderlibraryserver:latest-amd64 \ yacreader/yacreaderlibraryserver:latest-arm64 - + docker buildx imagetools create \ -t yacreader/yacreaderlibraryserver:${{ steps.version.outputs.version }} \ yacreader/yacreaderlibraryserver:latest-amd64 \ yacreader/yacreaderlibraryserver:latest-arm64 - + - name: Create GitHub Release uses: softprops/action-gh-release@v1 with: diff --git a/.gitignore b/.gitignore index f3b81f38..e90e8a21 100644 --- a/.gitignore +++ b/.gitignore @@ -6,10 +6,6 @@ dependencies/create-dmg signapps.sh lib7zip libp7zip -YACReader/build -YACReaderLibrary/build -YACReaderLibraryServer/build -build/ # C++ objects and libs *.slo @@ -24,16 +20,7 @@ build/ *.pch *.obj -# Qt-es -object_script.*.Release -object_script.*.Debug -*_plugin_import.cpp -/.qmake.cache -/.qmake.stash -*.pro.user -*.pro.user.* -*.qbs.user -*.qbs.user.* +# Qt generated files *.moc moc_*.cpp moc_*.h @@ -41,41 +28,43 @@ qrc_*.cpp ui_*.h *.qmlc *.jsc -Makefile* -*build-* -*.build* -*.app* -*.pbxproj -*.mak -*.xcworkspace* -*xcshareddata* -*.swp *.qm # Qt unit tests target_wrapper.* # QtCreator +.qtcreator/ *.autosave - -# QtCreator Qml *.qmlproject.user *.qmlproject.user.* - -# QtCreator CMake CMakeLists.txt.user* *.stash +*build-* +*.build* +# CMake +build*/ +CMakeCache.txt +CMakeFiles/ +cmake_install.cmake +CMakeUserPresets.json + +# IDE / platform +*.app* +*.pbxproj +*.xcworkspace* +*xcshareddata* +*.swp *.plist *.dmg - YACReaderLibrary/YACReaderLibrary\.xcodeproj/ .DS_Store -compressed_archive/libp7zip -c_x86_64.pch - compile_commands.json .ccls-cache +compressed_archive/libp7zip +c_x86_64.pch + # Claude Code .claude/ diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 00000000..badd9f25 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,191 @@ +cmake_minimum_required(VERSION 3.25) + +project(YACReader + VERSION 10.0.0 + LANGUAGES C CXX +) + +# Enable Objective-C/C++ on Apple platforms +if(APPLE) + enable_language(OBJC) + enable_language(OBJCXX) +endif() + +# Enforce out-of-source build +file(TO_CMAKE_PATH "${PROJECT_BINARY_DIR}/CMakeLists.txt" _in_source_check) +if(EXISTS "${_in_source_check}") + message(FATAL_ERROR "In-source builds are not allowed. Use: cmake -B build") +endif() + +# C++ standard +set(CMAKE_CXX_STANDARD 20) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +# Default build type (single-config generators only) +if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Build type" FORCE) + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS + "Debug" "Release" "MinSizeRel" "RelWithDebInfo") +endif() + +# Install paths +include(GNUInstallDirs) +find_package(PkgConfig) + +# Compiler options (MSVC flags, NOMINMAX, etc.) +include(cmake/CompilerOptions.cmake) + +# --- Build options --- + +# Archive decompression backend (mutually exclusive) +set(DECOMPRESSION_BACKEND "" CACHE STRING "Archive backend: unarr | 7zip | libarchive") +set_property(CACHE DECOMPRESSION_BACKEND PROPERTY STRINGS "unarr" "7zip" "libarchive") + +# PDF rendering backend (mutually exclusive) +set(PDF_BACKEND "" CACHE STRING "PDF backend: pdfium | poppler | pdfkit | no_pdf") +set_property(CACHE PDF_BACKEND PROPERTY STRINGS "pdfium" "poppler" "pdfkit" "no_pdf") + +# Build configuration +option(BUILD_TESTS "Build tests" ON) +option(BUILD_SERVER_STANDALONE "Server standalone install (Linux only)" OFF) + +# Build number (set by CI) +set(BUILD_NUMBER "" CACHE STRING "CI build number") + +# --- Platform defaults (mirrors config.pri) --- +if(NOT DECOMPRESSION_BACKEND OR DECOMPRESSION_BACKEND STREQUAL "") + if(UNIX AND NOT APPLE) + set(DECOMPRESSION_BACKEND "unarr") + else() + set(DECOMPRESSION_BACKEND "7zip") + endif() + message(STATUS "DECOMPRESSION_BACKEND defaulted to: ${DECOMPRESSION_BACKEND}") +endif() + +if(NOT PDF_BACKEND OR PDF_BACKEND STREQUAL "") + if(UNIX AND NOT APPLE) + set(PDF_BACKEND "poppler") + elseif(APPLE) + set(PDF_BACKEND "pdfkit") + else() + set(PDF_BACKEND "pdfium") + endif() + message(STATUS "PDF_BACKEND defaulted to: ${PDF_BACKEND}") +endif() + +# macOS universal binary default +if(APPLE AND NOT CMAKE_OSX_ARCHITECTURES) + set(CMAKE_OSX_ARCHITECTURES "x86_64;arm64" CACHE STRING "Target architectures") +endif() + +# --- Qt --- +# BUILD_SERVER_STANDALONE only needs Qt 6.4+ (no GUI/shader components required) +if(BUILD_SERVER_STANDALONE) + find_package(Qt6 6.4 REQUIRED COMPONENTS + Core + Core5Compat + Gui + LinguistTools + Network + Sql + ) +else() + find_package(Qt6 6.7 REQUIRED COMPONENTS + Core + Core5Compat + Gui + LinguistTools + Multimedia + Network + OpenGLWidgets + Quick + QuickControls2 + QuickWidgets + Qml + ShaderTools + Sql + Svg + Test + Widgets + ) +endif() +qt_standard_project_setup() + +# PDF backend detection (creates pdf_backend_iface INTERFACE target) +include(cmake/PdfBackend.cmake) + +# Output directory +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") + +# Build number define +if(BUILD_NUMBER) + add_compile_definitions("BUILD_NUMBER=\"${BUILD_NUMBER}\"") +endif() + +# --- Subdirectories (dependency order) --- +add_subdirectory(third_party) +add_subdirectory(compressed_archive) +add_subdirectory(common) + +# GUI-only subdirectories (not needed for server-standalone builds) +if(NOT BUILD_SERVER_STANDALONE) + add_subdirectory(shortcuts_management) + add_subdirectory(custom_widgets) +endif() + +add_subdirectory(YACReaderLibrary/server) + +if(NOT BUILD_SERVER_STANDALONE) + add_subdirectory(YACReaderLibrary/comic_vine) +endif() + +# Always add YACReaderLibrary: defines library_common and db_helper (shared with server) +# When BUILD_SERVER_STANDALONE=ON, only those shared targets are built (not the app) +add_subdirectory(YACReaderLibrary) + +if(NOT BUILD_SERVER_STANDALONE) + add_subdirectory(YACReader) +endif() + +add_subdirectory(YACReaderLibraryServer) + +if(BUILD_TESTS AND NOT BUILD_SERVER_STANDALONE) + enable_testing() + add_subdirectory(tests) +endif() + +# --- Linux top-level install rules --- +if(UNIX AND NOT APPLE) + # Man pages + if(EXISTS "${CMAKE_SOURCE_DIR}/YACReader.1") + install(FILES YACReader.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1) + endif() + if(EXISTS "${CMAKE_SOURCE_DIR}/YACReaderLibrary.1") + install(FILES YACReaderLibrary.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1) + endif() + + # Desktop files + if(EXISTS "${CMAKE_SOURCE_DIR}/YACReader.desktop") + install(FILES YACReader.desktop YACReaderLibrary.desktop + DESTINATION ${CMAKE_INSTALL_DATADIR}/applications) + endif() + + # Icons + if(EXISTS "${CMAKE_SOURCE_DIR}/YACReader.svg") + install(FILES YACReader.svg YACReaderLibrary.svg + DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/scalable/apps) + endif() +endif() + +# Summary +message(STATUS "") +message(STATUS "YACReader ${PROJECT_VERSION} build configuration:") +message(STATUS " Decompression backend: ${DECOMPRESSION_BACKEND}") +message(STATUS " PDF backend: ${PDF_BACKEND}") +message(STATUS " Build tests: ${BUILD_TESTS}") +message(STATUS " Server standalone: ${BUILD_SERVER_STANDALONE}") +message(STATUS " Build type: ${CMAKE_BUILD_TYPE}") +if(BUILD_NUMBER) + message(STATUS " Build number: ${BUILD_NUMBER}") +endif() +message(STATUS "") diff --git a/INSTALL.md b/INSTALL.md index 8a3155f2..182b2b55 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -1,36 +1,40 @@ # Building YACReader from source -YACReader and YACReaderLibrary are build using qmake. To build and install the -program, run: +YACReader and YACReaderLibrary are built using CMake. To build from the top +source directory: ``` -qmake CONFIG+=[Options] -make -make install +cmake -B build -DCMAKE_BUILD_TYPE=Release +cmake --build build --parallel ``` -from the top source dir. For separate builds of YACReader or YACReaderLibrary, -enter their respective subfolders and run the commands from there. +To install (Linux): + +``` +cmake --install build +``` -The headless version of YACReaderLibrary is located in the YACReaderLibraryServer -folder. To build it, enter the folder and run the commands described above. ## Build dependencies: -- Qt >= 5.15 with the following modules: - - declarative - - quickcontrols - - sql - - multimedia - - imageformats - - opengl - - sql-sqlite - - network +- CMake >= 3.25 +- C++20 compiler +- Qt >= 6.7 with the following modules: + - Core, Core5Compat, Gui, Widgets + - Quick, QuickControls2, QuickWidgets, Qml + - Sql (with SQLite driver) + - Multimedia + - Network + - Svg + - OpenGLWidgets + - ShaderTools + - LinguistTools + - Test (for running tests) - Backends for pdf rendering (optional) and file decompression (see below) Not all dependencies are needed at build time. For example the qml components in YACReaderLibrary (GridView, InfoView) will only show a white page if the -required qml modules (declarative, quickcontrols) are missing. +required qml modules (Quick, QuickControls2) are missing. ## Backends @@ -38,26 +42,26 @@ required qml modules (declarative, quickcontrols) are missing. YACReader currently supports two decompression backends, 7zip and (lib)unarr. YACReader defaults to 7zip for Windows and Mac OS and unarr for Linux and other OS, but you can -override this using one of the following config options: +override this using the `DECOMPRESSION_BACKEND` option: -`CONFIG+=7zip` - -`CONFIG+=unarr` +``` +cmake -B build -DDECOMPRESSION_BACKEND=7zip +cmake -B build -DDECOMPRESSION_BACKEND=unarr +cmake -B build -DDECOMPRESSION_BACKEND=libarchive +``` #### 7zip -[7zip](https://www.7-zip.org/) and [p7zip](http://p7zip.sourceforge.net/) -are the default decompression backend for Windows and Mac OS builds. +[7zip](https://www.7-zip.org/) is the default decompression backend for Windows and Mac OS builds. -They are recommended for these systems, as they currently have better support for 7z -files and support the RAR5 format. +It is recommended for these systems, as it currently has better support for 7z +files and supports the RAR5 format. -As this backend requires specific versions of 7zip for Windows and p7zip for *NIX and -is not 100% GPL compatible (unrar License restriction), it is not recommended for -installations where you can't guarantee the installed version of (p7zip) or the license is an issue. +The 7zip source code is automatically downloaded during configuration via CMake's +FetchContent. No manual setup is needed. -To build using this backend, you need to install additional sources to the build environment. -For more information, please refer to [README_7zip](compressed_archive/README_7zip.txt). +As this backend is not 100% GPL compatible (unrar license restriction), it is not +recommended for installations where the license is an issue. #### unarr @@ -77,12 +81,18 @@ For more information, please consult the [README](compressed_archive/unarr/READM Starting with version 9.0.0 YACReader supports the following pdf rendering engines: - poppler (Linux/Unix default) -- pdfium (default for Windows and MacOS) -- pdfkit (MacOS only) +- pdfium (default for Windows) +- pdfkit (macOS default, macOS only) - no_pdf (disable pdf support) -To override the default for a given platform add CONFIG+=[pdfbackend] as an option -when running qmake. +To override the default for a given platform use the `PDF_BACKEND` option: + +``` +cmake -B build -DPDF_BACKEND=poppler +cmake -B build -DPDF_BACKEND=pdfium +cmake -B build -DPDF_BACKEND=pdfkit +cmake -B build -DPDF_BACKEND=no_pdf +``` While the Poppler backend is well tested and has been the standard for YACReader for a long time, its performance is a bit lacking. The pdfium engine offers @@ -92,33 +102,31 @@ prepackaged for Linux. ### Other build options: -You can adjust the installation prefix as well als the path "make install" uses -to install the files. - -`qmake PREFIX=DIR` - -sets the default prefix (for example "/", "/usr", "/usr/local"). - -`make install INSTALL_ROOT=DIR` - -can be used to install to a different location, which is usefull for packaging. - -Default values: +You can adjust the installation prefix: ``` -PREFIX=/usr -INSTALL_ROOT="" +cmake -B build -DCMAKE_INSTALL_PREFIX=/usr/local ``` -On embedded devices that don't support desktop OpenGL, it is recommended to use -the no_opengl config option: +Default value on Linux is `/usr`. -`qmake CONFIG+=no_opengl` +For packaging, use `DESTDIR` with the install command: -This will remove any dependency on desktop OpenGL and hardlock YACReader's -coverflow to software rendering. Please note that it does not actually remove -OpenGL from the build, the Qt toolkit will still make use of it. +``` +DESTDIR=/path/to/staging cmake --install build +``` +To build only YACReaderLibraryServer (headless server): + +``` +cmake -B build -DBUILD_SERVER_STANDALONE=ON +``` + +### Running tests + +``` +ctest --test-dir build --output-on-failure +``` # Feedback and contribution diff --git a/README.md b/README.md index 8df7d43e..4e5b9c26 100644 --- a/README.md +++ b/README.md @@ -52,15 +52,21 @@ If you are interested in contributing to the project the first step should be to Contributions are not restricted to coding; you can help the project by bringing new UI/UX ideas, designing new assets, writing manuals or tutorials, translating the apps, etc. If you are interested in DevOps, YACReader uses Azure Pipelines for CI/CD, any improvements in that area are welcome. Testing pre-releases is also really appreciated. #### Dev Setup -YACReader is developed in *c++/Qt*, so the first thing you need to do is to install a *C++* compiler or environment that supports at least *C++17* and *Qt*. In *Windows* I use *Visual Studio Community Edition 2019* as build system and in *macos* I use Xcode, but I do all the coding using *QtCreator*. The project support *Qt5* and *Qt6* at the moment so you need to make sure that everything works in both *Qt5* and *Qt6*, you only need to install one flavor of *Qt* and *CI* will check that everything builds with both, I recommend using *Qt6*. +YACReader is developed in *C++/Qt* and built with *CMake*. You need a *C++20* compiler and *Qt 6.7+*. In *Windows* I use *Visual Studio 2022* and in *macOS* I use Xcode, but I do all the coding using *QtCreator*. -The repo includes binaries for the dependencies needed for *Windows* (MSVC compiler) and *macos* (clang) but you need to configure *7zip* dependency manually, please take a look at *compressed_archive/README_7zip.txt*. +The repo includes binaries for the dependencies needed for *Windows* (MSVC compiler) and *macOS* (clang). The *7zip* decompression backend source is downloaded automatically by CMake during configuration. + +To build: +``` +cmake -B build -DCMAKE_BUILD_TYPE=Release +cmake --build build --parallel +``` + +See [INSTALL.md](./INSTALL.md) for detailed build options. ##### Running and debugging YACReader needs to find its dependencies at runtime, make sure that *Qt* binaries are in your *PATH* and the third-party binaries are next to the executable. The best way to make sure you have all the third-party binaries in place is to check YACReader installation and copy the binaries in your output folder. -If you have the time and the energy, please open a PR with a script that automatizes any of these manual processes. - #### Code Format YACReader uses `clang-format` to ensure a common style and avoid deviances from it. CI checks this and will fail if the correct format is not used. `clang-format` needs to be called recursively in all the folders because some of them have their own `.clang-format` file, mainly to exclude changing the format in third-party libraries which are included in the source code. I recommend configuring your development tools to use `clang-format`, you can try to use it manually, but please, do it always before committing changes. I recommend using QtCreator configured properly, you can find a tutorial [here]( https://www.vikingsoftware.com/using-clang-format-with-qtcreator/). diff --git a/YACReader.pro b/YACReader.pro deleted file mode 100644 index f3106c4f..00000000 --- a/YACReader.pro +++ /dev/null @@ -1,4 +0,0 @@ -TEMPLATE = subdirs -SUBDIRS = YACReader YACReaderLibrary YACReaderLibraryServer -YACReaderLibrary.depends = YACReader -!CONFIG(no_tests): SUBDIRS += tests diff --git a/YACReader/CMakeLists.txt b/YACReader/CMakeLists.txt new file mode 100644 index 00000000..3f4010cd --- /dev/null +++ b/YACReader/CMakeLists.txt @@ -0,0 +1,124 @@ +# YACReader - Comic Viewer + +qt_add_executable(YACReader WIN32 + configuration.h + configuration.cpp + goto_dialog.h + goto_dialog.cpp + magnifying_glass.h + magnifying_glass.cpp + main_window_viewer.h + main_window_viewer.cpp + continuous_page_widget.h + continuous_page_widget.cpp + mouse_handler.h + mouse_handler.cpp + viewer.h + viewer.cpp + options_dialog.h + options_dialog.cpp + bookmarks_dialog.h + bookmarks_dialog.cpp + render.h + render.cpp + translator.h + translator.cpp + goto_flow_widget.h + goto_flow_widget.cpp + page_label_widget.h + page_label_widget.cpp + goto_flow_toolbar.h + goto_flow_toolbar.cpp + width_slider.h + width_slider.cpp + notifications_label_widget.h + notifications_label_widget.cpp + yacreader_local_client.h + yacreader_local_client.cpp + main.cpp + # App-specific themes + shared theme_manager (depends on app theme.h) + themes/theme.h + themes/theme_factory.h + themes/theme_factory.cpp + ${CMAKE_SOURCE_DIR}/common/themes/theme_manager.h + ${CMAKE_SOURCE_DIR}/common/themes/theme_manager.cpp +) + +target_include_directories(YACReader PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/themes +) + +target_compile_definitions(YACReader PRIVATE YACREADER) + +# Resources +qt_add_resources(yacreader_images_rcc "${CMAKE_CURRENT_SOURCE_DIR}/yacreader_images.qrc") +qt_add_resources(yacreader_files_rcc "${CMAKE_CURRENT_SOURCE_DIR}/yacreader_files.qrc") +target_sources(YACReader PRIVATE + ${yacreader_images_rcc} + ${yacreader_files_rcc} +) + +# Translations +qt_add_translations(YACReader + TS_FILES + yacreader_es.ts + yacreader_fr.ts + yacreader_ru.ts + yacreader_pt.ts + yacreader_nl.ts + yacreader_tr.ts + yacreader_de.ts + yacreader_zh_CN.ts + yacreader_zh_TW.ts + yacreader_zh_HK.ts + yacreader_it.ts + yacreader_en.ts +) + +target_link_libraries(YACReader PRIVATE + Qt::Core + Qt::Gui + Qt::GuiPrivate + Qt::Network + Qt::Widgets + Qt::Multimedia + Qt::Svg + Qt::Core5Compat + comic_backend + common_gui + rhi_flow_reader + custom_widgets_reader + shortcuts_reader + cbx_backend + QsLog +) + +# Platform-specific +if(WIN32) + target_sources(YACReader PRIVATE icon.rc) + target_link_libraries(YACReader PRIVATE oleaut32 ole32 shell32 user32) +endif() + +if(APPLE) + target_sources(YACReader PRIVATE YACReader.icns) + set_source_files_properties(YACReader.icns PROPERTIES MACOSX_PACKAGE_LOCATION Resources) + set_target_properties(YACReader PROPERTIES + MACOSX_BUNDLE TRUE + MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/Info.plist" + MACOSX_BUNDLE_GUI_IDENTIFIER "com.yacreader.YACReader" + MACOSX_BUNDLE_BUNDLE_NAME "YACReader" + ) + target_link_libraries(YACReader PRIVATE + "-framework Foundation" + "-framework ApplicationServices" + "-framework AppKit" + ) +endif() + +# Linux install +if(UNIX AND NOT APPLE) + target_compile_definitions(YACReader PRIVATE + "DATADIR=\"${CMAKE_INSTALL_FULL_DATADIR}\"") + install(TARGETS YACReader RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) +endif() diff --git a/YACReader/YACReader.pro b/YACReader/YACReader.pro deleted file mode 100644 index f2bdd8f0..00000000 --- a/YACReader/YACReader.pro +++ /dev/null @@ -1,229 +0,0 @@ -TEMPLATE = app -TARGET = YACReader - -QMAKE_TARGET_BUNDLE_PREFIX = "com.yacreader" - -DEPENDPATH += . \ - release - -DEFINES += YACREADER - -#load default build flags -include (../config.pri) -include (../dependencies/pdf_backend.pri) -include (./themes/themes.pri) -include (../common/themes/themes_common.pri) - -contains(QMAKE_TARGET.arch, x86_64) { - Release:DESTDIR = ../release64 - Debug:DESTDIR = ../debug64 -} else { - Release:DESTDIR = ../release - Debug:DESTDIR = ../debug -} - -SOURCES += main.cpp - -INCLUDEPATH += ../common \ - ../custom_widgets -INCLUDEPATH += ../common/rhi - -HEADERS += ../common/rhi/flow_types.h -SOURCES += ../common/rhi/flow_types.cpp - -win32 { - LIBS += -loleaut32 -lole32 -lshell32 -luser32 - msvc { - QMAKE_CXXFLAGS_RELEASE += /MP /Ob2 /Oi /Ot /GT /GL - QMAKE_LFLAGS_RELEASE += /LTCG - } - CONFIG -= embed_manifest_exe -} - -macx { - QT += gui-private - CONFIG += objective_c - LIBS += -framework Foundation -framework ApplicationServices -framework AppKit - -} - -QT += network widgets core multimedia svg - -QT += core5compat - -greaterThan(QT_MINOR_VERSION, 6): QT += gui-private - -#CONFIG += release -CONFIG -= flat - -# Sources -HEADERS += ../common/comic.h \ - configuration.h \ - goto_dialog.h \ - magnifying_glass.h \ - main_window_viewer.h \ - continuous_page_widget.h \ - mouse_handler.h \ - viewer.h \ - options_dialog.h \ - ../common/bookmarks.h \ - bookmarks_dialog.h \ - render.h \ - translator.h \ - goto_flow_widget.h \ - page_label_widget.h \ - goto_flow_toolbar.h \ - width_slider.h \ - notifications_label_widget.h \ - ../common/custom_widgets.h \ - ../common/check_new_version.h \ - ../common/qnaturalsorting.h \ - ../common/yacreader_global.h \ - ../common/yacreader_global_gui.h \ - ../common/comic_db.h \ - ../common/folder.h \ - ../common/library_item.h \ - yacreader_local_client.h \ - ../common/http_worker.h \ - ../common/exit_check.h \ - ../common/scroll_management.h \ - ../common/pdf_comic.h \ - ../common/global_info_provider.h \ - ../common/rhi/yacreader_flow_rhi.h \ - ../common/rhi/yacreader_comic_flow_rhi.h \ - ../common/rhi/yacreader_page_flow_rhi.h - - -SOURCES += ../common/comic.cpp \ - configuration.cpp \ - goto_dialog.cpp \ - magnifying_glass.cpp \ - main_window_viewer.cpp \ - continuous_page_widget.cpp \ - mouse_handler.cpp \ - viewer.cpp \ - options_dialog.cpp \ - ../common/bookmarks.cpp \ - bookmarks_dialog.cpp \ - render.cpp \ - translator.cpp \ - goto_flow_widget.cpp \ - page_label_widget.cpp \ - goto_flow_toolbar.cpp \ - width_slider.cpp \ - notifications_label_widget.cpp \ - ../common/custom_widgets.cpp \ - ../common/check_new_version.cpp \ - ../common/qnaturalsorting.cpp \ - ../common/comic_db.cpp \ - ../common/folder.cpp \ - ../common/library_item.cpp \ - yacreader_local_client.cpp \ - ../common/http_worker.cpp \ - ../common/yacreader_global.cpp \ - ../common/yacreader_global_gui.cpp \ - ../common/exit_check.cpp \ - ../common/scroll_management.cpp \ - ../common/global_info_provider.cpp \ - ../common/rhi/yacreader_flow_rhi.cpp \ - ../common/rhi/yacreader_comic_flow_rhi.cpp \ - ../common/rhi/yacreader_page_flow_rhi.cpp - -RESOURCES += ../common/rhi/shaders/shaders.qrc -# Make raw GLSL shader sources editable in Qt Creator -OTHER_FILES += ../common/rhi/shaders/flow.vert \ - ../common/rhi/shaders/flow.frag - -include(../custom_widgets/custom_widgets_yacreader.pri) - -CONFIG(7zip) { -include(../compressed_archive/wrapper.pri) -} else:CONFIG(unarr) { -include(../compressed_archive/unarr/unarr-wrapper.pri) -} else:CONFIG(libarchive) { -include(../compressed_archive/libarchive/libarchive-wrapper.pri) -} else { - error(No compression backend specified. Did you mess with the build system?) -} -include(../shortcuts_management/shortcuts_management.pri) - -RESOURCES += yacreader_images.qrc \ - yacreader_files.qrc - -include(../third_party/QsLog/QsLog.pri) - -RC_FILE = icon.rc - -macx { - ICON = YACReader.icns - QMAKE_INFO_PLIST = Info.plist -} - -TRANSLATIONS = yacreader_es.ts \ - yacreader_fr.ts \ - yacreader_ru.ts \ - yacreader_pt.ts \ - yacreader_nl.ts \ - yacreader_tr.ts \ - yacreader_de.ts \ - yacreader_zh_CN.ts \ - yacreader_zh_TW.ts \ - yacreader_zh_HK.ts \ - yacreader_it.ts \ - yacreader_en.ts - -CONFIG += lrelease - -win32 { - CONFIG(release, debug|release) { - SOURCE_QM_DIR = $$OUT_PWD/release/*.qm - } - CONFIG(debug, debug|release) { - SOURCE_QM_DIR = $$OUT_PWD/debug/*.qm - } - - DEPLOYMENT_OUT_QM_DIR = ../release/languages/ - OUT_QM_DIR = $${DESTDIR}/languages/ - - QMAKE_POST_LINK += $(MKDIR) $$shell_path($${OUT_QM_DIR}) 2> NULL & \ - $(COPY) $$shell_path($${SOURCE_QM_DIR}) $$shell_path($${OUT_QM_DIR}) & \ - $(MKDIR) $$shell_path($${DEPLOYMENT_OUT_QM_DIR}) 2> NULL & \ - $(COPY) $$shell_path($${SOURCE_QM_DIR}) $$shell_path($${DEPLOYMENT_OUT_QM_DIR}) -} else { - LRELEASE_DIR = ../release/languages/ - QM_FILES_INSTALL_PATH = $$DATADIR/yacreader/languages -} - -unix:!macx { - -DEFINES += "LIBDIR=\\\"$$LIBDIR\\\"" "DATADIR=\\\"$$DATADIR\\\"" - -#MAKE INSTALL - -INSTALLS += bin docs icon desktop manpage - -bin.path = $$BINDIR -isEmpty(DESTDIR) { - bin.files = YACReader -} else { - bin.files = $$DESTDIR/YACReader -} - -docs.path = $$DATADIR/doc/yacreader - -#rename docs for better packageability -docs.extra = cp ../README.md ../README -docs.files = ../README ../CHANGELOG.md - -icon.path = $$DATADIR/icons/hicolor/scalable/apps -icon.files = ../YACReader.svg - -desktop.path = $$DATADIR/applications -desktop.files = ../YACReader.desktop - -manpage.path = $$DATADIR/man/man1 -manpage.files = ../YACReader.1 - -#remove leftover doc files when 'make clean' is invoked -QMAKE_CLEAN += "../README" -} diff --git a/YACReader/themes/themes.pri b/YACReader/themes/themes.pri deleted file mode 100644 index eee35324..00000000 --- a/YACReader/themes/themes.pri +++ /dev/null @@ -1,7 +0,0 @@ -INCLUDEPATH += $$PWD - -HEADERS += \ - $$PWD/theme.h \ - $$PWD/theme_factory.h -SOURCES += \ - $$PWD/theme_factory.cpp diff --git a/YACReaderLibrary/CMakeLists.txt b/YACReaderLibrary/CMakeLists.txt new file mode 100644 index 00000000..cae71e34 --- /dev/null +++ b/YACReaderLibrary/CMakeLists.txt @@ -0,0 +1,304 @@ +# YACReaderLibrary - Comic Library Manager + +# --- library_common (shared with YACReaderLibraryServer) --- +add_library(library_common STATIC + library_creator.h + library_creator.cpp + package_manager.h + package_manager.cpp + bundle_creator.h + bundle_creator.cpp + initial_comic_info_extractor.h + initial_comic_info_extractor.cpp + xml_info_parser.h + xml_info_parser.cpp + xml_info_library_scanner.h + xml_info_library_scanner.cpp + yacreader_local_server.h + yacreader_local_server.cpp + comics_remover.h + comics_remover.cpp + yacreader_libraries.h + yacreader_libraries.cpp + comic_files_manager.h + comic_files_manager.cpp + ip_config_helper.h + ip_config_helper.cpp + libraries_update_coordinator.h + libraries_update_coordinator.cpp +) +target_include_directories(library_common PUBLIC + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/db +) +target_link_libraries(library_common PUBLIC + Qt::Core + Qt::Core5Compat + Qt::Network + Qt::Sql + common_all + comic_backend + cbx_backend + db_helper + QsLog +) + +# --- db_helper (database layer, shared with YACReaderLibraryServer) --- +add_library(db_helper STATIC + db_helper.h + db_helper.cpp + db/data_base_management.h + db/data_base_management.cpp + db/reading_list.h + db/reading_list.cpp + db/query_lexer.h + db/query_lexer.cpp + db/query_parser.h + db/query_parser.cpp + db/search_query.h + db/search_query.cpp +) +target_include_directories(db_helper PUBLIC + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/db +) +target_link_libraries(db_helper PUBLIC + Qt::Core + Qt::Sql + common_all + QsLog +) + +# When BUILD_SERVER_STANDALONE=ON, only library_common and db_helper are built. +# The full YACReaderLibrary GUI app requires Qt::Widgets and other full-build components. +if(NOT BUILD_SERVER_STANDALONE) + +# --- YACReaderLibrary executable --- +qt_add_executable(YACReaderLibrary WIN32 + main.cpp + library_window.h + library_window.cpp + library_window_actions.h + library_window_actions.cpp + create_library_dialog.h + create_library_dialog.cpp + add_library_dialog.h + add_library_dialog.cpp + rename_library_dialog.h + rename_library_dialog.cpp + properties_dialog.h + properties_dialog.cpp + options_dialog.h + options_dialog.cpp + export_library_dialog.h + export_library_dialog.cpp + import_library_dialog.h + import_library_dialog.cpp + export_comics_info_dialog.h + export_comics_info_dialog.cpp + import_comics_info_dialog.h + import_comics_info_dialog.cpp + server_config_dialog.h + server_config_dialog.cpp + comic_flow_widget.h + comic_flow_widget.cpp + no_libraries_widget.h + no_libraries_widget.cpp + import_widget.h + import_widget.cpp + trayicon_controller.h + trayicon_controller.cpp + yacreader_content_views_manager.h + yacreader_content_views_manager.cpp + yacreader_main_toolbar.h + yacreader_main_toolbar.cpp + comics_view.h + comics_view.cpp + comics_view_transition.h + comics_view_transition.cpp + classic_comics_view.h + classic_comics_view.cpp + grid_comics_view.h + grid_comics_view.cpp + no_search_results_widget.h + no_search_results_widget.cpp + folder_content_view.h + folder_content_view.cpp + recent_visibility_coordinator.h + recent_visibility_coordinator.cpp + library_comic_opener.h + library_comic_opener.cpp + db/comic_query_result_processor.h + db/comic_query_result_processor.cpp + db/folder_query_result_processor.h + db/folder_query_result_processor.cpp + db/folder_item.h + db/folder_item.cpp + db/folder_model.h + db/folder_model.cpp + db/comic_model.h + db/comic_model.cpp + db/comic_item.h + db/comic_item.cpp + db/reading_list_model.h + db/reading_list_model.cpp + db/reading_list_item.h + db/reading_list_item.cpp + yacreader_folders_view.h + yacreader_folders_view.cpp + yacreader_reading_lists_view.h + yacreader_reading_lists_view.cpp + add_label_dialog.h + add_label_dialog.cpp + yacreader_history_controller.h + yacreader_history_controller.cpp + yacreader_navigation_controller.h + yacreader_navigation_controller.cpp + empty_label_widget.h + empty_label_widget.cpp + empty_folder_widget.h + empty_folder_widget.cpp + empty_container_info.h + empty_container_info.cpp + empty_special_list.h + empty_special_list.cpp + empty_reading_list_widget.h + empty_reading_list_widget.cpp + info_comics_view.h + info_comics_view.cpp + yacreader_comics_selection_helper.h + yacreader_comics_selection_helper.cpp + yacreader_comic_info_helper.h + yacreader_comic_info_helper.cpp + current_comic_view_helper.h + current_comic_view_helper.cpp + # App-specific themes + shared theme_manager (depends on app theme.h) + themes/theme.h + themes/theme_factory.h + themes/theme_factory.cpp + ${CMAKE_SOURCE_DIR}/common/themes/theme_manager.h + ${CMAKE_SOURCE_DIR}/common/themes/theme_manager.cpp +) + +# macOS-specific sources +if(APPLE) + target_sources(YACReaderLibrary PRIVATE + trayhandler.h + trayhandler.mm + ) +endif() + +target_include_directories(YACReaderLibrary PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/db + ${CMAKE_CURRENT_SOURCE_DIR}/themes +) + +target_compile_definitions(YACReaderLibrary PRIVATE + SERVER_RELEASE + YACREADER_LIBRARY +) + +# Resources +qt_add_resources(yacreaderlibrary_images_rcc "${CMAKE_CURRENT_SOURCE_DIR}/images.qrc") +qt_add_resources(yacreaderlibrary_files_rcc "${CMAKE_CURRENT_SOURCE_DIR}/files.qrc") +qt_add_resources(yacreaderlibrary_qml_rcc "${CMAKE_CURRENT_SOURCE_DIR}/qml.qrc") +target_sources(YACReaderLibrary PRIVATE + ${yacreaderlibrary_images_rcc} + ${yacreaderlibrary_files_rcc} + ${yacreaderlibrary_qml_rcc} +) +if(WIN32 OR (UNIX AND NOT APPLE)) + qt_add_resources(yacreaderlibrary_images_win_rcc "${CMAKE_CURRENT_SOURCE_DIR}/images_win.qrc") + target_sources(YACReaderLibrary PRIVATE ${yacreaderlibrary_images_win_rcc}) +endif() +if(APPLE) + qt_add_resources(yacreaderlibrary_images_osx_rcc "${CMAKE_CURRENT_SOURCE_DIR}/images_osx.qrc") + target_sources(YACReaderLibrary PRIVATE ${yacreaderlibrary_images_osx_rcc}) +endif() + +# Translations +qt_add_translations(YACReaderLibrary + TS_FILES + yacreaderlibrary_es.ts + yacreaderlibrary_ru.ts + yacreaderlibrary_pt.ts + yacreaderlibrary_fr.ts + yacreaderlibrary_nl.ts + yacreaderlibrary_tr.ts + yacreaderlibrary_de.ts + yacreaderlibrary_zh_CN.ts + yacreaderlibrary_zh_TW.ts + yacreaderlibrary_zh_HK.ts + yacreaderlibrary_it.ts + yacreaderlibrary_en.ts +) + +target_link_libraries(YACReaderLibrary PRIVATE + Qt::Core + Qt::Gui + Qt::GuiPrivate + Qt::Network + Qt::Widgets + Qt::Sql + Qt::Svg + Qt::Quick + Qt::Qml + Qt::QuickWidgets + Qt::QuickControls2 + Qt::Core5Compat + library_common + db_helper + comic_backend + common_gui + rhi_flow_library + custom_widgets_library + shortcuts_library + server + comic_vine + cbx_backend + concurrent_queue + worker + QsLog + QrCode + KDSignalThrottler +) + +# Platform-specific +if(WIN32) + target_sources(YACReaderLibrary PRIVATE icon.rc) + target_link_libraries(YACReaderLibrary PRIVATE oleaut32 ole32 shell32 user32) +endif() + +if(APPLE) + target_sources(YACReaderLibrary PRIVATE YACReaderLibrary.icns) + set_source_files_properties(YACReaderLibrary.icns PROPERTIES MACOSX_PACKAGE_LOCATION Resources) + set_target_properties(YACReaderLibrary PROPERTIES + MACOSX_BUNDLE TRUE + MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/Info.plist" + MACOSX_BUNDLE_GUI_IDENTIFIER "com.yacreader.YACReaderLibrary" + MACOSX_BUNDLE_BUNDLE_NAME "YACReaderLibrary" + ) + target_link_libraries(YACReaderLibrary PRIVATE + "-framework Foundation" + "-framework ApplicationServices" + "-framework AppKit" + ) +endif() + +# Linux install +if(UNIX AND NOT APPLE) + target_compile_definitions(YACReaderLibrary PRIVATE + "LIBDIR=\"${CMAKE_INSTALL_FULL_LIBDIR}\"" + "DATADIR=\"${CMAKE_INSTALL_FULL_DATADIR}\"" + "BINDIR=\"${CMAKE_INSTALL_FULL_BINDIR}\"") + install(TARGETS YACReaderLibrary RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) + + # Server web files (for bundled server mode) + if(NOT BUILD_SERVER_STANDALONE) + install(DIRECTORY ${CMAKE_SOURCE_DIR}/release/server + DESTINATION ${CMAKE_INSTALL_DATADIR}/yacreader) + endif() +endif() + +endif() # NOT BUILD_SERVER_STANDALONE (YACReaderLibrary executable) diff --git a/YACReaderLibrary/YACReaderLibrary.pro b/YACReaderLibrary/YACReaderLibrary.pro deleted file mode 100644 index 2755861f..00000000 --- a/YACReaderLibrary/YACReaderLibrary.pro +++ /dev/null @@ -1,343 +0,0 @@ -TEMPLATE = app -TARGET = YACReaderLibrary - -QMAKE_TARGET_BUNDLE_PREFIX = "com.yacreader" - -DEPENDPATH += . -INCLUDEPATH += . \ - ../common \ - ./server \ - ./db \ - ../custom_widgets \ - ./comic_vine \ - ./comic_vine/model - -DEFINES += SERVER_RELEASE YACREADER_LIBRARY - -# load default build flags -include (../config.pri) -include (../dependencies/pdf_backend.pri) - -INCLUDEPATH += ../common/rhi - -win32 { - LIBS += -loleaut32 -lole32 -lshell32 -luser32 - msvc { - QMAKE_CXXFLAGS_RELEASE += /MP /Ob2 /Oi /Ot /GT /GL - QMAKE_LFLAGS_RELEASE += /LTCG - } - CONFIG -= embed_manifest_exe -} - -contains(QMAKE_TARGET.arch, x86_64) { - Release:DESTDIR = ../release64 - Debug:DESTDIR = ../debug64 -} else { - Release:DESTDIR = ../release - Debug:DESTDIR = ../debug -} - -macx { - LIBS += -framework Foundation -framework ApplicationServices -framework AppKit - CONFIG += objective_c - QT += gui-private -} - -#CONFIG += release -CONFIG -= flat -QT += sql network widgets svg quickcontrols2 - -QT += core5compat - -greaterThan(QT_MINOR_VERSION, 6): QT += gui-private - -# Input -HEADERS += \ - ../common/concurrent_queue.h \ - ../common/cover_utils.h \ - create_library_dialog.h \ - db/comic_query_result_processor.h \ - db/folder_query_result_processor.h \ - db/query_lexer.h \ - db/search_query.h \ - folder_content_view.h \ - initial_comic_info_extractor.h \ - libraries_update_coordinator.h \ - library_comic_opener.h \ - library_creator.h \ - library_window.h \ - add_library_dialog.h \ - library_window_actions.h \ - recent_visibility_coordinator.h \ - rename_library_dialog.h \ - properties_dialog.h \ - options_dialog.h \ - export_library_dialog.h \ - import_library_dialog.h \ - package_manager.h \ - bundle_creator.h \ - export_comics_info_dialog.h \ - import_comics_info_dialog.h \ - server_config_dialog.h \ - comic_flow_widget.h \ - db_helper.h \ - ./db/data_base_management.h \ - ./db/folder_item.h \ - ./db/folder_model.h \ - ./db/comic_model.h \ - ./db/comic_item.h \ - ../common/comic_db.h \ - ../common/folder.h \ - ../common/library_item.h \ - ../common/comic.h \ - ../common/bookmarks.h \ - ../common/release_acquire_atomic.h \ - ../common/worker_thread.h \ - ../common/custom_widgets.h \ - ../common/qnaturalsorting.h \ - ../common/yacreader_global.h \ - ../common/yacreader_global_gui.h \ - ../common/pdf_comic.h \ - no_libraries_widget.h \ - import_widget.h \ - trayicon_controller.h \ - xml_info_library_scanner.h \ - xml_info_parser.h \ - yacreader_content_views_manager.h \ - yacreader_local_server.h \ - yacreader_main_toolbar.h \ - comics_remover.h \ - ../common/http_worker.h \ - yacreader_libraries.h \ - ../common/exit_check.h \ - comics_view.h \ - classic_comics_view.h \ - no_search_results_widget.h \ - comic_files_manager.h \ - db/reading_list_model.h \ - db/reading_list_item.h \ - yacreader_folders_view.h \ - yacreader_reading_lists_view.h \ - add_label_dialog.h \ - yacreader_history_controller.h \ - yacreader_navigation_controller.h \ - empty_label_widget.h \ - empty_folder_widget.h \ - empty_container_info.h \ - empty_special_list.h \ - empty_reading_list_widget.h \ - ../common/scroll_management.h \ - info_comics_view.h \ - yacreader_comics_selection_helper.h \ - yacreader_comic_info_helper.h \ - db/reading_list.h \ - db/query_parser.h \ - current_comic_view_helper.h \ - ip_config_helper.h \ - ../common/global_info_provider.h \ - ../common/rhi/flow_types.h \ - ../common/rhi/yacreader_flow_rhi.h \ - ../common/rhi/yacreader_comic_flow_rhi.h \ - ../common/rhi/yacreader_page_flow_rhi.h - -SOURCES += \ - ../common/concurrent_queue.cpp \ - ../common/cover_utils.cpp \ - create_library_dialog.cpp \ - db/comic_query_result_processor.cpp \ - db/folder_query_result_processor.cpp \ - db/query_lexer.cpp \ - db/search_query.cpp \ - folder_content_view.cpp \ - initial_comic_info_extractor.cpp \ - libraries_update_coordinator.cpp \ - library_comic_opener.cpp \ - library_creator.cpp \ - library_window.cpp \ - library_window_actions.cpp \ - main.cpp \ - add_library_dialog.cpp \ - recent_visibility_coordinator.cpp \ - rename_library_dialog.cpp \ - properties_dialog.cpp \ - options_dialog.cpp \ - export_library_dialog.cpp \ - import_library_dialog.cpp \ - package_manager.cpp \ - bundle_creator.cpp \ - export_comics_info_dialog.cpp \ - import_comics_info_dialog.cpp \ - server_config_dialog.cpp \ - comic_flow_widget.cpp \ - db_helper.cpp \ - ./db/data_base_management.cpp \ - ./db/folder_item.cpp \ - ./db/folder_model.cpp \ - ./db/comic_model.cpp \ - ./db/comic_item.cpp \ - ../common/comic_db.cpp \ - ../common/folder.cpp \ - ../common/library_item.cpp \ - ../common/comic.cpp \ - ../common/bookmarks.cpp \ - ../common/custom_widgets.cpp \ - ../common/qnaturalsorting.cpp \ - no_libraries_widget.cpp \ - import_widget.cpp \ - trayicon_controller.cpp \ - xml_info_library_scanner.cpp \ - xml_info_parser.cpp \ - yacreader_content_views_manager.cpp \ - yacreader_local_server.cpp \ - yacreader_main_toolbar.cpp \ - comics_remover.cpp \ - ../common/http_worker.cpp \ - ../common/yacreader_global.cpp \ - ../common/yacreader_global_gui.cpp \ - yacreader_libraries.cpp \ - ../common/exit_check.cpp \ - comics_view.cpp \ - classic_comics_view.cpp \ - no_search_results_widget.cpp \ - comic_files_manager.cpp \ - db/reading_list_model.cpp \ - db/reading_list_item.cpp \ - yacreader_folders_view.cpp \ - yacreader_reading_lists_view.cpp \ - add_label_dialog.cpp \ - yacreader_history_controller.cpp \ - yacreader_navigation_controller.cpp \ - empty_label_widget.cpp \ - empty_folder_widget.cpp \ - empty_container_info.cpp \ - empty_special_list.cpp \ - empty_reading_list_widget.cpp \ - ../common/scroll_management.cpp \ - info_comics_view.cpp \ - yacreader_comics_selection_helper.cpp \ - yacreader_comic_info_helper.cpp\ - db/reading_list.cpp \ - current_comic_view_helper.cpp \ - db/query_parser.cpp \ - ip_config_helper.cpp \ - ../common/global_info_provider.cpp \ - ../common/rhi/flow_types.cpp \ - ../common/rhi/yacreader_flow_rhi.cpp \ - ../common/rhi/yacreader_comic_flow_rhi.cpp \ - ../common/rhi/yacreader_page_flow_rhi.cpp - - RESOURCES += ../common/rhi/shaders/shaders.qrc - # Make raw GLSL shader sources editable in Qt Creator - OTHER_FILES += ../common/rhi/shaders/flow.vert \ - ../common/rhi/shaders/flow.frag - -macx { - HEADERS += trayhandler.h - OBJECTIVE_SOURCES += trayhandler.mm -} - -include(./server/server.pri) -include(../custom_widgets/custom_widgets_yacreaderlibrary.pri) - -CONFIG(7zip){ -include(../compressed_archive/wrapper.pri) -} else:CONFIG(unarr) { -include(../compressed_archive/unarr/unarr-wrapper.pri) -} else:CONFIG(libarchive) { -include(../compressed_archive/libarchive/libarchive-wrapper.pri) -} else { - error(No compression backend specified. Did you mess with the build system?) -} - -include(./comic_vine/comic_vine.pri) -include(../third_party/QsLog/QsLog.pri) -include(../shortcuts_management/shortcuts_management.pri) -include(../third_party/QrCode/QrCode.pri) -include(../third_party/KDToolBox/KDToolBox.pri) -include(./themes/themes.pri) -include(../common/themes/themes_common.pri) - -RESOURCES += images.qrc files.qrc -win32:RESOURCES += images_win.qrc -unix:!macx:RESOURCES += images_win.qrc -macx:RESOURCES += images_osx.qrc - -RC_FILE = icon.rc - -macx { - ICON = YACReaderLibrary.icns - QMAKE_INFO_PLIST = Info.plist -} - -TRANSLATIONS = yacreaderlibrary_es.ts \ - yacreaderlibrary_ru.ts \ - yacreaderlibrary_pt.ts \ - yacreaderlibrary_fr.ts \ - yacreaderlibrary_nl.ts \ - yacreaderlibrary_tr.ts \ - yacreaderlibrary_de.ts \ - yacreaderlibrary_zh_CN.ts \ - yacreaderlibrary_zh_TW.ts \ - yacreaderlibrary_zh_HK.ts \ - yacreaderlibrary_it.ts \ - yacreaderlibrary_en.ts - -CONFIG += lrelease - -win32 { - CONFIG(release, debug|release) { - SOURCE_QM_DIR = $$OUT_PWD/release/*.qm - } - CONFIG(debug, debug|release) { - SOURCE_QM_DIR = $$OUT_PWD/debug/*.qm - } - - DEPLOYMENT_OUT_QM_DIR = ../release/languages/ - OUT_QM_DIR = $${DESTDIR}/languages/ - - QMAKE_POST_LINK += $(MKDIR) $$shell_path($${OUT_QM_DIR}) 2> NULL & \ - $(COPY) $$shell_path($${SOURCE_QM_DIR}) $$shell_path($${OUT_QM_DIR}) & \ - $(MKDIR) $$shell_path($${DEPLOYMENT_OUT_QM_DIR}) 2> NULL & \ - $(COPY) $$shell_path($${SOURCE_QM_DIR}) $$shell_path($${DEPLOYMENT_OUT_QM_DIR}) -} else { - LRELEASE_DIR = ../release/languages/ - QM_FILES_INSTALL_PATH = $$DATADIR/yacreader/languages -} - -#QML/GridView -QT += quick qml quickwidgets - -HEADERS += grid_comics_view.h \ - comics_view_transition.h - -SOURCES += grid_comics_view.cpp \ - comics_view_transition.cpp - -RESOURCES += qml.qrc - -unix:!macx { - -DEFINES += "LIBDIR=\\\"$$LIBDIR\\\"" "DATADIR=\\\"$$DATADIR\\\"" "BINDIR=\\\"$$BINDIR\\\"" - -#MAKE INSTALL -INSTALLS += bin icon desktop server manpage - -bin.path = $$BINDIR -isEmpty(DESTDIR) { - bin.files = YACReaderLibrary -} else { - bin.files = $$DESTDIR/YACReaderLibrary -} - -server.path = $$DATADIR/yacreader -server.files = ../release/server - -icon.path = $$DATADIR/icons/hicolor/scalable/apps -icon.files = ../YACReaderLibrary.svg - -desktop.path = $$DATADIR/applications -desktop.files = ../YACReaderLibrary.desktop - -manpage.path = $$DATADIR/man/man1 -manpage.files = ../YACReaderLibrary.1 -} diff --git a/YACReaderLibrary/comic_vine/CMakeLists.txt b/YACReaderLibrary/comic_vine/CMakeLists.txt new file mode 100644 index 00000000..e6ea50d6 --- /dev/null +++ b/YACReaderLibrary/comic_vine/CMakeLists.txt @@ -0,0 +1,71 @@ +# Comic Vine scraper for YACReaderLibrary + +add_library(comic_vine STATIC + comic_vine_json_parser.h + comic_vine_json_parser.cpp + comic_vine_all_volume_comics_retriever.h + comic_vine_all_volume_comics_retriever.cpp + scraper_checkbox.h + scraper_checkbox.cpp + comic_vine_dialog.h + comic_vine_dialog.cpp + comic_vine_client.h + comic_vine_client.cpp + scraper_lineedit.h + scraper_lineedit.cpp + title_header.h + title_header.cpp + series_question.h + series_question.cpp + search_single_comic.h + search_single_comic.cpp + search_volume.h + search_volume.cpp + select_comic.h + select_comic.cpp + select_volume.h + select_volume.cpp + scraper_tableview.h + scraper_tableview.cpp + sort_volume_comics.h + sort_volume_comics.cpp + scraper_scroll_label.h + scraper_scroll_label.cpp + scraper_results_paginator.h + scraper_results_paginator.cpp + api_key_dialog.h + api_key_dialog.cpp + model/volumes_model.h + model/volumes_model.cpp + model/comics_model.h + model/comics_model.cpp + model/json_model.h + model/json_model.cpp + model/response_parser.h + model/response_parser.cpp + model/local_comic_list_model.h + model/local_comic_list_model.cpp + model/volume_comics_model.h + model/volume_comics_model.cpp + model/selected_volume_info.h + model/volume_search_query.h +) +target_include_directories(comic_vine PUBLIC + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/model +) +# App-specific theme.h needed for themable.h → theme_manager.h → theme.h chain +target_include_directories(comic_vine PRIVATE + ${CMAKE_SOURCE_DIR}/YACReaderLibrary/themes + ${CMAKE_SOURCE_DIR}/YACReaderLibrary/db +) +target_link_libraries(comic_vine PUBLIC + Qt::Core + Qt::Widgets + Qt::Network + common_all + common_gui + custom_widgets_library + db_helper + QsLog +) diff --git a/YACReaderLibrary/comic_vine/comic_vine.pri b/YACReaderLibrary/comic_vine/comic_vine.pri deleted file mode 100644 index 97836023..00000000 --- a/YACReaderLibrary/comic_vine/comic_vine.pri +++ /dev/null @@ -1,52 +0,0 @@ - -HEADERS += \ - $$PWD/comic_vine_json_parser.h \ - $$PWD/model/selected_volume_info.h \ - $$PWD/model/volume_search_query.h \ - $$PWD/scraper_checkbox.h \ - comic_vine/comic_vine_dialog.h \ - comic_vine/comic_vine_client.h \ - comic_vine/scraper_lineedit.h \ - comic_vine/title_header.h \ - comic_vine/series_question.h \ - comic_vine/search_single_comic.h \ - comic_vine/search_volume.h \ - comic_vine/select_comic.h \ - comic_vine/select_volume.h \ - comic_vine/model/volumes_model.h \ - comic_vine/model/comics_model.h \ - comic_vine/model/json_model.h \ - comic_vine/model/response_parser.h \ - comic_vine/scraper_tableview.h \ - comic_vine/sort_volume_comics.h \ - comic_vine/model/local_comic_list_model.h \ - comic_vine/model/volume_comics_model.h \ - comic_vine/scraper_scroll_label.h \ - comic_vine/scraper_results_paginator.h \ - comic_vine/api_key_dialog.h \ - $$PWD/comic_vine_all_volume_comics_retriever.h - -SOURCES += \ - $$PWD/comic_vine_json_parser.cpp \ - $$PWD/scraper_checkbox.cpp \ - comic_vine/comic_vine_dialog.cpp \ - comic_vine/comic_vine_client.cpp \ - comic_vine/scraper_lineedit.cpp \ - comic_vine/title_header.cpp \ - comic_vine/series_question.cpp \ - comic_vine/search_single_comic.cpp \ - comic_vine/search_volume.cpp \ - comic_vine/select_comic.cpp \ - comic_vine/select_volume.cpp \ - comic_vine/model/volumes_model.cpp \ - comic_vine/model/comics_model.cpp \ - comic_vine/model/json_model.cpp \ - comic_vine/model/response_parser.cpp \ - comic_vine/scraper_tableview.cpp \ - comic_vine/sort_volume_comics.cpp \ - comic_vine/model/local_comic_list_model.cpp \ - comic_vine/model/volume_comics_model.cpp \ - comic_vine/scraper_scroll_label.cpp \ - comic_vine/scraper_results_paginator.cpp \ - comic_vine/api_key_dialog.cpp \ - $$PWD/comic_vine_all_volume_comics_retriever.cpp diff --git a/YACReaderLibrary/server/CMakeLists.txt b/YACReaderLibrary/server/CMakeLists.txt new file mode 100644 index 00000000..5a78620c --- /dev/null +++ b/YACReaderLibrary/server/CMakeLists.txt @@ -0,0 +1,85 @@ +# YACReaderLibrary server (REST API + HTTP server) + +add_library(server STATIC + static.h + static.cpp + requestmapper.h + requestmapper.cpp + yacreader_http_server.h + yacreader_http_server.cpp + yacreader_http_session.h + yacreader_http_session.cpp + yacreader_http_session_store.h + yacreader_http_session_store.cpp + yacreader_server_data_helper.h + yacreader_server_data_helper.cpp + controllers/versioncontroller.h + controllers/versioncontroller.cpp + controllers/v2/comiccontroller_v2.h + controllers/v2/comiccontroller_v2.cpp + controllers/v2/errorcontroller_v2.h + controllers/v2/errorcontroller_v2.cpp + controllers/v2/folderinfocontroller_v2.h + controllers/v2/folderinfocontroller_v2.cpp + controllers/v2/librariescontroller_v2.h + controllers/v2/librariescontroller_v2.cpp + controllers/v2/pagecontroller_v2.h + controllers/v2/pagecontroller_v2.cpp + controllers/v2/covercontroller_v2.h + controllers/v2/covercontroller_v2.cpp + controllers/v2/updatecomiccontroller_v2.h + controllers/v2/updatecomiccontroller_v2.cpp + controllers/v2/comicdownloadinfocontroller_v2.h + controllers/v2/comicdownloadinfocontroller_v2.cpp + controllers/v2/synccontroller_v2.h + controllers/v2/synccontroller_v2.cpp + controllers/v2/foldercontentcontroller_v2.h + controllers/v2/foldercontentcontroller_v2.cpp + controllers/v2/tagscontroller_v2.h + controllers/v2/tagscontroller_v2.cpp + controllers/v2/tagcontentcontroller_v2.h + controllers/v2/tagcontentcontroller_v2.cpp + controllers/v2/favoritescontroller_v2.h + controllers/v2/favoritescontroller_v2.cpp + controllers/v2/readingcomicscontroller_v2.h + controllers/v2/readingcomicscontroller_v2.cpp + controllers/v2/readinglistscontroller_v2.h + controllers/v2/readinglistscontroller_v2.cpp + controllers/v2/readinglistcontentcontroller_v2.h + controllers/v2/readinglistcontentcontroller_v2.cpp + controllers/v2/comicfullinfocontroller_v2.h + controllers/v2/comicfullinfocontroller_v2.cpp + controllers/v2/readinglistinfocontroller_v2.h + controllers/v2/readinglistinfocontroller_v2.cpp + controllers/v2/taginfocontroller_v2.h + controllers/v2/taginfocontroller_v2.cpp + controllers/v2/comiccontrollerinreadinglist_v2.h + controllers/v2/comiccontrollerinreadinglist_v2.cpp + controllers/v2/foldermetadatacontroller_v2.h + controllers/v2/foldermetadatacontroller_v2.cpp + controllers/v2/searchcontroller_v2.h + controllers/v2/searchcontroller_v2.cpp + controllers/webui/statuspagecontroller.h + controllers/webui/statuspagecontroller.cpp +) +target_include_directories(server PUBLIC + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/controllers + ${CMAKE_CURRENT_SOURCE_DIR}/controllers/v2 +) +target_compile_definitions(server PUBLIC SERVER_VERSION_NUMBER="2.1") +if(UNIX AND NOT APPLE) + target_compile_definitions(server PRIVATE + "DATADIR=\"${CMAKE_INSTALL_FULL_DATADIR}\"") +endif() +target_link_libraries(server PUBLIC + Qt::Core + Qt::Network + Qt::Sql + QtWebApp_httpserver + QtWebApp_templateengine + QsLog + common_all + comic_backend + db_helper +) diff --git a/YACReaderLibrary/server/server.pri b/YACReaderLibrary/server/server.pri deleted file mode 100644 index f94c3662..00000000 --- a/YACReaderLibrary/server/server.pri +++ /dev/null @@ -1,81 +0,0 @@ -INCLUDEPATH += $$PWD -INCLUDEPATH += $$PWD/controllers -INCLUDEPATH += $$PWD/controllers/v2 -DEPENDPATH += $$PWD -DEPENDPATH += $$PWD/controllers -DEPENDPATH += $$PWD/controllers/v2 - - -HEADERS += \ - $$PWD/controllers/v2/foldermetadatacontroller_v2.h \ - $$PWD/controllers/v2/searchcontroller_v2.h \ - $$PWD/static.h \ - $$PWD/requestmapper.h \ - $$PWD/yacreader_http_server.h \ - $$PWD/yacreader_http_session.h \ - $$PWD/yacreader_http_session_store.h \ - $$PWD/yacreader_server_data_helper.h \ - $$PWD/controllers/versioncontroller.h \ - #v2 - $$PWD/controllers/v2/comiccontroller_v2.h \ - $$PWD/controllers/v2/errorcontroller_v2.h \ - $$PWD/controllers/v2/folderinfocontroller_v2.h \ - $$PWD/controllers/v2/librariescontroller_v2.h \ - $$PWD/controllers/v2/pagecontroller_v2.h \ - $$PWD/controllers/v2/covercontroller_v2.h \ - $$PWD/controllers/v2/updatecomiccontroller_v2.h \ - $$PWD/controllers/v2/comicdownloadinfocontroller_v2.h \ - $$PWD/controllers/v2/synccontroller_v2.h \ - $$PWD/controllers/v2/foldercontentcontroller_v2.h \ - $$PWD/controllers/v2/tagscontroller_v2.h \ - $$PWD/controllers/v2/tagcontentcontroller_v2.h \ - $$PWD/controllers/v2/favoritescontroller_v2.h \ - $$PWD/controllers/v2/readingcomicscontroller_v2.h \ - $$PWD/controllers/v2/readinglistscontroller_v2.h \ - $$PWD/controllers/v2/readinglistcontentcontroller_v2.h \ - $$PWD/controllers/v2/comicfullinfocontroller_v2.h \ - $$PWD/controllers/v2/readinglistinfocontroller_v2.h \ - $$PWD/controllers/v2/taginfocontroller_v2.h \ - $$PWD/controllers/v2/comiccontrollerinreadinglist_v2.h\ - #Browser - $$PWD/controllers/webui/statuspagecontroller.h - - -SOURCES += \ - $$PWD/controllers/v2/foldermetadatacontroller_v2.cpp \ - $$PWD/controllers/v2/searchcontroller_v2.cpp \ - $$PWD/static.cpp \ - $$PWD/requestmapper.cpp \ - $$PWD/yacreader_http_server.cpp \ - $$PWD/yacreader_http_session.cpp \ - $$PWD/yacreader_http_session_store.cpp \ - $$PWD/yacreader_server_data_helper.cpp \ - $$PWD/controllers/versioncontroller.cpp \ - #v2 - $$PWD/controllers/v2/comiccontroller_v2.cpp \ - $$PWD/controllers/v2/errorcontroller_v2.cpp \ - $$PWD/controllers/v2/folderinfocontroller_v2.cpp \ - $$PWD/controllers/v2/librariescontroller_v2.cpp \ - $$PWD/controllers/v2/pagecontroller_v2.cpp \ - $$PWD/controllers/v2/covercontroller_v2.cpp \ - $$PWD/controllers/v2/updatecomiccontroller_v2.cpp \ - $$PWD/controllers/v2/comicdownloadinfocontroller_v2.cpp \ - $$PWD/controllers/v2/synccontroller_v2.cpp \ - $$PWD/controllers/v2/foldercontentcontroller_v2.cpp \ - $$PWD/controllers/v2/tagscontroller_v2.cpp \ - $$PWD/controllers/v2/tagcontentcontroller_v2.cpp \ - $$PWD/controllers/v2/favoritescontroller_v2.cpp \ - $$PWD/controllers/v2/readingcomicscontroller_v2.cpp \ - $$PWD/controllers/v2/readinglistscontroller_v2.cpp \ - $$PWD/controllers/v2/readinglistcontentcontroller_v2.cpp \ - $$PWD/controllers/v2/comicfullinfocontroller_v2.cpp \ - $$PWD/controllers/v2/readinglistinfocontroller_v2.cpp \ - $$PWD/controllers/v2/taginfocontroller_v2.cpp \ - $$PWD/controllers/v2/comiccontrollerinreadinglist_v2.cpp \ - #WebUI - $$PWD/controllers/webui/statuspagecontroller.cpp - -include(../../third_party/QtWebApp/httpserver/httpserver.pri) -include(../../third_party/QtWebApp/templateengine/templateengine.pri) - -DEFINES += SERVER_VERSION_NUMBER=\\\"2.1\\\" diff --git a/YACReaderLibrary/themes/themes.pri b/YACReaderLibrary/themes/themes.pri deleted file mode 100644 index eee35324..00000000 --- a/YACReaderLibrary/themes/themes.pri +++ /dev/null @@ -1,7 +0,0 @@ -INCLUDEPATH += $$PWD - -HEADERS += \ - $$PWD/theme.h \ - $$PWD/theme_factory.h -SOURCES += \ - $$PWD/theme_factory.cpp diff --git a/YACReaderLibraryServer/CMakeLists.txt b/YACReaderLibraryServer/CMakeLists.txt new file mode 100644 index 00000000..619f10a8 --- /dev/null +++ b/YACReaderLibraryServer/CMakeLists.txt @@ -0,0 +1,94 @@ +# YACReaderLibraryServer - Headless REST server + +qt_add_executable(YACReaderLibraryServer + main.cpp + console_ui_library_creator.h + console_ui_library_creator.cpp + libraries_updater.h + libraries_updater.cpp +) + +target_include_directories(YACReaderLibraryServer PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_SOURCE_DIR}/YACReaderLibrary + ${CMAKE_SOURCE_DIR}/YACReaderLibrary/db +) + +target_compile_definitions(YACReaderLibraryServer PRIVATE + SERVER_RELEASE + YACREADER_LIBRARY +) + +# Resources +qt_add_resources(yacreaderlibraryserver_images_rcc "${CMAKE_CURRENT_SOURCE_DIR}/images.qrc") +target_sources(YACReaderLibraryServer PRIVATE ${yacreaderlibraryserver_images_rcc}) + +# Translations +qt_add_translations(YACReaderLibraryServer + TS_FILES + yacreaderlibraryserver_es.ts + yacreaderlibraryserver_ru.ts + yacreaderlibraryserver_pt.ts + yacreaderlibraryserver_fr.ts + yacreaderlibraryserver_nl.ts + yacreaderlibraryserver_tr.ts + yacreaderlibraryserver_de.ts + yacreaderlibraryserver_zh_CN.ts + yacreaderlibraryserver_zh_TW.ts + yacreaderlibraryserver_zh_HK.ts +) + +target_link_libraries(YACReaderLibraryServer PRIVATE + Qt::Core + Qt::Network + Qt::Sql + Qt::Core5Compat + library_common + db_helper + comic_backend + common_all + naturalsort + cbx_backend + server + QsLog + QrCode +) + +# Platform-specific +if(WIN32) + target_link_libraries(YACReaderLibraryServer PRIVATE oleaut32 ole32 shell32 user32) +endif() + +if(APPLE) + set_target_properties(YACReaderLibraryServer PROPERTIES + MACOSX_BUNDLE TRUE + MACOSX_BUNDLE_GUI_IDENTIFIER "com.yacreader.YACReaderLibraryServer" + MACOSX_BUNDLE_BUNDLE_NAME "YACReaderLibraryServer" + ) + target_link_libraries(YACReaderLibraryServer PRIVATE + "-framework Foundation" + "-framework ApplicationServices" + "-framework AppKit" + ) +endif() + +# Linux install rules +if(UNIX AND NOT APPLE) + target_compile_definitions(YACReaderLibraryServer PRIVATE + "LIBDIR=\"${CMAKE_INSTALL_FULL_LIBDIR}\"" + "DATADIR=\"${CMAKE_INSTALL_FULL_DATADIR}\"" + "BINDIR=\"${CMAKE_INSTALL_FULL_BINDIR}\"" + ) + + install(TARGETS YACReaderLibraryServer RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) + + # Standalone server: install server web files alongside the binary + if(BUILD_SERVER_STANDALONE) + install(DIRECTORY ${CMAKE_SOURCE_DIR}/release/server + DESTINATION ${CMAKE_INSTALL_DATADIR}/yacreader) + endif() + + # systemd service + install(FILES yacreaderlibraryserver.service + DESTINATION ${CMAKE_INSTALL_LIBDIR}/systemd/user) +endif() diff --git a/YACReaderLibraryServer/YACReaderLibraryServer.pro b/YACReaderLibraryServer/YACReaderLibraryServer.pro deleted file mode 100644 index 89e0938e..00000000 --- a/YACReaderLibraryServer/YACReaderLibraryServer.pro +++ /dev/null @@ -1,178 +0,0 @@ -TEMPLATE = app -TARGET = YACReaderLibraryServer - -QMAKE_TARGET_BUNDLE_PREFIX = "com.yacreader" - -CONFIG += console -DEPENDPATH += ../YACReaderLibrary -INCLUDEPATH += ../YACReaderLibrary \ - ../common \ - ../YACReaderLibrary/server \ - ../YACReaderLibrary/db - -DEFINES += SERVER_RELEASE YACREADER_LIBRARY -# load default build flags -# do a basic dependency check -include(headless_config.pri) -include(../dependencies/pdf_backend.pri) -include(../third_party/QrCode/QrCode.pri) - -QT += core5compat - -win32 { - LIBS += -loleaut32 -lole32 -lshell32 -luser32 - msvc { - QMAKE_CXXFLAGS_RELEASE += /MP /Ob2 /Oi /Ot /GT /GL - QMAKE_LFLAGS_RELEASE += /LTCG - } - CONFIG -= embed_manifest_exe -} - -macx { - LIBS += -framework Foundation -framework ApplicationServices -framework AppKit - CONFIG += objective_c -} - -#CONFIG += release -CONFIG -= flat -QT += core sql network - -# Source files -HEADERS += ../YACReaderLibrary/library_creator.h \ - ../YACReaderLibrary/package_manager.h \ - ../YACReaderLibrary/bundle_creator.h \ - ../YACReaderLibrary/db_helper.h \ - ../YACReaderLibrary/db/data_base_management.h \ - ../YACReaderLibrary/db/reading_list.h \ - ../YACReaderLibrary/initial_comic_info_extractor.h \ - ../YACReaderLibrary/xml_info_parser.h \ - ../YACReaderLibrary/xml_info_library_scanner.h \ - ../common/comic_db.h \ - ../common/folder.h \ - ../common/library_item.h \ - ../common/comic.h \ - ../common/pdf_comic.h \ - ../common/bookmarks.h \ - ../common/qnaturalsorting.h \ - ../common/yacreader_global.h \ - ../common/cover_utils.h \ - ../YACReaderLibrary/yacreader_local_server.h \ - ../YACReaderLibrary/comics_remover.h \ - ../common/http_worker.h \ - ../YACReaderLibrary/yacreader_libraries.h \ - ../YACReaderLibrary/comic_files_manager.h \ - console_ui_library_creator.h \ - libraries_updater.h \ - ../YACReaderLibrary/ip_config_helper.h \ - ../YACReaderLibrary/db/query_lexer.h \ - ../YACReaderLibrary/db/query_parser.h \ - ../YACReaderLibrary/db/search_query.h \ - ../YACReaderLibrary/libraries_update_coordinator.h \ - ../common/global_info_provider.h \ - - -SOURCES += ../YACReaderLibrary/library_creator.cpp \ - ../YACReaderLibrary/package_manager.cpp \ - ../YACReaderLibrary/bundle_creator.cpp \ - ../YACReaderLibrary/db_helper.cpp \ - ../YACReaderLibrary/db/data_base_management.cpp \ - ../YACReaderLibrary/db/reading_list.cpp \ - ../YACReaderLibrary/initial_comic_info_extractor.cpp \ - ../YACReaderLibrary/xml_info_parser.cpp \ - ../YACReaderLibrary/xml_info_library_scanner.cpp \ - ../common/comic_db.cpp \ - ../common/folder.cpp \ - ../common/library_item.cpp \ - ../common/comic.cpp \ - ../common/bookmarks.cpp \ - ../common/qnaturalsorting.cpp \ - ../common/cover_utils.cpp \ - ../YACReaderLibrary/yacreader_local_server.cpp \ - ../YACReaderLibrary/comics_remover.cpp \ - ../common/http_worker.cpp \ - ../common/yacreader_global.cpp \ - ../YACReaderLibrary/yacreader_libraries.cpp \ - ../YACReaderLibrary/comic_files_manager.cpp \ - console_ui_library_creator.cpp \ - main.cpp \ - libraries_updater.cpp \ - ../YACReaderLibrary/ip_config_helper.cpp \ - ../YACReaderLibrary/db/query_lexer.cpp \ - ../YACReaderLibrary/db/query_parser.cpp \ - ../YACReaderLibrary/db/search_query.cpp \ - ../YACReaderLibrary/libraries_update_coordinator.cpp \ - ../common/global_info_provider.cpp \ - -include(../YACReaderLibrary/server/server.pri) - -CONFIG(7zip) { -include(../compressed_archive/wrapper.pri) -} else:CONFIG(unarr) { -include(../compressed_archive/unarr/unarr-wrapper.pri) -} else:CONFIG(libarchive) { -include(../compressed_archive/libarchive/libarchive-wrapper.pri) -} else { - error(No compression backend specified. Did you mess with the build system?) -} -include(../third_party/QsLog/QsLog.pri) - -TRANSLATIONS = yacreaderlibraryserver_es.ts \ - yacreaderlibraryserver_ru.ts \ - yacreaderlibraryserver_pt.ts \ - yacreaderlibraryserver_fr.ts \ - yacreaderlibraryserver_nl.ts \ - yacreaderlibraryserver_tr.ts \ - yacreaderlibraryserver_de.ts \ - yacreaderlibraryserver_zh_CN.ts \ - yacreaderlibraryserver_zh_TW.ts \ - yacreaderlibraryserver_zh_HK.ts \ - yacreaderlibraryserver_source.ts - -RESOURCES += images.qrc - -contains(QMAKE_TARGET.arch, x86_64) { - Release:DESTDIR = ../release64 - Debug:DESTDIR = ../debug64 -} else { - Release:DESTDIR = ../release - Debug:DESTDIR = ../debug -} - -unix:!macx { -#set install prefix if it's empty - -DEFINES += "LIBDIR=\\\"$$LIBDIR\\\"" "DATADIR=\\\"$$DATADIR\\\"" "BINDIR=\\\"$$BINDIR\\\"" - -#make install - -!CONFIG(server_bundled):!CONFIG(server_standalone): { - CONFIG+=server_bundled - message("No build type specified. Defaulting to bundled server build (CONFIG+=server_bundled).") - message("If you wish to run YACReaderLibraryServer on a system without an existing install of YACReaderLibrary,\ - please specify CONFIG+=server_standalone as an option when running qmake to avoid missing dependencies.") -} - -CONFIG(server_standalone) { - INSTALLS += bin server systemd -} -else:CONFIG(server_bundled) { - INSTALLS += bin systemd -} - -bin.path = $$BINDIR -isEmpty(DESTDIR) { - bin.files = YACReaderLibraryServer -} else { - bin.files = $$DESTDIR/YACReaderLibraryServer -} - -server.path = $$DATADIR/yacreader -server.files = ../release/server - -systemd.path = $$LIBDIR/systemd/user -systemd.files = yacreaderlibraryserver.service - -# TODO: We need a manpage for yaclibserver -#manpage.path = $$DATADIR/man/man1 -#manpage.files = ../YACReaderLibrary.1 -} diff --git a/YACReaderLibraryServer/headless_config.pri b/YACReaderLibraryServer/headless_config.pri deleted file mode 100644 index 4e499be4..00000000 --- a/YACReaderLibraryServer/headless_config.pri +++ /dev/null @@ -1,37 +0,0 @@ -# functions to automatically initialize some of YACReaderLibraryServer's build -# options to default values if they're not set at build time -# for a more detailed description, see INSTALL.TXT - -include (../config.pri) - -unix!macx { - !contains(QT_CONFIG, no-pkg-config) { - packagesExist(Qt5Core) { - message("Found Qt5Core") - } else: { - message("Missing dependency: Qt5Core") - } - packagesExist(Qt5Gui) { - message("Found Qt5Gui") - } else: { - message("Missing dependency: Qt5Gui") - } - packagesExist(Qt5Network) { - message("Found Qt5Network") - } else: { - message("Missing dependency: Qt5Network") - } - packagesExist(Qt5Sql) { - message("Found Qt5Sql") - } else: { - message("Missing dependency: Qt5Sql") - } - packagesExist(sqlite3) { - message("Found sqlite3") - } else: { - message("Missing dependency: sqlite3") - } - } else { - message("Qmake was compiled without support for pkg-config. Skipping dependency checks.") - } -} diff --git a/ci/win/create_installer.cmd b/ci/win/create_installer.cmd index 583ad225..10f0d6c8 100644 --- a/ci/win/create_installer.cmd +++ b/ci/win/create_installer.cmd @@ -6,11 +6,7 @@ set ARCH=%1 set COMPRESSION=%2 set BUILD_NUMBER=%3 -IF "%ARCH%"=="x64" ( - SET exe_path=%src_path%\release64 -) ELSE ( - SET exe_path=%src_path%\release -) +SET exe_path=%src_path%\build\bin rmdir /S /Q installer_contents @@ -45,7 +41,13 @@ mkdir openssl copy %src_path%\dependencies\openssl\win\%ARCH%\* .\openssl\ xcopy %src_path%\release\server .\server /i /e -xcopy %src_path%\release\languages .\languages /i /e + +rem Collect cmake-generated .qm translation files from the build tree +rem (release\languages is not tracked in git; cmake generates .qm in build subdirs) +mkdir languages +for /r %src_path%\build %%f in (*.qm) do ( + copy "%%f" .\languages\ >nul +) copy %src_path%\vc_redist.%ARCH%.exe . diff --git a/cleanOSX.sh b/cleanOSX.sh index a1757f06..dd35cf3e 100755 --- a/cleanOSX.sh +++ b/cleanOSX.sh @@ -1,17 +1,6 @@ #!/bin/bash -rm -R *.app -rm -R YACReader-* -rm -R *.dmg -cd YACReader -make distclean -rm -R YACReader.app -cd .. -cd YACReaderLibrary -make distclean -rm -R YACReaderLibrary.app -cd .. -cd YACReaderLibraryServer -make distclean -rm -R YACReaderLibraryServer.app -cd .. +rm -rf build +rm -rf *.app +rm -rf YACReader-* +rm -rf *.dmg diff --git a/cmake/CompilerOptions.cmake b/cmake/CompilerOptions.cmake new file mode 100644 index 00000000..2b1378dc --- /dev/null +++ b/cmake/CompilerOptions.cmake @@ -0,0 +1,20 @@ +# Compiler options for YACReader +# Mirrors config.pri: C++20, NOMINMAX, MSVC conformance flags + +add_compile_definitions(NOMINMAX) + +if(MSVC) + # /Zc:__cplusplus: report correct __cplusplus value + # /permissive-: strict standard conformance + add_compile_options(/Zc:__cplusplus /permissive-) + + # Release optimizations (mirrors qmake QMAKE_CXXFLAGS_RELEASE) + string(APPEND CMAKE_CXX_FLAGS_RELEASE " /DNDEBUG") +elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang") + string(APPEND CMAKE_CXX_FLAGS_RELEASE " -DNDEBUG") +endif() + +# Qt deprecation warnings +add_compile_definitions( + QT_DEPRECATED_WARNINGS +) diff --git a/cmake/PdfBackend.cmake b/cmake/PdfBackend.cmake new file mode 100644 index 00000000..a9f9ce1f --- /dev/null +++ b/cmake/PdfBackend.cmake @@ -0,0 +1,97 @@ +# PDF backend detection for YACReader +# Creates an INTERFACE target 'pdf_backend_iface' that propagates +# compile definitions and link libraries based on PDF_BACKEND. + +add_library(pdf_backend_iface INTERFACE) + +if(PDF_BACKEND STREQUAL "no_pdf") + message(STATUS "PDF backend: disabled") + target_compile_definitions(pdf_backend_iface INTERFACE NO_PDF) + +elseif(PDF_BACKEND STREQUAL "pdfium") + message(STATUS "PDF backend: pdfium") + target_compile_definitions(pdf_backend_iface INTERFACE USE_PDFIUM) + + if(MSVC) + target_include_directories(pdf_backend_iface INTERFACE + "${CMAKE_SOURCE_DIR}/dependencies/pdfium/win/public") + if(CMAKE_SYSTEM_PROCESSOR STREQUAL "ARM64" OR CMAKE_CXX_COMPILER_ARCHITECTURE_ID STREQUAL "ARM64") + target_link_directories(pdf_backend_iface INTERFACE + "${CMAKE_SOURCE_DIR}/dependencies/pdfium/win/arm64") + else() + target_link_directories(pdf_backend_iface INTERFACE + "${CMAKE_SOURCE_DIR}/dependencies/pdfium/win/x64") + endif() + target_link_libraries(pdf_backend_iface INTERFACE pdfium) + elseif(APPLE) + target_include_directories(pdf_backend_iface INTERFACE + "${CMAKE_SOURCE_DIR}/dependencies/pdfium/macx/include") + target_link_directories(pdf_backend_iface INTERFACE + "${CMAKE_SOURCE_DIR}/dependencies/pdfium/macx/bin") + target_link_libraries(pdf_backend_iface INTERFACE pdfium) + else() + # Linux: try pkg-config first, then system path + pkg_check_modules(PDFIUM QUIET IMPORTED_TARGET libpdfium) + if(PDFIUM_FOUND) + message(STATUS " Found pdfium via pkg-config") + target_link_libraries(pdf_backend_iface INTERFACE PkgConfig::PDFIUM) + elseif(EXISTS "/usr/include/pdfium") + message(STATUS " Found pdfium at /usr/include/pdfium") + target_include_directories(pdf_backend_iface INTERFACE /usr/include/pdfium) + target_link_libraries(pdf_backend_iface INTERFACE pdfium) + else() + message(FATAL_ERROR "Could not find libpdfium. Install it or use a different PDF_BACKEND.") + endif() + endif() + +elseif(PDF_BACKEND STREQUAL "poppler") + message(STATUS "PDF backend: poppler") + target_compile_definitions(pdf_backend_iface INTERFACE USE_POPPLER) + + if(APPLE) + message(FATAL_ERROR "Poppler backend is not supported on macOS") + endif() + + # Try cmake config mode first (poppler built with cmake, or vcpkg with cmake integration) + # On Windows: vcpkg install poppler[qt6]:x64-windows, then pass the vcpkg toolchain file + find_package(Poppler QUIET CONFIG) + if(TARGET Poppler::Qt6) + message(STATUS " Found poppler-qt6 via cmake config") + target_link_libraries(pdf_backend_iface INTERFACE Poppler::Qt6) + else() + # Fall back to pkg-config (standard on Linux; on Windows requires vcpkg pkgconf) + pkg_check_modules(POPPLER QUIET IMPORTED_TARGET poppler-qt6) + if(POPPLER_FOUND) + message(STATUS " Found poppler-qt6 via pkg-config") + target_link_libraries(pdf_backend_iface INTERFACE PkgConfig::POPPLER) + elseif(NOT MSVC AND EXISTS "/usr/include/poppler/qt6") + message(STATUS " Found poppler-qt6 at /usr/include/poppler/qt6") + target_include_directories(pdf_backend_iface INTERFACE /usr/include/poppler/qt6) + target_link_libraries(pdf_backend_iface INTERFACE poppler-qt6) + elseif(MSVC) + message(FATAL_ERROR "Could not find poppler-qt6. " + "Install via vcpkg: vcpkg install poppler[qt6]:x64-windows " + "then configure cmake with the vcpkg toolchain file.") + else() + message(FATAL_ERROR "Could not find poppler-qt6. Install libpoppler-qt6-dev or use a different PDF_BACKEND.") + endif() + endif() + +elseif(PDF_BACKEND STREQUAL "pdfkit") + message(STATUS "PDF backend: pdfkit (macOS)") + if(NOT APPLE) + message(FATAL_ERROR "pdfkit backend is macOS only") + endif() + target_compile_definitions(pdf_backend_iface INTERFACE USE_PDFKIT) + +else() + message(FATAL_ERROR "Unknown PDF_BACKEND: '${PDF_BACKEND}'. Use: pdfium, poppler, pdfkit, or no_pdf") +endif() + +# Set QT_DISABLE_DEPRECATED_BEFORE based on backend +# poppler requires older deprecated API +if(PDF_BACKEND STREQUAL "poppler") + target_compile_definitions(pdf_backend_iface INTERFACE QT_DISABLE_DEPRECATED_BEFORE=0x050900) +else() + target_compile_definitions(pdf_backend_iface INTERFACE QT_DISABLE_DEPRECATED_BEFORE=0x050F00) +endif() diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt new file mode 100644 index 00000000..c754f552 --- /dev/null +++ b/common/CMakeLists.txt @@ -0,0 +1,197 @@ +# Common libraries for YACReader +# Fine-grained STATIC targets per concern + +# --- yr_global (no GUI, used by all 3 apps) --- +add_library(yr_global STATIC + yacreader_global.h + yacreader_global.cpp +) +target_include_directories(yr_global PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) +target_link_libraries(yr_global PUBLIC Qt::Core) +if(UNIX AND NOT APPLE) + target_compile_definitions(yr_global PRIVATE + "LIBDIR=\"${CMAKE_INSTALL_FULL_LIBDIR}\"") +endif() + +# --- naturalsort --- +add_library(naturalsort STATIC + qnaturalsorting.h + qnaturalsorting.cpp +) +target_include_directories(naturalsort PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) +target_link_libraries(naturalsort PUBLIC Qt::Core) + +# --- concurrent_queue --- +add_library(concurrent_queue STATIC + concurrent_queue.h + concurrent_queue.cpp +) +target_include_directories(concurrent_queue PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) +target_link_libraries(concurrent_queue PUBLIC Qt::Core) + +# --- worker (header-only thread helpers) --- +add_library(worker INTERFACE) +target_include_directories(worker INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) +target_sources(worker INTERFACE + ${CMAKE_CURRENT_SOURCE_DIR}/worker_thread.h + ${CMAKE_CURRENT_SOURCE_DIR}/release_acquire_atomic.h +) + +# --- common_all (shared non-GUI code used by all 3 apps) --- +add_library(common_all STATIC + comic_db.h + comic_db.cpp + folder.h + folder.cpp + library_item.h + library_item.cpp + bookmarks.h + bookmarks.cpp + http_worker.h + http_worker.cpp + cover_utils.h + cover_utils.cpp + global_info_provider.h + global_info_provider.cpp +) +target_include_directories(common_all PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) +target_link_libraries(common_all PUBLIC + Qt::Core + Qt::Gui + Qt::Sql + Qt::Network + yr_global + naturalsort + pdf_backend_iface +) + +# --- comic_backend (comic file handling + PDF) --- +add_library(comic_backend STATIC + comic.h + comic.cpp + pdf_comic.h +) + +# PDF source depends on backend +if(PDF_BACKEND STREQUAL "pdfkit") + target_sources(comic_backend PRIVATE pdf_comic.mm) +elseif(NOT PDF_BACKEND STREQUAL "no_pdf") + target_sources(comic_backend PRIVATE pdf_comic.cpp) +endif() + +target_include_directories(comic_backend PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) +target_link_libraries(comic_backend PUBLIC + Qt::Core + Qt::Gui + common_all + pdf_backend_iface + cbx_backend + QsLog +) + +# GUI-only targets: not needed for server-standalone builds (Qt 6.4+) which +# lack Qt::Widgets, Qt::ShaderTools, Qt::GuiPrivate, etc. +if(NOT BUILD_SERVER_STANDALONE) + +# --- common_gui (GUI-only code: widgets, version check, themes infrastructure) --- +# NOTE: theme_manager.h/cpp is NOT included here because it depends on app-specific +# theme.h (YACReader vs YACReaderLibrary have different Theme structs). +# Each app includes theme_manager directly alongside its own theme.h/theme_factory. +add_library(common_gui STATIC + custom_widgets.h + custom_widgets.cpp + check_new_version.h + check_new_version.cpp + yacreader_global_gui.h + yacreader_global_gui.cpp + exit_check.h + exit_check.cpp + scroll_management.h + scroll_management.cpp + # themes infrastructure (does NOT depend on app-specific theme.h) + themes/icon_utils.h + themes/icon_utils.cpp + themes/theme_id.h + themes/themable.h + themes/yacreader_icon.h + themes/shared/help_about_dialog_theme.h + themes/shared/whats_new_dialog_theme.h +) +target_include_directories(common_gui PUBLIC + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/themes + ${CMAKE_CURRENT_SOURCE_DIR}/themes/shared +) +target_link_libraries(common_gui PUBLIC + Qt::Core + Qt::Core5Compat + Qt::Widgets + Qt::Network + Qt::Svg + common_all + yr_global + QsLog +) + +# --- RHI flow (3D coverflow) --- +# Compiled twice with different defines, like the old GL flow pattern. +# Shaders are compiled from GLSL 450 source at build time via qt_add_shaders(). + +set(RHI_FLOW_SOURCES + rhi/flow_types.h + rhi/flow_types.cpp + rhi/yacreader_flow_rhi.h + rhi/yacreader_flow_rhi.cpp + rhi/yacreader_comic_flow_rhi.h + rhi/yacreader_comic_flow_rhi.cpp + rhi/yacreader_page_flow_rhi.h + rhi/yacreader_page_flow_rhi.cpp +) + +add_library(rhi_flow_reader STATIC ${RHI_FLOW_SOURCES}) +target_include_directories(rhi_flow_reader PUBLIC + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/rhi +) +target_compile_definitions(rhi_flow_reader PRIVATE YACREADER) +target_link_libraries(rhi_flow_reader PUBLIC + Qt::Core + Qt::Gui + Qt::GuiPrivate + Qt::Widgets +) +qt_add_shaders(rhi_flow_reader "flow_shaders_reader" + BASE rhi/shaders + PREFIX "/shaders" + GLSL "100es,120,150" + HLSL 50 + MSL 12 + FILES + rhi/shaders/flow.vert + rhi/shaders/flow.frag +) + +add_library(rhi_flow_library STATIC ${RHI_FLOW_SOURCES}) +target_include_directories(rhi_flow_library PUBLIC + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/rhi +) +target_compile_definitions(rhi_flow_library PRIVATE YACREADER_LIBRARY) +target_link_libraries(rhi_flow_library PUBLIC + Qt::Core + Qt::Gui + Qt::GuiPrivate + Qt::Widgets +) +qt_add_shaders(rhi_flow_library "flow_shaders_library" + BASE rhi/shaders + PREFIX "/shaders" + GLSL "100es,120,150" + HLSL 50 + MSL 12 + FILES + rhi/shaders/flow.vert + rhi/shaders/flow.frag +) + +endif() # NOT BUILD_SERVER_STANDALONE diff --git a/common/rhi/README.md b/common/rhi/README.md index fd124797..f3ca057c 100644 --- a/common/rhi/README.md +++ b/common/rhi/README.md @@ -27,7 +27,7 @@ QRhiWidget (Qt base class) - **yacreader_flow_rhi.h** - Header with class definitions - **yacreader_flow_rhi.cpp** - Implementation -- **shaders/** - GLSL 450 shaders and compiled .qsb files +- **shaders/** - GLSL 450 shader source files (compiled to .qsb at build time by `qt_add_shaders`) - **README.md** - This file ## Key Features @@ -52,7 +52,8 @@ QRhi resources managed: ### Shader System -Shaders are written in **GLSL 4.50** and compiled to `.qsb` format supporting: +Shaders are written in **GLSL 4.50** and compiled to `.qsb` format at build time +via `qt_add_shaders()` in CMake, supporting: - OpenGL ES 2.0, 3.0 - OpenGL 2.1, 3.0+ - HLSL (Direct3D 11/12) @@ -134,36 +135,20 @@ All public methods from `YACReaderFlowGL` are preserved: ### Prerequisites -1. **Qt 6.7 or later** -2. **qsb tool** (Qt Shader Baker) in PATH -3. **C++17 compiler** - -### Compile Shaders - -Before building YACReader, compile the shaders: - -```bash -cd common/rhi/shaders -# Windows -compile_shaders.bat - -# Unix/macOS -chmod +x compile_shaders.sh -./compile_shaders.sh -``` - -This generates `flow.vert.qsb` and `flow.frag.qsb` which are embedded via `shaders.qrc`. +1. **Qt 6.7 or later** (with ShaderTools module) +2. **CMake 3.25+** +3. **C++20 compiler** ### Build YACReader -The `.pro` files automatically include RHI sources for Qt 6.7+: +Shaders are compiled automatically at build time via `qt_add_shaders()`: ```bash -qmake YACReader.pro -make +cmake -B build -DCMAKE_BUILD_TYPE=Release +cmake --build build --parallel ``` -For Qt 5 builds, the OpenGL version is used automatically. +No manual shader compilation step is needed. ## Graphics API Selection @@ -224,7 +209,7 @@ qDebug() << "Driver:" << rhi->driverInfo(); ### Common Issues **Problem**: Shaders fail to load -**Solution**: Ensure `.qsb` files are compiled and included in resources +**Solution**: Ensure Qt ShaderTools module is installed and `qt_add_shaders()` ran during build **Problem**: Black screen on Qt 6.7 **Solution**: Check if `YACREADER_USE_RHI` is defined in build @@ -260,7 +245,7 @@ The RHI version is a **drop-in replacement** requiring no application code chang 1. **Qt Version**: Requires Qt 6.7+ (released April 2024) 2. **QRhi Stability**: QRhi APIs may change in minor Qt releases 3. **Mixed Renderers**: Only one graphics API per window -4. **Shader Compilation**: Must recompile shaders when modifying source +4. **Shader Compilation**: Shaders are recompiled automatically when source files change ## Future Improvements diff --git a/common/rhi/shaders/README.md b/common/rhi/shaders/README.md deleted file mode 100644 index 7b882820..00000000 --- a/common/rhi/shaders/README.md +++ /dev/null @@ -1,49 +0,0 @@ -# YACReader Flow RHI Shaders - -This directory contains the GLSL 4.50 shaders for the QRhiWidget-based flow implementation. - -## Files - -- `flow.vert` - Vertex shader (GLSL 450) -- `flow.frag` - Fragment shader (GLSL 450) -- `flow.vert.qsb` - Compiled vertex shader (multi-platform) -- `flow.frag.qsb` - Compiled fragment shader (multi-platform) -- `compile_shaders.bat` - Windows compilation script -- `compile_shaders.sh` - Unix/macOS compilation script -- `shaders.qrc` - Qt resource file - -## Compiling Shaders - -The shaders must be compiled to `.qsb` format using Qt's `qsb` tool before building YACReader. - -### Prerequisites - -Ensure `qsb` is in your PATH. It's typically located in: -- Windows: `C:\Qt\6.x.x\msvc2019_64\bin\qsb.exe` -- macOS: `/opt/Qt/6.x.x/macos/bin/qsb` -- Linux: `/opt/Qt/6.x.x/gcc_64/bin/qsb` - -### Compilation - -**Windows:** -```cmd -cd common/rhi/shaders -compile_shaders.bat -``` - -**Unix/macOS:** -```bash -cd common/rhi/shaders -chmod +x compile_shaders.sh -./compile_shaders.sh -``` - -The compiled `.qsb` files contain shader variants for: -- OpenGL ES 2.0, 3.0 -- OpenGL 2.1, 3.0+ -- HLSL (Direct3D 11/12) -- Metal Shading Language (macOS/iOS) - -## Note - -The `.qsb` files are included in the repository for convenience. Recompile only if you modify the shader source. diff --git a/common/rhi/shaders/compile_shaders.bat b/common/rhi/shaders/compile_shaders.bat deleted file mode 100644 index 56ce7381..00000000 --- a/common/rhi/shaders/compile_shaders.bat +++ /dev/null @@ -1,19 +0,0 @@ -@echo off -REM Compile shaders to .qsb format for Qt RHI -REM Requires qsb tool from Qt installation - -echo Compiling flow vertex shader... -qsb --glsl "100 es,120,150" --hlsl 50 --msl 12 -o flow.vert.qsb flow.vert -if %ERRORLEVEL% NEQ 0 ( - echo Error compiling vertex shader - exit /b 1 -) - -echo Compiling flow fragment shader... -qsb --glsl "100 es,120,150" --hlsl 50 --msl 12 -o flow.frag.qsb flow.frag -if %ERRORLEVEL% NEQ 0 ( - echo Error compiling fragment shader - exit /b 1 -) - -echo Shader compilation complete! diff --git a/common/rhi/shaders/compile_shaders.sh b/common/rhi/shaders/compile_shaders.sh deleted file mode 100755 index f084121f..00000000 --- a/common/rhi/shaders/compile_shaders.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash -# Compile shaders to .qsb format for Qt RHI -# Requires qsb tool from Qt installation - -echo "Compiling flow vertex shader..." -qsb --glsl "100 es,120,150" --hlsl 50 --msl 12 -o flow.vert.qsb flow.vert -if [ $? -ne 0 ]; then - echo "Error compiling vertex shader" - exit 1 -fi - -echo "Compiling flow fragment shader..." -qsb --glsl "100 es,120,150" --hlsl 50 --msl 12 -o flow.frag.qsb flow.frag -if [ $? -ne 0 ]; then - echo "Error compiling fragment shader" - exit 1 -fi - -echo "Shader compilation complete!" diff --git a/common/rhi/shaders/flow.frag.qsb b/common/rhi/shaders/flow.frag.qsb deleted file mode 100644 index e223ca0b..00000000 Binary files a/common/rhi/shaders/flow.frag.qsb and /dev/null differ diff --git a/common/rhi/shaders/flow.vert.qsb b/common/rhi/shaders/flow.vert.qsb deleted file mode 100644 index 5194219b..00000000 Binary files a/common/rhi/shaders/flow.vert.qsb and /dev/null differ diff --git a/common/rhi/shaders/shaders.qrc b/common/rhi/shaders/shaders.qrc deleted file mode 100644 index 37a0d50b..00000000 --- a/common/rhi/shaders/shaders.qrc +++ /dev/null @@ -1,6 +0,0 @@ - - - flow.vert.qsb - flow.frag.qsb - - diff --git a/common/themes/themes_common.pri b/common/themes/themes_common.pri deleted file mode 100644 index f246882c..00000000 --- a/common/themes/themes_common.pri +++ /dev/null @@ -1,16 +0,0 @@ -INCLUDEPATH += $$PWD \ - $$PWD/shared - -HEADERS += \ - $$PWD/icon_utils.h \ - $$PWD/theme_id.h \ - $$PWD/theme_manager.h \ - $$PWD/themable.h \ - $$PWD/yacreader_icon.h \ - $$PWD/shared/help_about_dialog_theme.h \ - $$PWD/shared/whats_new_dialog_theme.h \ - - -SOURCES += \ - $$PWD/icon_utils.cpp \ - $$PWD/theme_manager.cpp diff --git a/compileOSX.sh b/compileOSX.sh index bd92627f..8a5d043d 100755 --- a/compileOSX.sh +++ b/compileOSX.sh @@ -21,37 +21,30 @@ if [ "$ARCH" == "x86_64" ]; then ARCHS="x86_64" ARCH_NAME="Intel" else - ARCHS="x86_64 arm64" + ARCHS="x86_64;arm64" ARCH_NAME="U" fi echo "Building for $ARCH_NAME" -hash qmake 2>/dev/null || { echo >&2 "Qmake command not available. Please add the bin subfolder of your Qt installation to the PATH environment variable."; exit 1; } +hash cmake 2>/dev/null || { echo >&2 "cmake command not available. Please add cmake to your PATH."; exit 1; } -echo "Compiling YACReader" -cd YACReader -qmake DEFINES+="BUILD_NUMBER=\\\\\\\"${BUILD_NUMBER}\\\\\\\"" QMAKE_APPLE_DEVICE_ARCHS="$ARCHS" -make -cd .. +echo "Configuring and building with CMake" +cmake -B build \ + -G Ninja \ + -DDECOMPRESSION_BACKEND=7zip \ + -DBUILD_NUMBER="${BUILD_NUMBER}" \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_OSX_ARCHITECTURES="${ARCHS}" \ + -DCMAKE_OSX_DEPLOYMENT_TARGET=11 -echo "Compiling YACReaderLibrary" -cd YACReaderLibrary -qmake DEFINES+="BUILD_NUMBER=\\\\\\\"${BUILD_NUMBER}\\\\\\\"" QMAKE_APPLE_DEVICE_ARCHS="$ARCHS" -make -cd .. - -echo "Compiling YACReaderLibraryServer" -cd YACReaderLibraryServer -qmake DEFINES+="BUILD_NUMBER=\\\\\\\"${BUILD_NUMBER}\\\\\\\"" QMAKE_APPLE_DEVICE_ARCHS="$ARCHS" -make -cd .. +cmake --build build --parallel echo "Configuring release apps" -cp -R YACReader/YACReader.app YACReader.app -cp -R YACReaderLibrary/YACReaderLibrary.app YACReaderLibrary.app -cp -R YACReaderLibraryServer/YACReaderLibraryServer.app YACReaderLibraryServer.app +cp -R build/bin/YACReader.app YACReader.app +cp -R build/bin/YACReaderLibrary.app YACReaderLibrary.app +cp -R build/bin/YACReaderLibraryServer.app YACReaderLibraryServer.app hash macdeployqt 2>/dev/null || { echo >&2 "macdeployqt command not available. Please add the bin subfolder of your Qt installation to the PATH environment variable."; exit 1; } @@ -71,14 +64,22 @@ cp -R dependencies/7zip/macx/${ARCH}/* YACReaderLibraryServer.app/Contents/MacOS cp -R release/server YACReaderLibrary.app/Contents/MacOS/ cp -R release/server YACReaderLibraryServer.app/Contents/MacOS/ -cp -R release/languages YACReader.app/Contents/MacOS/ -cp -R release/languages YACReaderLibrary.app/Contents/MacOS/ -cp -R release/languages YACReaderLibraryServer.app/Contents/MacOS/ + +# Collect cmake-generated .qm translation files from the build tree +# (release/languages is not tracked in git; cmake generates .qm in build subdirs) +mkdir -p YACReader.app/Contents/MacOS/languages +mkdir -p YACReaderLibrary.app/Contents/MacOS/languages +mkdir -p YACReaderLibraryServer.app/Contents/MacOS/languages +find build -name "*.qm" -exec cp {} YACReader.app/Contents/MacOS/languages/ \; +find build -name "*.qm" -exec cp {} YACReaderLibrary.app/Contents/MacOS/languages/ \; +find build -name "*.qm" -exec cp {} YACReaderLibraryServer.app/Contents/MacOS/languages/ \; /usr/libexec/PlistBuddy -c "Add :CFBundleVersion string ${BUILD_NUMBER}" YACReader.app/Contents/Info.plist /usr/libexec/PlistBuddy -c "Add :CFBundleShortVersionString string ${VERSION}" YACReader.app/Contents/Info.plist /usr/libexec/PlistBuddy -c "Add :CFBundleVersion string ${BUILD_NUMBER}" YACReaderLibrary.app/Contents/Info.plist /usr/libexec/PlistBuddy -c "Add :CFBundleShortVersionString string ${VERSION}" YACReaderLibrary.app/Contents/Info.plist +/usr/libexec/PlistBuddy -c "Set :CFBundleVersion ${BUILD_NUMBER}" YACReaderLibraryServer.app/Contents/Info.plist +/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString ${VERSION}" YACReaderLibraryServer.app/Contents/Info.plist if [ "$SKIP_CODESIGN" = false ]; then ./signapps.sh diff --git a/compressed_archive/CMakeLists.txt b/compressed_archive/CMakeLists.txt new file mode 100644 index 00000000..215f45ab --- /dev/null +++ b/compressed_archive/CMakeLists.txt @@ -0,0 +1,158 @@ +# Comic archive decompression backend (cbx_backend) +# Switched on DECOMPRESSION_BACKEND: unarr | 7zip | libarchive + +add_library(cbx_backend STATIC) + +if(DECOMPRESSION_BACKEND STREQUAL "unarr") + message(STATUS "Decompression backend: unarr") + + target_sources(cbx_backend PRIVATE + unarr/compressed_archive.cpp + unarr/compressed_archive.h + unarr/extract_delegate.h + ) + target_include_directories(cbx_backend PUBLIC unarr) + target_compile_definitions(cbx_backend PUBLIC use_unarr) + + # Try CMake config first, then pkg-config, then system path + find_package(unarr QUIET) + if(unarr_FOUND) + message(STATUS " Found unarr via CMake config") + target_link_libraries(cbx_backend PRIVATE unarr::unarr) + else() + pkg_check_modules(UNARR QUIET IMPORTED_TARGET libunarr) + if(UNARR_FOUND) + message(STATUS " Found unarr via pkg-config") + target_link_libraries(cbx_backend PRIVATE PkgConfig::UNARR) + elseif(APPLE AND EXISTS "${CMAKE_SOURCE_DIR}/dependencies/unarr/macx/libunarr.a") + message(STATUS " Found prebuilt unarr in dependencies (macOS)") + target_include_directories(cbx_backend PRIVATE + "${CMAKE_SOURCE_DIR}/dependencies/unarr/macx") + target_link_directories(cbx_backend PRIVATE + "${CMAKE_SOURCE_DIR}/dependencies/unarr/macx") + target_link_libraries(cbx_backend PRIVATE unarr z bz2) + elseif(WIN32 AND EXISTS "${CMAKE_SOURCE_DIR}/dependencies/unarr/win/unarr.h") + message(STATUS " Found prebuilt unarr in dependencies (Windows)") + target_include_directories(cbx_backend PRIVATE + "${CMAKE_SOURCE_DIR}/dependencies/unarr/win") + if(CMAKE_SYSTEM_PROCESSOR STREQUAL "ARM64") + target_link_directories(cbx_backend PRIVATE + "${CMAKE_SOURCE_DIR}/dependencies/unarr/win/arm64") + else() + target_link_directories(cbx_backend PRIVATE + "${CMAKE_SOURCE_DIR}/dependencies/unarr/win/x64") + endif() + target_link_libraries(cbx_backend PRIVATE unarr) + target_compile_definitions(cbx_backend PRIVATE UNARR_IS_SHARED_LIBRARY) + elseif(EXISTS "/usr/include/unarr.h") + message(STATUS " Found system unarr at /usr/include") + target_link_libraries(cbx_backend PRIVATE unarr) + else() + message(FATAL_ERROR + "Could not find unarr. Install libunarr or use a different DECOMPRESSION_BACKEND.") + endif() + endif() + +elseif(DECOMPRESSION_BACKEND STREQUAL "7zip") + message(STATUS "Decompression backend: 7zip (in-tree)") + + # Auto-download 7zip source if not present + if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/lib7zip/CPP") + include(FetchContent) + FetchContent_Declare( + lib7zip + URL "https://github.com/YACReader/yacreader-7z-deps/raw/main/7z2301-src.7z" + SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/lib7zip" + DOWNLOAD_EXTRACT_TIMESTAMP ON + ) + message(STATUS " Downloading 7zip source from yacreader-7z-deps...") + FetchContent_MakeAvailable(lib7zip) + endif() + + target_sources(cbx_backend PRIVATE + compressed_archive.cpp + compressed_archive.h + extract_delegate.h + 7z_includes.h + open_callbacks.h + extract_callbacks.h + lib7zip/CPP/Windows/FileIO.cpp + lib7zip/CPP/Windows/PropVariant.cpp + lib7zip/CPP/Windows/PropVariantConv.cpp + lib7zip/CPP/Common/IntToString.cpp + lib7zip/CPP/Common/MyString.cpp + lib7zip/CPP/Common/MyVector.cpp + lib7zip/CPP/Common/Wildcard.cpp + lib7zip/CPP/7zip/Common/FileStreams.cpp + lib7zip/C/Alloc.c + lib7zip/CPP/7zip/Common/StreamObjects.cpp + ) + + if(UNIX) + target_sources(cbx_backend PRIVATE + lib7zip/CPP/Common/NewHandler.cpp + lib7zip/CPP/Windows/DLL.cpp + lib7zip/CPP/Windows/FileDir.cpp + lib7zip/CPP/Windows/FileFind.cpp + lib7zip/CPP/Windows/FileName.cpp + lib7zip/CPP/Windows/TimeUtils.cpp + lib7zip/CPP/Common/UTFConvert.cpp + lib7zip/CPP/Common/MyWindows.cpp + lib7zip/CPP/Common/StringConvert.cpp + ) + endif() + + target_include_directories(cbx_backend + PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} + PRIVATE lib7zip/CPP + ) + + if(APPLE) + target_compile_definitions(cbx_backend PRIVATE + _FILE_OFFSET_BITS=64 _LARGEFILE_SOURCE NDEBUG _REENTRANT + ENV_UNIX _7ZIP_LARGE_PAGES ENV_MACOSX _TCHAR_DEFINED + UNICODE _UNICODE UNIX_USE_WIN_FILE) + target_link_libraries(cbx_backend PRIVATE + "-framework IOKit" "-framework CoreFoundation") + elseif(UNIX) + target_compile_definitions(cbx_backend PRIVATE + _FILE_OFFSET_BITS=64 _LARGEFILE_SOURCE NDEBUG _REENTRANT + ENV_UNIX _7ZIP_LARGE_PAGES UNICODE _UNICODE UNIX_USE_WIN_FILE) + endif() + +elseif(DECOMPRESSION_BACKEND STREQUAL "libarchive") + message(STATUS "Decompression backend: libarchive") + + if(WIN32 OR APPLE) + message(FATAL_ERROR "libarchive backend is not supported on Windows or macOS") + endif() + + target_sources(cbx_backend PRIVATE + libarchive/compressed_archive.cpp + libarchive/compressed_archive.h + libarchive/extract_delegate.h + ) + target_include_directories(cbx_backend PUBLIC libarchive) + target_compile_definitions(cbx_backend PUBLIC use_libarchive) + + # Try pkg-config first, then system path + pkg_check_modules(LIBARCHIVE QUIET IMPORTED_TARGET libarchive) + if(LIBARCHIVE_FOUND) + message(STATUS " Found libarchive via pkg-config") + target_link_libraries(cbx_backend PRIVATE PkgConfig::LIBARCHIVE) + elseif(EXISTS "/usr/include/archive.h") + message(STATUS " Found system libarchive at /usr/include") + target_link_libraries(cbx_backend PRIVATE archive) + else() + message(FATAL_ERROR + "Could not find libarchive. Install it or use a different DECOMPRESSION_BACKEND.") + endif() + +else() + message(FATAL_ERROR + "Unknown DECOMPRESSION_BACKEND: '${DECOMPRESSION_BACKEND}'. " + "Use: unarr, 7zip, or libarchive") +endif() + +# Qt, yr_global, and QsLog are needed by all backends +target_link_libraries(cbx_backend PRIVATE Qt::Core yr_global QsLog) diff --git a/compressed_archive/libarchive/README.md b/compressed_archive/libarchive/README.md index 71c8d11a..759d8639 100644 --- a/compressed_archive/libarchive/README.md +++ b/compressed_archive/libarchive/README.md @@ -7,9 +7,9 @@ This backend is currently only supported on the Linux platform. ## Using -Enabling this backend is achieved by adding the `libarchive` qmake configuration value: +Enable this backend by setting the `DECOMPRESSION_BACKEND` CMake option: - qmake CONFIG+=libarchive + cmake -B build -DDECOMPRESSION_BACKEND=libarchive Upon success, the application can be built as normal. diff --git a/compressed_archive/libarchive/libarchive-wrapper.pri b/compressed_archive/libarchive/libarchive-wrapper.pri deleted file mode 100644 index c9bcd825..00000000 --- a/compressed_archive/libarchive/libarchive-wrapper.pri +++ /dev/null @@ -1,31 +0,0 @@ -INCLUDEPATH += $$PWD -DEPENDPATH += $$PWD - -HEADERS += $$PWD/extract_delegate.h \ - $$PWD/compressed_archive.h - -SOURCES += $$PWD/compressed_archive.cpp - -if(mingw|unix):!macx:!contains(QT_CONFIG, no-pkg-config):packagesExist(libarchive) { - message(Using system provided libarchive installation found by pkg-config.) - !system(pkg-config --atleast-version=3.6.0 libarchive) { - LIBARCHIVE_WARNING = "libarchive < 3.6.0 found. Older versions of libarchive DO NOT SUPPORT RARv4 files. This is probably not what you want" - warning($$LIBARCHIVE_WARNING) - message($$LIBARCHIVE_WARNING) - } - - CONFIG += link_pkgconfig - PKGCONFIG += libarchive - DEFINES += use_libarchive - } -else:unix:!macx:exists(/usr/include/archive.h) { - message(Using system provided libarchive installation.) - LIBS += -larchive - DEFINES += use_libarchive -} -else:if(win32|macx) { - error(Unsupported: the libarchive decompression backend is not currently supported on this system.) -} -else { - error(Missing dependency: libarchive decompression backend. Please install libarchive on your system) -} diff --git a/compressed_archive/unarr/unarr-wrapper.pri b/compressed_archive/unarr/unarr-wrapper.pri deleted file mode 100644 index 01152674..00000000 --- a/compressed_archive/unarr/unarr-wrapper.pri +++ /dev/null @@ -1,52 +0,0 @@ -INCLUDEPATH += $$PWD -DEPENDPATH += $$PWD - -HEADERS += $$PWD/extract_delegate.h \ - $$PWD/compressed_archive.h - -SOURCES += $$PWD/compressed_archive.cpp - -if(mingw|unix):!macx:!contains(QT_CONFIG, no-pkg-config):packagesExist(libunarr) { - message(Using system provided unarr installation found by pkg-config.) - CONFIG += link_pkgconfig - PKGCONFIG += libunarr - DEFINES += use_unarr - } -else:unix:!macx:exists(/usr/include/unarr.h) { - message(Using system provided unarr installation.) - LIBS += -lunarr - DEFINES += use_unarr -} - -else:macx:exists(../../dependencies/unarr/macx/libunarr.a) { - message(Found prebuilt unarr library in dependencies directory.) - INCLUDEPATH += $$PWD/../../dependencies/unarr/macx - LIBS += -L$$PWD/../../dependencies/unarr/macx -lunarr -lz -lbz2 - DEFINES += use_unarr - } - -else:win32:exists(../../dependencies/unarr/win/unarr.h) { - message(Found prebuilt unarr library in dependencies directory.) - INCLUDEPATH += $$PWD/../../dependencies/unarr/win - contains(QMAKE_TARGET.arch, x86_64): { - LIBS += -L$$PWD/../../dependencies/unarr/win/x64 -lunarr - } else { - LIBS += -L$$PWD/../../dependencies/unarr/win/x86 -lunarr - } - DEFINES += use_unarr UNARR_IS_SHARED_LIBRARY - } - -else:exists ($$PWD/unarr-master) { - message(Found unarr source-code) - message(Unarr will be build as a part of YACReader) - - # qmake based unarr build system - # this should only be used for testing or as a last resort - include(unarr.pro) - DEFINES += use_unarr - } - -else { - error(Missing dependency: unarr decrompression backend. Please install libunarr on your system\ - or provide a copy of the unarr source code in compressed_archive/unarr/unarr-master) - } diff --git a/compressed_archive/unarr/unarr.pro b/compressed_archive/unarr/unarr.pro deleted file mode 100644 index d23c3c19..00000000 --- a/compressed_archive/unarr/unarr.pro +++ /dev/null @@ -1,46 +0,0 @@ -INCLUDEPATH += $$PWD/unarr-master/ -DEPENDPATH += $$PWD/unarr-master/ - -unix:QMAKE_CFLAGS_RELEASE -= "-O2" -unix:QMAKE_CFLAGS_RELEASE += "-O3" -unix:QMAKE_CFLAGS_RELEASE += "-DNDEBUG" -unix:QMAKE_CFLAGS += "-D_FILE_OFFSET_BITS=64" - -win32:QMAKE_CFLAGS_RELEASE += "/DNDEBUG" - -HEADERS+=$$PWD/unarr-master/common/allocator.h\ - $$PWD/unarr-master/common/unarr-imp.h\ - $$PWD/unarr-master/lzmasdk/7zTypes.h\ - $$PWD/unarr-master/lzmasdk/CpuArch.h\ - $$PWD/unarr-master/lzmasdk/Ppmd7.h\ - $$PWD/unarr-master/lzmasdk/Ppmd.h\ - $$PWD/unarr-master/lzmasdk/LzmaDec.h\ - $$PWD/unarr-master/lzmasdk/Ppmd8.h\ - $$PWD/unarr-master/tar/tar.h\ - $$PWD/unarr-master/_7z/_7z.h\ - $$PWD/unarr-master/unarr.h - -SOURCES+=$$PWD/unarr-master/common/conv.c\ - $$PWD/unarr-master/common/custalloc.c\ - $$PWD/unarr-master/common/unarr.c\ - $$PWD/unarr-master/common/crc32.c\ - $$PWD/unarr-master/common/stream.c\ - $$PWD/unarr-master/lzmasdk/CpuArch.c\ - $$PWD/unarr-master/lzmasdk/Ppmd7.c\ - $$PWD/unarr-master/lzmasdk/Ppmd8.c\ - $$PWD/unarr-master/lzmasdk/LzmaDec.c\ - $$PWD/unarr-master/lzmasdk/Ppmd7Dec.c\ - $$PWD/unarr-master/lzmasdk/Ppmd8Dec.c\ - $$PWD/unarr-master/zip/inflate.c\ - $$PWD/unarr-master/zip/parse-zip.c\ - $$PWD/unarr-master/zip/uncompress-zip.c\ - $$PWD/unarr-master/zip/zip.c\ - $$PWD/unarr-master/rar/filter-rar.c\ - $$PWD/unarr-master/rar/parse-rar.c\ - $$PWD/unarr-master/rar/rarvm.c\ - $$PWD/unarr-master/rar/huffman-rar.c\ - $$PWD/unarr-master/rar/rar.c\ - $$PWD/unarr-master/rar/uncompress-rar.c\ - $$PWD/unarr-master/tar/parse-tar.c\ - $$PWD/unarr-master/tar/tar.c\ - $$PWD/unarr-master/_7z/_7z.c \ No newline at end of file diff --git a/compressed_archive/wrapper.pri b/compressed_archive/wrapper.pri deleted file mode 100644 index a8d77740..00000000 --- a/compressed_archive/wrapper.pri +++ /dev/null @@ -1,62 +0,0 @@ -INCLUDEPATH += $$PWD -DEPENDPATH += $$PWD - -exists (../compressed_archive/lib7zip) { - message(Using 7zip) -} else { - error(You\'ll need 7zip source code to compile YACReader. \ - Please check the compressed_archive folder for further instructions.) -} - -INCLUDEPATH += \ - $$PWD/lib7zip/CPP \ - -SOURCES += \ - $$PWD/compressed_archive.cpp \ - $$PWD/lib7zip/CPP/Windows/FileIO.cpp \ - $$PWD/lib7zip/CPP/Windows/PropVariant.cpp \ - $$PWD/lib7zip/CPP/Windows/PropVariantConv.cpp \ - $$PWD/lib7zip/CPP/Common/IntToString.cpp \ - $$PWD/lib7zip/CPP/Common/MyString.cpp \ - $$PWD/lib7zip/CPP/Common/MyVector.cpp \ - $$PWD/lib7zip/CPP/Common/Wildcard.cpp \ - $$PWD/lib7zip/CPP/7zip/Common/FileStreams.cpp \ - $$PWD/lib7zip/C/Alloc.c \ - $$PWD/lib7zip/CPP/7zip/Common/StreamObjects.cpp - -unix{ -SOURCES += \ - $$PWD/lib7zip/CPP/Common/NewHandler.cpp \ - $$PWD/lib7zip/CPP/Windows/DLL.cpp \ - $$PWD/lib7zip/CPP/Windows/FileDir.cpp \ - $$PWD/lib7zip/CPP/Windows/FileFind.cpp \ - $$PWD/lib7zip/CPP/Windows/FileName.cpp \ - $$PWD/lib7zip/CPP/Windows/TimeUtils.cpp \ - $$PWD/lib7zip/CPP/Common/UTFConvert.cpp \ - $$PWD/lib7zip/CPP/Common/MyWindows.cpp \ - $$PWD/lib7zip/CPP/Common/StringConvert.cpp \ -} - -HEADERS += \ - $$PWD/lib7zip/CPP/Common/Common.h \ - $$PWD/compressed_archive.h \ - $$PWD/extract_delegate.h \ - $$PWD/7z_includes.h \ - $$PWD/open_callbacks.h \ - $$PWD/extract_callbacks.h \ - -macx{ -LIBS += -framework IOKit -framework CoreFoundation - -DEFINES += _FILE_OFFSET_BITS=64 _LARGEFILE_SOURCE \ - NDEBUG _REENTRANT ENV_UNIX \ - _7ZIP_LARGE_PAGES ENV_MACOSX _TCHAR_DEFINED \ - UNICODE _UNICODE UNIX_USE_WIN_FILE -} - -unix:!macx{ -DEFINES += _FILE_OFFSET_BITS=64 _LARGEFILE_SOURCE \ - NDEBUG _REENTRANT ENV_UNIX \ - _7ZIP_LARGE_PAGES \ - UNICODE _UNICODE UNIX_USE_WIN_FILE -} diff --git a/config.pri b/config.pri deleted file mode 100644 index 083bef24..00000000 --- a/config.pri +++ /dev/null @@ -1,101 +0,0 @@ -# functions to automatically initialize some of YACReader's build options to -# default values if they're not set on build time -# for a more detailed description, see INSTALL.TXT - -CONFIG += c++20 - -win32 { - #enable c++20 explicitly in msvc - QMAKE_CXXFLAGS += /std:c++20 /Zc:__cplusplus /permissive- -} - -DEFINES += NOMINMAX - -if(unix|mingw):QMAKE_CXXFLAGS_RELEASE += -DNDEBUG -win32:msvc:QMAKE_CXXFLAGS_RELEASE += /DNDEBUG - -# check Qt version -defineTest(minQtVersion) { - maj = $$1 - min = $$2 - patch = $$3 - isEqual(QT_MAJOR_VERSION, $$maj) { - isEqual(QT_MINOR_VERSION, $$min) { - isEqual(QT_PATCH_VERSION, $$patch) { - return(true) - } - greaterThan(QT_PATCH_VERSION, $$patch) { - return(true) - } - } - greaterThan(QT_MINOR_VERSION, $$min) { - return(true) - } - } - greaterThan(QT_MAJOR_VERSION, $$maj) { - return(true) - } - return(false) -} - -!minQtVersion(6, 0, 0) { - error(YACReader requires Qt 6.0 or newer but $$[QT_VERSION] was detected) -} - -# reduce log pollution -CONFIG += silent - -# Disable coverflow for arm targets -isEmpty(QMAKE_TARGET.arch) { - QMAKE_TARGET.arch = $$QMAKE_HOST.arch -} - -# default value for comic archive decompression backend -unix:!macx:!CONFIG(unarr):!CONFIG(7zip):!CONFIG(libarchive) { - CONFIG += unarr -} - -win32:!CONFIG(unarr):!CONFIG(7zip):!CONFIG(libarchive) { - CONFIG += 7zip -} - -macx:!CONFIG(unarr):!CONFIG(7zip):!CONFIG(libarchive) { - CONFIG += 7zip -} - -# default values for pdf render backend -win32:!CONFIG(poppler):!CONFIG(pdfium):!CONFIG(no_pdf) { - CONFIG += pdfium -} - -unix:!macx:!CONFIG(poppler):!CONFIG(pdfium):!CONFIG(no_pdf) { - CONFIG += poppler -} - -macx:!CONFIG(pdfkit):!CONFIG(pdfium):!CONFIG(no_pdf) { - CONFIG += pdfkit -} - -!CONFIG(poppler) { - DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x050F00 -} else { - DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x050900 -} - -unix:!macx { -# set install prefix if it's empty -isEmpty(PREFIX) { - PREFIX = /usr -} -isEmpty(BINDIR) { - BINDIR = $$PREFIX/bin -} -isEmpty(LIBDIR) { - LIBDIR = $$PREFIX/lib -} -isEmpty(DATADIR) { - DATADIR = $$PREFIX/share -} -} - -DEFINES += QT_DEPRECATED_WARNINGS diff --git a/custom_widgets/CMakeLists.txt b/custom_widgets/CMakeLists.txt new file mode 100644 index 00000000..4e5b6f1d --- /dev/null +++ b/custom_widgets/CMakeLists.txt @@ -0,0 +1,106 @@ +# Custom widgets for YACReader +# Shared widgets + app-specific variants + +# Files shared between both YACReader and YACReaderLibrary +set(WIDGETS_COMMON_SOURCES + help_about_dialog.h + help_about_dialog.cpp + yacreader_field_edit.h + yacreader_field_edit.cpp + yacreader_field_plain_text_edit.h + yacreader_field_plain_text_edit.cpp + yacreader_options_dialog.h + yacreader_options_dialog.cpp + yacreader_spin_slider_widget.h + yacreader_spin_slider_widget.cpp + yacreader_tool_bar_stretch.h + yacreader_tool_bar_stretch.cpp + yacreader_busy_widget.h + yacreader_busy_widget.cpp + rounded_corners_dialog.h + rounded_corners_dialog.cpp + whats_new_dialog.h + whats_new_dialog.cpp + whats_new_controller.h + whats_new_controller.cpp + yacreader_3d_flow_config_widget.h + yacreader_3d_flow_config_widget.cpp +) + +# macOS toolbar (shared by both apps) +if(APPLE) + list(APPEND WIDGETS_COMMON_SOURCES + yacreader_macosx_toolbar.h + yacreader_macosx_toolbar.mm + ) +endif() + +# --- custom_widgets_reader (YACReader-specific) --- +add_library(custom_widgets_reader STATIC ${WIDGETS_COMMON_SOURCES}) +target_include_directories(custom_widgets_reader PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) +# App-specific theme.h needed because themable.h → theme_manager.h → theme.h +target_include_directories(custom_widgets_reader PRIVATE + ${CMAKE_SOURCE_DIR}/YACReader/themes +) +target_compile_definitions(custom_widgets_reader PRIVATE YACREADER) +target_link_libraries(custom_widgets_reader PUBLIC + Qt::Core + Qt::Widgets + Qt::Network + common_gui + rhi_flow_reader + QsLog +) +if(APPLE) + target_link_libraries(custom_widgets_reader PRIVATE + "-framework Foundation" + "-framework AppKit" + ) +endif() + +# --- custom_widgets_library (YACReaderLibrary-specific) --- +set(LIBRARY_EXTRA_WIDGETS + yacreader_search_line_edit.h + yacreader_search_line_edit.cpp + yacreader_titled_toolbar.h + yacreader_titled_toolbar.cpp + yacreader_table_view.h + yacreader_table_view.cpp + yacreader_sidebar.h + yacreader_sidebar.cpp + yacreader_library_list_widget.h + yacreader_library_list_widget.cpp + yacreader_library_item_widget.h + yacreader_library_item_widget.cpp + yacreader_treeview.h + yacreader_treeview.cpp + yacreader_cover_label.h + yacreader_cover_label.cpp +) + +add_library(custom_widgets_library STATIC + ${WIDGETS_COMMON_SOURCES} + ${LIBRARY_EXTRA_WIDGETS} +) +target_include_directories(custom_widgets_library PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) +# App-specific theme.h + YACReaderLibrary headers needed by macosx_toolbar +target_include_directories(custom_widgets_library PRIVATE + ${CMAKE_SOURCE_DIR}/YACReaderLibrary/themes + ${CMAKE_SOURCE_DIR}/YACReaderLibrary + ${CMAKE_SOURCE_DIR}/YACReaderLibrary/db +) +target_compile_definitions(custom_widgets_library PRIVATE YACREADER_LIBRARY) +target_link_libraries(custom_widgets_library PUBLIC + Qt::Core + Qt::Widgets + Qt::Network + common_gui + rhi_flow_library + QsLog +) +if(APPLE) + target_link_libraries(custom_widgets_library PRIVATE + "-framework Foundation" + "-framework AppKit" + ) +endif() diff --git a/custom_widgets/custom_widgets_yacreader.pri b/custom_widgets/custom_widgets_yacreader.pri deleted file mode 100644 index 92e474ae..00000000 --- a/custom_widgets/custom_widgets_yacreader.pri +++ /dev/null @@ -1,34 +0,0 @@ -INCLUDEPATH += $$PWD -DEPENDPATH += $$PWD - -HEADERS += \ - $$PWD/help_about_dialog.h \ - $$PWD/yacreader_field_edit.h \ - $$PWD/yacreader_field_plain_text_edit.h \ - $$PWD/yacreader_options_dialog.h \ - $$PWD/yacreader_spin_slider_widget.h \ - $$PWD/yacreader_tool_bar_stretch.h \ - $$PWD/yacreader_busy_widget.h \ - $$PWD/rounded_corners_dialog.h \ - $$PWD/whats_new_dialog.h \ - $$PWD/whats_new_controller.h \ - $$PWD/yacreader_3d_flow_config_widget.h -macx{ -HEADERS += $$PWD/yacreader_macosx_toolbar.h -} - -SOURCES += \ - $$PWD/help_about_dialog.cpp \ - $$PWD/yacreader_field_edit.cpp \ - $$PWD/yacreader_field_plain_text_edit.cpp \ - $$PWD/yacreader_options_dialog.cpp \ - $$PWD/yacreader_spin_slider_widget.cpp \ - $$PWD/yacreader_tool_bar_stretch.cpp \ - $$PWD/yacreader_busy_widget.cpp \ - $$PWD/rounded_corners_dialog.cpp \ - $$PWD/whats_new_dialog.cpp \ - $$PWD/whats_new_controller.cpp \ - $$PWD/yacreader_3d_flow_config_widget.cpp -macx{ -OBJECTIVE_SOURCES += $$PWD/yacreader_macosx_toolbar.mm -} diff --git a/custom_widgets/custom_widgets_yacreaderlibrary.pri b/custom_widgets/custom_widgets_yacreaderlibrary.pri deleted file mode 100644 index e9f61afd..00000000 --- a/custom_widgets/custom_widgets_yacreaderlibrary.pri +++ /dev/null @@ -1,50 +0,0 @@ -INCLUDEPATH += $$PWD -DEPENDPATH += $$PWD - -HEADERS += \ - $$PWD/help_about_dialog.h \ - $$PWD/rounded_corners_dialog.h \ - $$PWD/whats_new_dialog.h \ - $$PWD/whats_new_controller.h \ - $$PWD/yacreader_field_edit.h \ - $$PWD/yacreader_field_plain_text_edit.h \ - $$PWD/yacreader_options_dialog.h \ - $$PWD/yacreader_search_line_edit.h \ - $$PWD/yacreader_spin_slider_widget.h \ - $$PWD/yacreader_tool_bar_stretch.h \ - $$PWD/yacreader_titled_toolbar.h \ - $$PWD/yacreader_table_view.h \ - $$PWD/yacreader_sidebar.h \ - $$PWD/yacreader_library_list_widget.h \ - $$PWD/yacreader_library_item_widget.h \ - $$PWD/yacreader_treeview.h \ - $$PWD/yacreader_busy_widget.h \ - $$PWD/yacreader_cover_label.h \ - $$PWD/yacreader_3d_flow_config_widget.h -macx{ -HEADERS += $$PWD/yacreader_macosx_toolbar.h -} - -SOURCES += \ - $$PWD/help_about_dialog.cpp \ - $$PWD/rounded_corners_dialog.cpp \ - $$PWD/whats_new_dialog.cpp \ - $$PWD/whats_new_controller.cpp \ - $$PWD/yacreader_field_edit.cpp \ - $$PWD/yacreader_field_plain_text_edit.cpp \ - $$PWD/yacreader_options_dialog.cpp \ - $$PWD/yacreader_search_line_edit.cpp \ - $$PWD/yacreader_spin_slider_widget.cpp \ - $$PWD/yacreader_tool_bar_stretch.cpp \ - $$PWD/yacreader_titled_toolbar.cpp \ - $$PWD/yacreader_table_view.cpp \ - $$PWD/yacreader_sidebar.cpp \ - $$PWD/yacreader_library_list_widget.cpp \ - $$PWD/yacreader_library_item_widget.cpp \ - $$PWD/yacreader_treeview.cpp \ - $$PWD/yacreader_busy_widget.cpp \ - $$PWD/yacreader_cover_label.cpp \ - $$PWD/yacreader_3d_flow_config_widget.cpp -macx{ -OBJECTIVE_SOURCES += $$PWD/yacreader_macosx_toolbar.mm -} diff --git a/dependencies/pdf_backend.pri b/dependencies/pdf_backend.pri deleted file mode 100644 index 1402b9e2..00000000 --- a/dependencies/pdf_backend.pri +++ /dev/null @@ -1,75 +0,0 @@ -CONFIG(no_pdf) { - DEFINES += "NO_PDF" -} - -CONFIG(pdfium) { - message(Using pdfium.) - DEFINES += "USE_PDFIUM" - SOURCES += ../common/pdf_comic.cpp - msvc { - INCLUDEPATH += $$PWD/pdfium/win/public - contains(QMAKE_TARGET.arch, x86_64): { - LIBS += -L$$PWD/pdfium/win/x64 -lpdfium - } else:contains(QMAKE_TARGET.arch, arm64): { - LIBS += -L$$PWD/pdfium/win/arm64 -lpdfium - } else { - LIBS += -L$$PWD/pdfium/win/x86 -lpdfium - } - } - unix|mingw { - macx { - LIBS += -L$$PWD/pdfium/macx/bin -lpdfium - INCLUDEPATH += $$PWD/pdfium/macx/include - } - else:!contains(QT_CONFIG, no-pkg-config):packagesExist(libpdfium) { - message(Using system provided installation of libpdfium found by pkg-config.) - CONFIG += link_pkgconfig - PKGCONFIG += libpdfium - } else:exists(/usr/include/pdfium) { - message(Using libpdfium found at /usr/lib/pdfium) - INCLUDEPATH += /usr/include/pdfium - LIBS += -lpdfium - } else { - error(Could not find libpdfium.) - } - } -} - -CONFIG(pdfkit) { - !macx { - error (Pdfkit is macOS only) - } else { - DEFINES += "USE_PDFKIT" - OBJECTIVE_SOURCES += ../common/pdf_comic.mm - } -} - -CONFIG(poppler) { - msvc { - contains(QMAKE_TARGET.arch, x86_64): { - error ("We currently don't ship precompiled poppler libraries for 64 bit builds on Windows") - } - INCLUDEPATH += $$PWD/poppler/include/qt6 - LIBS += -L$$PWD/poppler/lib -lpoppler-qt6 - # Add extra paths for dll dependencies so the executables don't crash when launching - # from QtCreator - LIBS += -L$$PWD/poppler/bin - LIBS += -L$$PWD/poppler/dependencies/bin - } - if(unix|mingw):!macx { - !contains(QT_CONFIG, no-pkg-config):packagesExist(poppler-qt6) { - message("Using system provided installation of poppler-qt6 found by pkg-config.") - CONFIG += link_pkgconfig - PKGCONFIG += poppler-qt6 - } else:!macx:exists(/usr/include/poppler/qt6) { - message("Using system provided installation of poppler-qt6.") - INCLUDEPATH += /usr/include/poppler/qt6 - LIBS += -lpoppler-qt6 - } else { - error("Could not find poppler-qt6") - } - } - unix:macx { - error (Poppler backend is currently not supported on macOS) - } -} diff --git a/docker/Dockerfile b/docker/Dockerfile index 12c5ed4b..60bad055 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -14,14 +14,13 @@ RUN \ apt-get update && \ apt-get install -y --no-install-recommends \ build-essential \ + cmake \ desktop-file-utils \ gcc \ g++ \ git \ qt6-tools-dev \ qt6-base-dev-tools \ - qmake6 \ - qmake6-bin \ qt6-base-dev \ qt6-multimedia-dev \ qt6-tools-dev-tools \ @@ -60,24 +59,22 @@ RUN git clone https://github.com/YACReader/yacreader.git /src/git && \ cd /src/git && \ git checkout $YACR_VERSION -# get 7zip source -RUN cd /src/git/compressed_archive && \ - wget "https://github.com/YACReader/yacreader-7z-deps/blob/main/7z2301-src.7z?raw=true" -O /src/git/compressed_archive/7z2301-src.7z && \ - 7z x /src/git/compressed_archive/7z2301-src.7z -o/src/git/compressed_archive/lib7zip - -# build yacreaderlibraryserver -RUN cd /src/git/YACReaderLibraryServer && \ - qmake6 PREFIX=/app CONFIG+="7zip server_standalone" YACReaderLibraryServer.pro && \ - qmake6 -v && \ - make && \ - make install +# build yacreaderlibraryserver (7zip source is auto-downloaded by CMake FetchContent) +RUN cd /src/git && \ + cmake -B build \ + -DCMAKE_INSTALL_PREFIX=/app \ + -DDECOMPRESSION_BACKEND=7zip \ + -DBUILD_SERVER_STANDALONE=ON \ + -DCMAKE_BUILD_TYPE=Release && \ + cmake --build build --parallel && \ + cmake --install build # install 7z.so with RAR support RUN echo "Building and installing 7z.so with RAR support..." && \ cd "/src/git/compressed_archive/lib7zip/CPP/7zip/Bundles/Format7zF" && \ make -f makefile.gcc && \ mkdir -p /app/lib/7zip && \ - cp ./_o/7z.so /app/lib/7zip + cp ./_o/7z.so /app/lib/7zip # Stage 2: Runtime stage FROM ghcr.io/linuxserver/baseimage-ubuntu:noble @@ -95,7 +92,7 @@ RUN apt-get update && \ apt-get install -y --no-install-recommends \ libqt6core5compat6 \ libpoppler-qt6-3t64 \ - qt6-image-formats-plugins \ + qt6-image-formats-plugins \ libqt6network6t64 \ libqt6sql6-sqlite && \ apt-get clean && \ diff --git a/docker/Dockerfile.aarch64 b/docker/Dockerfile.aarch64 index bd4660c7..922c490e 100644 --- a/docker/Dockerfile.aarch64 +++ b/docker/Dockerfile.aarch64 @@ -14,15 +14,17 @@ RUN \ apt-get update && \ apt-get install -y --no-install-recommends \ build-essential \ + cmake \ desktop-file-utils \ + gcc \ g++ \ git \ qt6-tools-dev \ qt6-base-dev-tools \ - qmake6 \ qt6-base-dev \ qt6-multimedia-dev \ qt6-tools-dev-tools \ + libgl-dev \ qt6-l10n-tools \ qt6-declarative-dev \ libqt6svg6-dev \ @@ -54,16 +56,15 @@ RUN git clone https://github.com/YACReader/yacreader.git /src/git && \ cd /src/git && \ git checkout $YACR_VERSION -# get 7zip source -RUN cd /src/git/compressed_archive && \ - wget "https://github.com/YACReader/yacreader-7z-deps/blob/main/7z2301-src.7z?raw=true" -O /src/git/compressed_archive/7z2301-src.7z && \ - 7z x /src/git/compressed_archive/7z2301-src.7z -o/src/git/compressed_archive/lib7zip - -# build yacreaderlibraryserver -RUN cd /src/git/YACReaderLibraryServer && \ - qmake6 PREFIX=/app CONFIG+="7zip server_standalone" YACReaderLibraryServer.pro && \ - make && \ - make install +# build yacreaderlibraryserver (7zip source is auto-downloaded by CMake FetchContent) +RUN cd /src/git && \ + cmake -B build \ + -DCMAKE_INSTALL_PREFIX=/app \ + -DDECOMPRESSION_BACKEND=7zip \ + -DBUILD_SERVER_STANDALONE=ON \ + -DCMAKE_BUILD_TYPE=Release && \ + cmake --build build --parallel && \ + cmake --install build # install 7z.so with RAR support RUN echo "Building and installing 7z.so with RAR support..." && \ diff --git a/shortcuts_management/CMakeLists.txt b/shortcuts_management/CMakeLists.txt new file mode 100644 index 00000000..a658e412 --- /dev/null +++ b/shortcuts_management/CMakeLists.txt @@ -0,0 +1,34 @@ +# Shortcuts management for YACReader +# Two targets: reader-specific, library-specific (compiled with different defines) + +set(SHORTCUTS_SOURCES + edit_shortcuts_dialog.h + edit_shortcuts_dialog.cpp + actions_groups_model.h + actions_groups_model.cpp + actions_shortcuts_model.h + actions_shortcuts_model.cpp + edit_shortcut_item_delegate.h + edit_shortcut_item_delegate.cpp + shortcuts_manager.h + shortcuts_manager.cpp +) + +# --- shortcuts_reader (YACREADER define) --- +add_library(shortcuts_reader STATIC ${SHORTCUTS_SOURCES}) +target_include_directories(shortcuts_reader PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) +# App-specific theme.h needed because themable.h → theme_manager.h → theme.h +target_include_directories(shortcuts_reader PRIVATE + ${CMAKE_SOURCE_DIR}/YACReader/themes +) +target_compile_definitions(shortcuts_reader PRIVATE YACREADER) +target_link_libraries(shortcuts_reader PUBLIC Qt::Core Qt::Widgets yr_global common_gui) + +# --- shortcuts_library (YACREADER_LIBRARY define) --- +add_library(shortcuts_library STATIC ${SHORTCUTS_SOURCES}) +target_include_directories(shortcuts_library PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) +target_include_directories(shortcuts_library PRIVATE + ${CMAKE_SOURCE_DIR}/YACReaderLibrary/themes +) +target_compile_definitions(shortcuts_library PRIVATE YACREADER_LIBRARY) +target_link_libraries(shortcuts_library PUBLIC Qt::Core Qt::Widgets yr_global common_gui) diff --git a/shortcuts_management/shortcuts_management.pri b/shortcuts_management/shortcuts_management.pri deleted file mode 100644 index b70a60da..00000000 --- a/shortcuts_management/shortcuts_management.pri +++ /dev/null @@ -1,16 +0,0 @@ -INCLUDEPATH += $$PWD -DEPENDPATH += $$PWD - -HEADERS += \ - $$PWD/edit_shortcuts_dialog.h \ - $$PWD/actions_groups_model.h \ - $$PWD/actions_shortcuts_model.h \ - $$PWD/edit_shortcut_item_delegate.h \ - $$PWD/shortcuts_manager.h - -SOURCES += \ - $$PWD/edit_shortcuts_dialog.cpp \ - $$PWD/actions_groups_model.cpp \ - $$PWD/actions_shortcuts_model.cpp \ - $$PWD/edit_shortcut_item_delegate.cpp \ - $$PWD/shortcuts_manager.cpp diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt new file mode 100644 index 00000000..03bacbc1 --- /dev/null +++ b/tests/CMakeLists.txt @@ -0,0 +1,4 @@ +# YACReader tests + +add_subdirectory(concurrent_queue_test) +add_subdirectory(compressed_archive_test) diff --git a/tests/compressed_archive_test/CMakeLists.txt b/tests/compressed_archive_test/CMakeLists.txt new file mode 100644 index 00000000..7b3e40b0 --- /dev/null +++ b/tests/compressed_archive_test/CMakeLists.txt @@ -0,0 +1,13 @@ +# Compressed archive test + +qt_add_executable(compressed_archive_test + main.cpp +) +target_link_libraries(compressed_archive_test PRIVATE + Qt::Core + cbx_backend +) +if(WIN32) + target_link_libraries(compressed_archive_test PRIVATE oleaut32 ole32) +endif() +add_test(NAME compressed_archive_test COMMAND compressed_archive_test) diff --git a/tests/compressed_archive_test/compressed_archive_test.pro b/tests/compressed_archive_test/compressed_archive_test.pro deleted file mode 100644 index b4898014..00000000 --- a/tests/compressed_archive_test/compressed_archive_test.pro +++ /dev/null @@ -1,26 +0,0 @@ -TEMPLATE = app -CONFIG += console - -SOURCES += \ - main.cpp \ - -QT += core - -win32 { - LIBS += -loleaut32 -lole32 - msvc { - QMAKE_CXXFLAGS_RELEASE += /MP /Ob2 /Oi /Ot /GT - QMAKE_LFLAGS_RELEASE += /LTCG - } - CONFIG -= embed_manifest_exe -} - -CONFIG(7zip) { -include(../../compressed_archive/wrapper.pri) -} else:CONFIG(unarr) { -include(../../compressed_archive/unarr/unarr-wrapper.pri) -} else:CONFIG(libarchive) { -include(../../compressed_archive/libarchive/libarchive-wrapper.pri) -} else { -include(../../compressed_archive/wrapper.pri) -} diff --git a/tests/concurrent_queue_test/CMakeLists.txt b/tests/concurrent_queue_test/CMakeLists.txt new file mode 100644 index 00000000..b6c49093 --- /dev/null +++ b/tests/concurrent_queue_test/CMakeLists.txt @@ -0,0 +1,12 @@ +# Concurrent queue test + +qt_add_executable(concurrent_queue_test + concurrent_queue_test.cpp +) +target_link_libraries(concurrent_queue_test PRIVATE + Qt::Core + Qt::Test + concurrent_queue +) +add_test(NAME concurrent_queue_test + COMMAND concurrent_queue_test -maxwarnings 100000) diff --git a/tests/concurrent_queue_test/concurrent_queue_test.pro b/tests/concurrent_queue_test/concurrent_queue_test.pro deleted file mode 100644 index 71403911..00000000 --- a/tests/concurrent_queue_test/concurrent_queue_test.pro +++ /dev/null @@ -1,9 +0,0 @@ -include(../qt_test.pri) - -PATH_TO_common = ../../common - -INCLUDEPATH += $$PATH_TO_common -HEADERS += $${PATH_TO_common}/concurrent_queue.h -SOURCES += \ - $${PATH_TO_common}/concurrent_queue.cpp \ - concurrent_queue_test.cpp diff --git a/tests/qt_test.pri b/tests/qt_test.pri deleted file mode 100644 index 1005fa03..00000000 --- a/tests/qt_test.pri +++ /dev/null @@ -1,9 +0,0 @@ -QT += testlib -QT -= gui - -CONFIG += qt console warn_on testcase no_testcase_installs -CONFIG -= app_bundle - -TEMPLATE = app - -include(../config.pri) diff --git a/tests/tests.pro b/tests/tests.pro deleted file mode 100644 index 15317f23..00000000 --- a/tests/tests.pro +++ /dev/null @@ -1,2 +0,0 @@ -TEMPLATE = subdirs -SUBDIRS += concurrent_queue_test diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt new file mode 100644 index 00000000..d4804f55 --- /dev/null +++ b/third_party/CMakeLists.txt @@ -0,0 +1,80 @@ +# Third-party libraries for YACReader + +# --- QsLog (logging) --- +add_library(QsLog STATIC + QsLog/QsLogDest.cpp + QsLog/QsLog.cpp + QsLog/QsLogDestConsole.cpp + QsLog/QsLogDestFile.cpp + QsLog/QsLogDestFunctor.cpp + QsLog/QsLogMessage.cpp + QsLog/QsLogLevel.cpp + QsLog/QsLogDest.h + QsLog/QsLog.h + QsLog/QsLogDestConsole.h + QsLog/QsLogLevel.h + QsLog/QsLogDestFile.h + QsLog/QsLogDisableForThisFile.h + QsLog/QsLogDestFunctor.h + QsLog/QsLogMessage.h + QsLog/QsLogSharedLibrary.h +) +target_include_directories(QsLog PUBLIC QsLog) +target_compile_definitions(QsLog PUBLIC QS_LOG_SEPARATE_THREAD) +target_link_libraries(QsLog PUBLIC Qt::Core) + +# --- QrCode (QR code generation, no Qt dependency) --- +add_library(QrCode STATIC + QrCode/qrcodegen.cpp + QrCode/qrcodegen.hpp +) +target_include_directories(QrCode PUBLIC QrCode) + +# --- QtWebApp HTTP server --- +add_library(QtWebApp_httpserver STATIC + QtWebApp/httpserver/httpglobal.cpp + QtWebApp/httpserver/httplistener.cpp + QtWebApp/httpserver/httpconnectionhandler.cpp + QtWebApp/httpserver/httpconnectionhandlerpool.cpp + QtWebApp/httpserver/httprequest.cpp + QtWebApp/httpserver/httpresponse.cpp + QtWebApp/httpserver/httpcookie.cpp + QtWebApp/httpserver/httprequesthandler.cpp + QtWebApp/httpserver/httpsession.cpp + QtWebApp/httpserver/httpsessionstore.cpp + QtWebApp/httpserver/staticfilecontroller.cpp + QtWebApp/httpserver/httpglobal.h + QtWebApp/httpserver/httplistener.h + QtWebApp/httpserver/httpconnectionhandler.h + QtWebApp/httpserver/httpconnectionhandlerpool.h + QtWebApp/httpserver/httprequest.h + QtWebApp/httpserver/httpresponse.h + QtWebApp/httpserver/httpcookie.h + QtWebApp/httpserver/httprequesthandler.h + QtWebApp/httpserver/httpsession.h + QtWebApp/httpserver/httpsessionstore.h + QtWebApp/httpserver/staticfilecontroller.h +) +target_include_directories(QtWebApp_httpserver PUBLIC QtWebApp/httpserver) +target_link_libraries(QtWebApp_httpserver PUBLIC Qt::Network) + +# --- QtWebApp template engine --- +add_library(QtWebApp_templateengine STATIC + QtWebApp/templateengine/template.cpp + QtWebApp/templateengine/templateloader.cpp + QtWebApp/templateengine/templatecache.cpp + QtWebApp/templateengine/templateglobal.h + QtWebApp/templateengine/template.h + QtWebApp/templateengine/templateloader.h + QtWebApp/templateengine/templatecache.h +) +target_include_directories(QtWebApp_templateengine PUBLIC QtWebApp/templateengine) +target_link_libraries(QtWebApp_templateengine PUBLIC Qt::Core5Compat) + +# --- KDSignalThrottler (from KDToolBox) --- +add_library(KDSignalThrottler STATIC + KDToolBox/KDSignalThrottler.cpp + KDToolBox/KDSignalThrottler.h +) +target_include_directories(KDSignalThrottler PUBLIC KDToolBox) +target_link_libraries(KDSignalThrottler PUBLIC Qt::Core) diff --git a/third_party/KDToolBox/KDToolBox.pri b/third_party/KDToolBox/KDToolBox.pri deleted file mode 100644 index 1cfbb745..00000000 --- a/third_party/KDToolBox/KDToolBox.pri +++ /dev/null @@ -1,4 +0,0 @@ -INCLUDEPATH += $$PWD - -SOURCES += $$PWD/KDSignalThrottler.cpp -HEADERS += $$PWD/KDSignalThrottler.h diff --git a/third_party/QrCode/QrCode.pri b/third_party/QrCode/QrCode.pri deleted file mode 100644 index 09142611..00000000 --- a/third_party/QrCode/QrCode.pri +++ /dev/null @@ -1,4 +0,0 @@ -INCLUDEPATH += $$PWD - -SOURCES += $$PWD/qrcodegen.cpp -HEADERS += $$PWD/qrcodegen.hpp diff --git a/third_party/QsLog/QsLog.pri b/third_party/QsLog/QsLog.pri deleted file mode 100644 index 20363e1c..00000000 --- a/third_party/QsLog/QsLog.pri +++ /dev/null @@ -1,41 +0,0 @@ -INCLUDEPATH += $$PWD -#DEFINES += QS_LOG_LINE_NUMBERS # automatically writes the file and line for each log message -#DEFINES += QS_LOG_DISABLE # logging code is replaced with a no-op -DEFINES += QS_LOG_SEPARATE_THREAD # messages are queued and written from a separate thread -#DEFINES += QS_LOG_WIN_PRINTF_CONSOLE # Use fprintf instead of OutputDebugString on Windows -#DEFINES += QS_LOG_WINDOW # allows easily showing log messages in a UI - -contains(DEFINES, QS_LOG_WINDOW) { - message("Will include log window destination") - QT += gui - greaterThan(QT_MAJOR_VERSION, 4): QT += widgets - SOURCES += $$PWD/QsLogWindow.cpp \ - $$PWD/QsLogWindowModel.cpp - HEADERS += $$PWD/QsLogWindow.h \ - $$PWD/QsLogWindowModel.h - FORMS += $$PWD/QsLogWindow.ui - RESOURCES += $$PWD/QsLogWindow.qrc -} - -SOURCES += $$PWD/QsLogDest.cpp \ - $$PWD/QsLog.cpp \ - $$PWD/QsLogDestConsole.cpp \ - $$PWD/QsLogDestFile.cpp \ - $$PWD/QsLogDestFunctor.cpp \ - $$PWD/QsLogMessage.cpp \ - $$PWD/QsLogLevel.cpp - -HEADERS += $$PWD/QsLogDest.h \ - $$PWD/QsLog.h \ - $$PWD/QsLogDestConsole.h \ - $$PWD/QsLogLevel.h \ - $$PWD/QsLogDestFile.h \ - $$PWD/QsLogDisableForThisFile.h \ - $$PWD/QsLogDestFunctor.h \ - $$PWD/QsLogMessage.h \ - $$PWD/QsLogSharedLibrary.h - -OTHER_FILES += \ - $$PWD/QsLogChanges.txt \ - $$PWD/README.md \ - $$PWD/LICENSE.txt diff --git a/third_party/QsLog/QsLogSharedLibrary.pro b/third_party/QsLog/QsLogSharedLibrary.pro deleted file mode 100644 index 8d34111d..00000000 --- a/third_party/QsLog/QsLogSharedLibrary.pro +++ /dev/null @@ -1,46 +0,0 @@ -# This pro file will build QsLog as a shared library -TARGET = QsLog -VERSION = "2.1.0" -QT -= gui -CONFIG -= console -CONFIG -= app_bundle -CONFIG += shared -CONFIG += c++11 -TEMPLATE = lib - -QSLOG_DESTDIR=$$(QSLOG_DESTDIR) -!isEmpty(QSLOG_DESTDIR) { - message(Will use $${QSLOG_DESTDIR} as destdir.) - DESTDIR = $${QSLOG_DESTDIR}/bin - OBJECTS_DIR = $${QSLOG_DESTDIR} - MOC_DIR = $${QSLOG_DESTDIR} - UI_DIR = $${QSLOG_DESTDIR} - RCC_DIR = $${QSLOG_DESTDIR} -} - -win32 { - DEFINES += QSLOG_IS_SHARED_LIBRARY -} - -include(QsLog.pri) - -unix:!macx { - DISTRO = $$system(uname -a) - - # make install will install the shared object in the appropriate folders - headers.files = QsLog.h QsLogDest.h QsLogLevel.h - headers.path = /usr/include/$(QMAKE_TARGET) - - other_files.files = LICENSE.txt QsLogChanges.txt README.md - other_files.path = /usr/local/share/$(QMAKE_TARGET) - contains(DISTRO, .*ARCH): other_files.path = /usr/share/$(QMAKE_TARGET) - - contains(QT_ARCH, x86_64) { - target.path = /usr/lib64 - contains(DISTRO, .*ARCH): target.path = /usr/lib - } else { - target.path = /usr/lib - } - - INSTALLS += headers target other_files -} diff --git a/third_party/QsLog/unittest/unittest.pro b/third_party/QsLog/unittest/unittest.pro deleted file mode 100644 index b59b8a93..00000000 --- a/third_party/QsLog/unittest/unittest.pro +++ /dev/null @@ -1,29 +0,0 @@ -QT += core - -TARGET = QsLogUnitTest -CONFIG += console qtestlib c++11 -CONFIG -= app_bundle -TEMPLATE = app - -# optionally enable address sanitizer -linux-g++|macx { - QMAKE_CXXFLAGS += -fsanitize=address - QMAKE_LFLAGS += -fsanitize=address -} - -# test-case sources -SOURCES += TestLog.cpp - -HEADERS += TestLog.h - -# component sources -include(../QsLog.pri) - -SOURCES += \ - ./QtTestUtil/TestRegistry.cpp \ - ./QtTestUtil/SimpleChecker.cpp - -HEADERS += \ - ./QtTestUtil/TestRegistry.h \ - ./QtTestUtil/TestRegistration.h \ - ./QtTestUtil/QtTestUtil.h diff --git a/third_party/QtWebApp/httpserver/httpserver.pri b/third_party/QtWebApp/httpserver/httpserver.pri deleted file mode 100644 index 9bfabd24..00000000 --- a/third_party/QtWebApp/httpserver/httpserver.pri +++ /dev/null @@ -1,33 +0,0 @@ -INCLUDEPATH += $$PWD -DEPENDPATH += $$PWD - -QT += network - -# Enable very detailed debug messages when compiling the debug version -CONFIG(debug, debug|release) { - DEFINES += SUPERVERBOSE -} - -HEADERS += $$PWD/httpglobal.h \ - $$PWD/httplistener.h \ - $$PWD/httpconnectionhandler.h \ - $$PWD/httpconnectionhandlerpool.h \ - $$PWD/httprequest.h \ - $$PWD/httpresponse.h \ - $$PWD/httpcookie.h \ - $$PWD/httprequesthandler.h \ - $$PWD/httpsession.h \ - $$PWD/httpsessionstore.h \ - $$PWD/staticfilecontroller.h - -SOURCES += $$PWD/httpglobal.cpp \ - $$PWD/httplistener.cpp \ - $$PWD/httpconnectionhandler.cpp \ - $$PWD/httpconnectionhandlerpool.cpp \ - $$PWD/httprequest.cpp \ - $$PWD/httpresponse.cpp \ - $$PWD/httpcookie.cpp \ - $$PWD/httprequesthandler.cpp \ - $$PWD/httpsession.cpp \ - $$PWD/httpsessionstore.cpp \ - $$PWD/staticfilecontroller.cpp diff --git a/third_party/QtWebApp/templateengine/templateengine.pri b/third_party/QtWebApp/templateengine/templateengine.pri deleted file mode 100644 index faca956a..00000000 --- a/third_party/QtWebApp/templateengine/templateengine.pri +++ /dev/null @@ -1,15 +0,0 @@ -INCLUDEPATH += $$PWD -DEPENDPATH += $$PWD - -greaterThan(QT_VERSION,6) { - QT += core5compat -} - -HEADERS += $$PWD/templateglobal.h -HEADERS += $$PWD/template.h -HEADERS += $$PWD/templateloader.h -HEADERS += $$PWD/templatecache.h - -SOURCES += $$PWD/template.cpp -SOURCES += $$PWD/templateloader.cpp -SOURCES += $$PWD/templatecache.cpp