diff --git a/.craft.ini b/.craft.ini new file mode 100644 index 00000000..90cb2fb2 --- /dev/null +++ b/.craft.ini @@ -0,0 +1,62 @@ +[General] +Command = craft +Branch = master +ShallowClone = True + +# Variables defined here override the default value +# The variable names are casesensitive +[Variables] +#Values need to be overwritten to create a chache +UseCache = True +CreateCache = True + +[GeneralSettings] +Version/ConfigVersion = 6 + +Packager/Destination=${Variables:WORKSPACE}/binaries +Paths/Python = C:/Python36 +Paths/Python27 = C:/Python27 +Paths/DownloadDir = ${Variables:Root}/downloads +ShortPath/Enabled = False +Compile/BuildType = Release +ContinuousIntegration/Enabled = True +Packager/PackageDebugSymbols = False + +Packager/CacheDir = ${Variables:WORKSPACE}/cache +Packager/UseCache = ${Variables:UseCache} +Packager/CreateCache = ${Variables:CreateCache} + +[windows-msvc2019_64-cl] +General/ABI = windows-msvc2019_64-cl + +[windows-msvc2019_64-cl-debug] +General/ABI = windows-msvc2019_64-cl +Compile/BuildType = Debug + +[windows-msvc2019_32-cl] +General/ABI = windows-msvc2019_32-cl + +[macos-64-clang] +General/ABI = macos-64-clang +# Packager/PackageType = MacPkgPackager + +[macos-64-clang-debug] +General/ABI = macos-64-clang +Compile/BuildType = Debug + +[linux-64-gcc] +General/ABI = linux-64-gcc + +[linux-64-gcc-BlueprintSettings] +libs/dbus.ignored = False +libs/qt5/qtbase.withDBus = True +dev-utils/7zip.useCentosBasedBuild=True + +[linux-64-gcc-debug] +General/ABI = linux-64-gcc +Compile/BuildType = Debug + +[linux-64-gcc-debug-BlueprintSettings] +libs/dbus.ignored = False +libs/qt5/qtbase.withDBus = True +dev-utils/7zip.useCentosBasedBuild=True diff --git a/.craft.shelf b/.craft.shelf new file mode 100644 index 00000000..1b7ce862 --- /dev/null +++ b/.craft.shelf @@ -0,0 +1,3 @@ +[General] +version = 2 +blueprintrepositories = https://github.com/cavoke-project/craft-blueprints-cavoke.git|master|;https://invent.kde.org/packaging/craft-blueprints-kde.git|master| \ No newline at end of file diff --git a/.github/scripts/.craft.ps1 b/.github/scripts/.craft.ps1 new file mode 100644 index 00000000..8925247f --- /dev/null +++ b/.github/scripts/.craft.ps1 @@ -0,0 +1,13 @@ +if ($IsWindows) { + $python = (Get-Command py).Source +} else { + $python = (Get-Command python3).Source +} +$command = @("${env:HOME}/craft/CraftMaster/CraftMaster/CraftMaster.py", + "--config", "${env:GITHUB_WORKSPACE}/.craft.ini", + "--target", "${env:CRAFT_TARGET}", + "--variables", "WORKSPACE=${env:HOME}/craft") + $args + +Write-Host "Exec: ${python} ${command}" + +& $python @command \ No newline at end of file diff --git a/.github/workflows/app.yml b/.github/workflows/app.yml index d6343745..51f13b6b 100644 --- a/.github/workflows/app.yml +++ b/.github/workflows/app.yml @@ -1,186 +1,13 @@ -name: app +name: Cavoke on: push jobs: - clang-format: - name: ClangFormat 12 - runs-on: ubuntu-latest - container: ghcr.io/cavoke-project/cavoke-ci:codeql - timeout-minutes: 1 - steps: - - uses: actions/checkout@v2 - # do not check submodules - - run: clang-format-12 --version - - run: chmod +x .github/scripts/diff-clangformat-12.sh && find . \( -iname '*.cpp' -or -iname '*.c' -or -iname '*.h' \) -and -not -path './server/models/*' | xargs -n1 .github/scripts/diff-clangformat-12.sh - cppcheck: - name: Cppcheck - runs-on: ubuntu-latest - container: ghcr.io/cavoke-project/cavoke-ci:codeql - timeout-minutes: 1 - steps: - - uses: actions/checkout@v2 - # do not check submodules - - run: cppcheck --version - - run: cppcheck --language=c++ -DSOME_DEFINE_TO_FIX_CONFIG --enable=all --suppress=*:doctest.h --suppress=unusedFunction --error-exitcode=1 --inline-suppr $(find . -iname '*.cpp' -and -not -path './server/models/*') - client-notests-qt5-suse: - runs-on: ubuntu-latest - container: ghcr.io/cavoke-project/cavoke-ci:client-qt5-suse - steps: - - uses: actions/checkout@v2 - with: - submodules: recursive - - name: Cmake - run: mkdir build && cd build && cmake .. -DBUILD_ALL=OFF -DBUILD_CLIENT=ON -DQT_MAJOR_VERSION=5 - - name: Make - run: cd build && make cavoke_client - client-notests-qt6-suse: - runs-on: ubuntu-latest - container: ghcr.io/cavoke-project/cavoke-ci:client-qt6-suse - steps: - - uses: actions/checkout@v2 - with: - submodules: recursive - - name: Cmake - run: mkdir build && cd build && cmake .. -DBUILD_ALL=OFF -DBUILD_CLIENT=ON -DQT_MAJOR_VERSION=6 # QT_MAJOR_VERSION=6 by default, so not necessary - - name: Make - run: cd build && make cavoke_client - server-compiles-with-submodules: - runs-on: ubuntu-latest - steps: - - run: sudo apt-get install -y openssl libssl-dev libjsoncpp-dev uuid-dev zlib1g-dev libc-ares-dev postgresql-server-dev-all libboost-all-dev - - uses: actions/checkout@v2 - with: - submodules: recursive - - name: Cmake - run: mkdir build && cd build && cmake .. -DBUILD_ALL=OFF -DBUILD_SERVER=ON - - name: Make - run: cd build && make cavoke_server - server-healthcheck: - runs-on: ubuntu-latest - container: ghcr.io/cavoke-project/cavoke-ci:server - services: - postgres: - image: postgres:latest - env: - POSTGRES_DB: cavoke - POSTGRES_PASSWORD: postgres_password - POSTGRES_PORT: 5432 - POSTGRES_USER: postgres_user - ports: - - 5432:5432 - options: >- - --health-cmd pg_isready - --health-interval 10s - --health-timeout 5s - --health-retries 5 - steps: - - uses: actions/checkout@v2 - with: - submodules: recursive - - name: Install PostgreSQL client - run: | - apt-get update - apt-get install --yes postgresql-client - - name: Populate the database - run: psql -h postgres -d cavoke -U postgres_user -f server/db/schema.sql - env: - PGPASSWORD: postgres_password - - name: Cmake - run: mkdir build && cd build && cmake .. -DBUILD_ALL=OFF -DBUILD_SERVER=ON -DUSE_EXTERNAL_DROGON=ON -DUSE_EXTERNAL_NLOHMANN=ON -DUSE_EXTERNAL_JWT=ON - - name: Make - run: cd build && make cavoke_server - - name: Healthcheck - run: chmod +x .github/scripts/server-test-health.py && .github/scripts/server-test-health.py ./build/server/cavoke_server -c .github/files/ci_server_config.json - server-tests: - runs-on: ubuntu-latest - container: ghcr.io/cavoke-project/cavoke-ci:server - steps: - - uses: actions/checkout@v2 - with: - submodules: recursive - - name: Cmake - run: mkdir build && cd build && cmake .. -DBUILD_ALL=OFF -DBUILD_SERVER=ON -DUSE_EXTERNAL_DROGON=ON -DUSE_EXTERNAL_NLOHMANN=ON -DUSE_EXTERNAL_JWT=ON - - name: Make - run: cd build && make cavoke_server_test - - name: Run Tests - run: ./build/server/test/cavoke_server_test - games-notests: - runs-on: ubuntu-latest - container: ghcr.io/cavoke-project/cavoke-ci:server - steps: - - uses: actions/checkout@v2 - with: - submodules: recursive - - name: Cmake - run: mkdir build && cd build && cmake .. -DBUILD_ALL=OFF -DBUILD_GAMES=ON -DUSE_EXTERNAL_DROGON=ON -DUSE_EXTERNAL_NLOHMANN=ON -DUSE_EXTERNAL_JWT=ON - - name: Make - run: cd build && make all - server-docker-compose-check: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - with: - submodules: recursive - - name: Start up the server with Docker Compose - run: docker-compose up -d - - name: Healthcheck - run: test $(curl -s localhost:8080/health) = "OK" - - name: Check that some games are available - run: curl -s localhost:8080/games/list | jq -e 'length >= 1' - server-publish-image-develop: - runs-on: ubuntu-latest + tests: + uses: ./.github/workflows/tests.yml + bundle-client: + needs: [tests] + uses: ./.github/workflows/bundle-client-craft.yml + deploy-server-develop: if: github.ref == 'refs/heads/develop' -# environment: develop - needs: - - server-healthcheck - - server-docker-compose-check - steps: - - uses: actions/checkout@v2 - with: - submodules: recursive - - name: Login to GitHub Container Registry - uses: docker/login-action@v1 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Build and push - uses: docker/build-push-action@v2 - with: - file: server.Dockerfile - push: true - tags: ghcr.io/cavoke-project/cavoke-server:latest # TODO: different tag for different branches - server-deploy-cloud-run-develop: - runs-on: ubuntu-latest - if: github.ref == 'refs/heads/develop' - environment: - name: develop - url: https://develop.api.cavoke.wlko.me - concurrency: develop - needs: - - server-publish-image-develop - steps: - - uses: actions/checkout@v2 - with: - submodules: recursive - - name: Setup Cloud SDK - uses: google-github-actions/setup-gcloud@v0 - with: - project_id: ${{ env.PROJECT_ID }} - service_account_key: ${{ secrets.GCP_SA_KEY }} - export_default_credentials: true - - name: 'Deploy to Cloud Run' - run: | - gcloud components install beta && \ - gcloud beta run deploy cavoke-server-develop \ - --execution-environment gen2 \ - --source server/.gcp \ - --allow-unauthenticated \ - --service-account ${{ env.SERVICE_ACCOUNT }} \ - --region=${{ env.REGION }} \ - --update-env-vars BUCKET=${{ env.BUCKET_NAME }} -env: - PROJECT_ID: waleko-personal - SERVICE_ACCOUNT: fs-identity - BUCKET_NAME: cavoke-test-1 - REGION: europe-north1 + needs: [tests] + uses: ./.github/workflows/deploy-server-develop.yml \ No newline at end of file diff --git a/.github/workflows/bundle-client-craft.yml b/.github/workflows/bundle-client-craft.yml new file mode 100644 index 00000000..ce4dd53d --- /dev/null +++ b/.github/workflows/bundle-client-craft.yml @@ -0,0 +1,113 @@ +# Originally from: https://raw.githubusercontent.com/owncloud/client/9ef42e4faa56367d99e31b5cc3e5f91da9b865f7/.github/workflows/main.yml + +name: Bundle Client +on: workflow_call + +defaults: + run: + shell: pwsh + +jobs: + build: + strategy: + matrix: + include: + - name: Windows 64-bit cl + target: windows-msvc2019_64-cl + os: windows-latest + fetch-depth: 0 + container: + - name: macOS 64-bit clang + target: macos-64-clang + os: macos-latest + fetch-depth: 1 + container: + - name: CentOS 7 64-bit gcc + target: linux-64-gcc + os: ubuntu-latest + container: kdeorg/centos7-craft + fetch-depth: 1 + fail-fast: false + + name: ${{ matrix.name }} + + runs-on: ${{ matrix.os }} + + env: + CRAFT_TARGET: ${{ matrix.target }} + + container: ${{ matrix.container }} + + steps: + - name: Check out source code + uses: actions/checkout@v2 + with: + submodules: recursive + + - name: Restore cache + uses: actions/cache@v2 + with: + path: ~/craft/cache + key: ${{ runner.os }}-${{ matrix.target }}-v3 + + - name: Clone CraftMaster + run: git clone --depth=1 https://invent.kde.org/kde/craftmaster.git "$env:HOME/craft/CraftMaster/CraftMaster" + + - name: Craft setup + run: | + New-Item -Path ~/cache -ItemType Directory -ErrorAction SilentlyContinue + & "${env:GITHUB_WORKSPACE}/.github/scripts/.craft.ps1" --setup + - name: Craft unshelve + run: | + & "${env:GITHUB_WORKSPACE}/.github/scripts/.craft.ps1" -c --unshelve "${env:GITHUB_WORKSPACE}/.craft.shelf" + - name: Prepare + run: | + if ($IsWindows) { + & "${env:GITHUB_WORKSPACE}/.github/scripts/.craft.ps1" -c dev-utils/nsis + } elseif($IsLinux) { + & "${env:GITHUB_WORKSPACE}/.github/scripts/.craft.ps1" -c dev-utils/linuxdeploy + & "${env:GITHUB_WORKSPACE}/.github/scripts/.craft.ps1" -c --set enableLibcloudproviders=true cavoke + } + - name: Install dependencies + run: | + & "${env:GITHUB_WORKSPACE}/.github/scripts/.craft.ps1" -c --install-deps cavoke + - name: Build + run: | + & "${env:GITHUB_WORKSPACE}/.github/scripts/.craft.ps1" -c --no-cache --src-dir "${env:GITHUB_WORKSPACE}" cavoke + - name: Package + run: | + & "${env:GITHUB_WORKSPACE}/.github/scripts/.craft.ps1" -c --no-cache --src-dir "${env:GITHUB_WORKSPACE}" --package cavoke + - name: Prepare artifacts + run: | + New-Item -ItemType Directory "${env:GITHUB_WORKSPACE}/binaries/" -ErrorAction SilentlyContinue + Copy-Item "$env:HOME/craft/binaries/*" "${env:GITHUB_WORKSPACE}/binaries/" + & "${env:GITHUB_WORKSPACE}/.github/scripts/.craft.ps1" -c --shelve "${env:GITHUB_WORKSPACE}/.craft.shelf" + Copy-Item "${env:GITHUB_WORKSPACE}/.craft.shelf" "${env:GITHUB_WORKSPACE}/binaries/" + - name: Upload artifacts + uses: actions/upload-artifact@v2 + with: + name: ${{ matrix.name }} + path: ${{ github.workspace }}/binaries/* + create-release: + name: Create Release + needs: [ build ] + runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags/') + steps: + - name: Download all workflow run artifacts + uses: actions/download-artifact@v3 + - name: Rename files + run: | + find -name '*.exe' -exec mv '{}' './cavoke-${{ github.ref_name }}-windows.exe' ';' + find -name '*.dmg' -exec mv '{}' './cavoke-${{ github.ref_name }}-macos.dmg' ';' + find -name '*.AppImage' -exec mv '{}' './cavoke-${{ github.ref_name }}-linux.AppImage' ';' + - name: GitHub Release + uses: softprops/action-gh-release@v1 + with: + name: Release ${{ github.ref_name }} + draft: true + files: | + cavoke-*-windows.exe + cavoke-*-macos.dmg + cavoke-*-linux.AppImage + fail_on_unmatched_files: true diff --git a/.github/workflows/deploy-server-develop.yml b/.github/workflows/deploy-server-develop.yml new file mode 100644 index 00000000..18ee214b --- /dev/null +++ b/.github/workflows/deploy-server-develop.yml @@ -0,0 +1,53 @@ +name: Deploy server (development version) +on: workflow_call +jobs: + server-publish-image-develop: + runs-on: ubuntu-latest + # environment: develop + steps: + - uses: actions/checkout@v2 + with: + submodules: recursive + - name: Login to GitHub Container Registry + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build and push + uses: docker/build-push-action@v2 + with: + file: server.Dockerfile + push: true + tags: ghcr.io/cavoke-project/cavoke-server:latest # TODO: different tag for different branches + server-deploy-cloud-run-develop: + runs-on: ubuntu-latest + environment: + name: develop + url: https://develop.api.cavoke.wlko.me + concurrency: develop + steps: + - uses: actions/checkout@v2 + with: + submodules: recursive + - name: Setup Cloud SDK + uses: google-github-actions/setup-gcloud@v0 + with: + project_id: ${{ env.PROJECT_ID }} + service_account_key: ${{ secrets.GCP_SA_KEY }} + export_default_credentials: true + - name: 'Deploy to Cloud Run' + run: | + gcloud components install beta && \ + gcloud beta run deploy cavoke-server-develop \ + --execution-environment gen2 \ + --source server/.gcp \ + --allow-unauthenticated \ + --service-account ${{ env.SERVICE_ACCOUNT }} \ + --region=${{ env.REGION }} \ + --update-env-vars BUCKET=${{ env.BUCKET_NAME }} +env: + PROJECT_ID: waleko-personal + SERVICE_ACCOUNT: fs-identity + BUCKET_NAME: cavoke-test-1 + REGION: europe-north1 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 00000000..0ef01b61 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,129 @@ +name: Run Tests +on: + workflow_call +jobs: + clang-format: + name: ClangFormat 12 + runs-on: ubuntu-latest + container: ghcr.io/cavoke-project/cavoke-ci:codeql + timeout-minutes: 1 + steps: + - uses: actions/checkout@v2 + # do not check submodules + - run: clang-format-12 --version + - run: chmod +x .github/scripts/diff-clangformat-12.sh && find . \( -iname '*.cpp' -or -iname '*.c' -or -iname '*.h' \) -and -not -path './server/models/*' | xargs -n1 .github/scripts/diff-clangformat-12.sh + cppcheck: + name: Cppcheck + runs-on: ubuntu-latest + container: ghcr.io/cavoke-project/cavoke-ci:codeql + timeout-minutes: 1 + steps: + - uses: actions/checkout@v2 + # do not check submodules + - run: cppcheck --version + - run: cppcheck --language=c++ -DSOME_DEFINE_TO_FIX_CONFIG --enable=all --suppress=*:doctest.h --suppress=unusedFunction --error-exitcode=1 --inline-suppr $(find . -iname '*.cpp' -and -not -path './server/models/*') + client-notests-qt5-suse: + runs-on: ubuntu-latest + container: ghcr.io/cavoke-project/cavoke-ci:client-qt5-suse + steps: + - uses: actions/checkout@v2 + with: + submodules: recursive + - name: Cmake + run: mkdir build && cd build && cmake .. -DBUILD_ALL=OFF -DBUILD_CLIENT=ON -DQT_MAJOR_VERSION=5 + - name: Make + run: cd build && make cavoke_client + client-notests-qt6-suse: + runs-on: ubuntu-latest + container: ghcr.io/cavoke-project/cavoke-ci:client-qt6-suse + steps: + - uses: actions/checkout@v2 + with: + submodules: recursive + - name: Cmake + run: mkdir build && cd build && cmake .. -DBUILD_ALL=OFF -DBUILD_CLIENT=ON -DQT_MAJOR_VERSION=6 # QT_MAJOR_VERSION=6 by default, so not necessary + - name: Make + run: cd build && make cavoke_client + server-compiles-with-submodules: + runs-on: ubuntu-latest + steps: + - run: sudo apt-get install -y openssl libssl-dev libjsoncpp-dev uuid-dev zlib1g-dev libc-ares-dev postgresql-server-dev-all libboost-all-dev + - uses: actions/checkout@v2 + with: + submodules: recursive + - name: Cmake + run: mkdir build && cd build && cmake .. -DBUILD_ALL=OFF -DBUILD_SERVER=ON + - name: Make + run: cd build && make cavoke_server + server-healthcheck: + runs-on: ubuntu-latest + container: ghcr.io/cavoke-project/cavoke-ci:server + services: + postgres: + image: postgres:latest + env: + POSTGRES_DB: cavoke + POSTGRES_PASSWORD: postgres_password + POSTGRES_PORT: 5432 + POSTGRES_USER: postgres_user + ports: + - 5432:5432 + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + steps: + - uses: actions/checkout@v2 + with: + submodules: recursive + - name: Install PostgreSQL client + run: | + apt-get update + apt-get install --yes postgresql-client + - name: Populate the database + run: psql -h postgres -d cavoke -U postgres_user -f server/db/schema.sql + env: + PGPASSWORD: postgres_password + - name: Cmake + run: mkdir build && cd build && cmake .. -DBUILD_ALL=OFF -DBUILD_SERVER=ON -DUSE_EXTERNAL_DROGON=ON -DUSE_EXTERNAL_NLOHMANN=ON -DUSE_EXTERNAL_JWT=ON + - name: Make + run: cd build && make cavoke_server + - name: Healthcheck + run: chmod +x .github/scripts/server-test-health.py && .github/scripts/server-test-health.py ./build/server/cavoke_server -c .github/files/ci_server_config.json + server-tests: + runs-on: ubuntu-latest + container: ghcr.io/cavoke-project/cavoke-ci:server + steps: + - uses: actions/checkout@v2 + with: + submodules: recursive + - name: Cmake + run: mkdir build && cd build && cmake .. -DBUILD_ALL=OFF -DBUILD_SERVER=ON -DUSE_EXTERNAL_DROGON=ON -DUSE_EXTERNAL_NLOHMANN=ON -DUSE_EXTERNAL_JWT=ON + - name: Make + run: cd build && make cavoke_server_test + - name: Run Tests + run: ./build/server/test/cavoke_server_test + games-notests: + runs-on: ubuntu-latest + container: ghcr.io/cavoke-project/cavoke-ci:server + steps: + - uses: actions/checkout@v2 + with: + submodules: recursive + - name: Cmake + run: mkdir build && cd build && cmake .. -DBUILD_ALL=OFF -DBUILD_GAMES=ON -DUSE_EXTERNAL_DROGON=ON -DUSE_EXTERNAL_NLOHMANN=ON -DUSE_EXTERNAL_JWT=ON + - name: Make + run: cd build && make all + server-docker-compose-check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + submodules: recursive + - name: Start up the server with Docker Compose + run: docker-compose up -d + - name: Healthcheck + run: test $(curl -s localhost:8080/health) = "OK" + - name: Check that some games are available + run: curl -s localhost:8080/games/list | jq -e 'length >= 1' diff --git a/.gitmodules b/.gitmodules index 59453f44..203384c8 100644 --- a/.gitmodules +++ b/.gitmodules @@ -9,4 +9,13 @@ url = https://github.com/frankosterfeld/qtkeychain.git [submodule "third_party/jwt"] path = third_party/jwt - url = https://github.com/Thalhammer/jwt-cpp.git \ No newline at end of file + url = https://github.com/Thalhammer/jwt-cpp.git +[submodule "third_party/extra-cmake-modules"] + path = third_party/extra-cmake-modules + url = https://github.com/kde/extra-cmake-modules +[submodule "third_party/karchive"] + path = third_party/karchive + url = https://github.com/kde/karchive +[submodule "third_party/zlib"] + path = third_party/zlib + url = https://github.com/madler/zlib diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt index 22e6346c..0bec39f4 100644 --- a/client/CMakeLists.txt +++ b/client/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.10) +cmake_minimum_required(VERSION 3.16) project(cavoke_client) set(QT_MAJOR_VERSION 6 CACHE STRING "Qt Major Version (e.g. Qt5/Qt6)") @@ -6,10 +6,18 @@ set(QT_MAJOR_VERSION 6 CACHE STRING "Qt Major Version (e.g. Qt5/Qt6)") set(CMAKE_CXX_STANDARD 17) set(CMAKE_INCLUDE_CURRENT_DIR ON) -find_package(Qt${QT_MAJOR_VERSION}Widgets REQUIRED) -find_package(Qt${QT_MAJOR_VERSION}Quick REQUIRED) -find_package(Qt${QT_MAJOR_VERSION}Network REQUIRED) -find_package(Qt${QT_MAJOR_VERSION}NetworkAuth REQUIRED) +find_package(ECM 5.90.0 REQUIRED CONFIG) +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ) + +include(FeatureSummary) +include(ECMAddAppIcon) +include(ECMQtDeclareLoggingCategory) +include(ECMInstallIcons) +include(ECMSetupVersion) +include(KDEInstallDirs) +include(KDECMakeSettings) + +find_package(Qt${QT_MAJOR_VERSION} REQUIRED COMPONENTS Widgets Quick Network NetworkAuth) set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOUIC ON) @@ -49,6 +57,18 @@ target_link_libraries(cavoke_client PRIVATE Qt${QT_MAJOR_VERSION}::Network) target_link_libraries(cavoke_client PRIVATE Qt${QT_MAJOR_VERSION}::NetworkAuth) target_link_libraries(cavoke_client PRIVATE KF5::Archive) -# QtKeychain -#target_link_libraries(cavoke_client PRIVATE qt${QT_MAJOR_VERSION}keychain) -#target_compile_definitions(cavoke_client PRIVATE INCLUDE_OWN_QT_KEYCHAIN QTKEYCHAIN_NO_EXPORT) +install(TARGETS ${PROJECT_NAME} ${KDE_INSTALL_TARGETS_DEFAULT_ARGS}) +configure_file(${CMAKE_SOURCE_DIR}/client/cavoke.desktop + ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.desktop) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.desktop DESTINATION ${KDE_INSTALL_APPDIR} ) +file(GLOB_RECURSE ICON_FILES "${CMAKE_CURRENT_SOURCE_DIR}/resources/packaging/*-apps-cavoke.png") + +# Add icon files to the application's source files to have CMake bundle them in the executable. +ecm_add_app_icon(ICONS_SOURCES ICONS ${ICON_FILES}) +target_sources(${PROJECT_NAME} PRIVATE ${ICONS_SOURCES}) + +ecm_install_icons( + ICONS ${ICON_FILES} + DESTINATION ${KDE_INSTALL_ICONDIR} + THEME hicolor +) diff --git a/client/cavoke.desktop b/client/cavoke.desktop new file mode 100644 index 00000000..e0d87da6 --- /dev/null +++ b/client/cavoke.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Categories=Game; +Type=Application +Exec=cavoke_client +Name=Cavoke Client +Comment=An online board games platform +Icon=cavoke +GenericName=Online board games platform +Keywords=cavoke;games; +Terminal=false +StartupWMClass=cavoke_client diff --git a/client/resource.qrc b/client/resource.qrc deleted file mode 100644 index e12eccc8..00000000 --- a/client/resource.qrc +++ /dev/null @@ -1,11 +0,0 @@ - - - tictactoe-files/tic-tac-toe.qml - tictactoe-files/content/Button.qml - tictactoe-files/content/TicTac.qml - tictactoe-files/content/interactions.js - tictactoe-files/content/pics/board.png - tictactoe-files/content/pics/o.png - tictactoe-files/content/pics/x.png - - diff --git a/client/resources/packaging/128-apps-cavoke.png b/client/resources/packaging/128-apps-cavoke.png new file mode 100644 index 00000000..c1bf0ab0 Binary files /dev/null and b/client/resources/packaging/128-apps-cavoke.png differ diff --git a/client/resources/packaging/32-apps-cavoke.png b/client/resources/packaging/32-apps-cavoke.png new file mode 100644 index 00000000..625b0cf3 Binary files /dev/null and b/client/resources/packaging/32-apps-cavoke.png differ diff --git a/client/resources/packaging/64-apps-cavoke.png b/client/resources/packaging/64-apps-cavoke.png new file mode 100644 index 00000000..91dd65eb Binary files /dev/null and b/client/resources/packaging/64-apps-cavoke.png differ diff --git a/client/resources/packaging/cavoke.ico b/client/resources/packaging/cavoke.ico new file mode 100644 index 00000000..d55aab26 Binary files /dev/null and b/client/resources/packaging/cavoke.ico differ diff --git a/install-karchive.sh b/install-karchive.sh new file mode 100755 index 00000000..f9205924 --- /dev/null +++ b/install-karchive.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env sh +mkdir build-zlib +cmake -B build-zlib ./third_party/zlib +cmake --build build-zlib --target install +mkdir build-ECM +cmake -B build-ECM ./third_party/extra-cmake-modules +cmake --build build-ECM --target install +mkdir build-karchive +cmake -B build-karchive ./third_party/karchive +cmake --build build-karchive --target install \ No newline at end of file diff --git a/third_party/extra-cmake-modules b/third_party/extra-cmake-modules new file mode 160000 index 00000000..b6c8b20c --- /dev/null +++ b/third_party/extra-cmake-modules @@ -0,0 +1 @@ +Subproject commit b6c8b20c1047006f148a9376046e45e8f036b3bd diff --git a/third_party/karchive b/third_party/karchive new file mode 160000 index 00000000..f63a2ba2 --- /dev/null +++ b/third_party/karchive @@ -0,0 +1 @@ +Subproject commit f63a2ba291c9ec88ce84d0c5b890a51f9308b1f2 diff --git a/third_party/zlib b/third_party/zlib new file mode 160000 index 00000000..21767c65 --- /dev/null +++ b/third_party/zlib @@ -0,0 +1 @@ +Subproject commit 21767c654d31d2dccdde4330529775c6c5fd5389