From b2976b34f4b467d8ef53e441c282a861c9cb9d7c Mon Sep 17 00:00:00 2001 From: Peter Petrik Date: Fri, 4 Aug 2023 15:33:46 +0200 Subject: [PATCH] try --- .github/workflows/android.yml | 37 +++++----------- .github/workflows/ios.yml | 29 ++++--------- .github/workflows/linux.yml | 29 +++---------- .github/workflows/mac.yml | 25 ++--------- .github/workflows/win.yml | 22 +--------- README.md | 2 +- .../ports/qt6/vcpkg-cmake-wrapper.cmake | 43 +++++++++++++++---- vcpkg-overlay/triplets/arm-android.cmake | 3 +- vcpkg-overlay/triplets/arm64-android.cmake | 4 +- vcpkg-overlay/triplets/arm64-ios.cmake | 3 +- vcpkg-overlay/triplets/x64-linux.cmake | 2 +- vcpkg-overlay/triplets/x64-osx.cmake | 2 +- vcpkg-overlay/triplets/x64-windows.cmake | 2 +- 13 files changed, 74 insertions(+), 129 deletions(-) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 263dbea0..d599d2cb 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -21,7 +21,7 @@ jobs: matrix: include: - TRIPLET: 'arm-android' - - TRIPLET: 'amd64-android' + - TRIPLET: 'arm64-android' runs-on: macos-12 env: @@ -36,7 +36,6 @@ jobs: QT_ARCH: "android" VCPKG_ROOT: "${{ github.workspace }}/vcpkg" VCPKG_BASELINE: "d765306b074717dea8dc1c4723e1b025acb61c2d" # use scripts/update_vcpkg_base.bash to change - CACHE_VERSION: 1 steps: - uses: actions/checkout@v3 @@ -61,7 +60,6 @@ jobs: with: ndk-version: ${{ env.NDK_VERSION_FULL }} add-to-path: true - local-cache: true - name: Set up JDK uses: actions/setup-java@v2 @@ -85,8 +83,6 @@ jobs: dir: ${{ github.workspace }} target: android arch: ${{ matrix.qt_arch }} - cache: true - cache-key-prefix: ${{ runner.os }}-QtCache-v3-${{ env.QT_VERSION }}-android - name: Install Qt (desktop) uses: jurplel/install-qt-action@v3 @@ -96,16 +92,7 @@ jobs: modules: 'qtsensors qtconnectivity qt5compat qtmultimedia qtpositioning qtshadertools' dir: ${{ github.workspace }} target: desktop - cache: true - cache-key-prefix: ${{ runner.os }}-QtCache-v3-${{ env.QT_VERSION }}-desktop - - - name: Restore vcpkg folder - id: cache-vcpkg-restore - if: ${{ github.ref != 'refs/heads/master' }} # do not use cache on master - uses: actions/cache/restore@v3 - with: - path: ${{ env.VCPKG_ROOT }} - key: VCPKG-${{ runner.os }}-${{ matrix.TRIPLET }}-v${{ env.CACHE_VERSION }}-ref-${{ github.ref }} + set-env: false - name: Get vcpkg if: steps.cache-vcpkg-restore.outputs.cache-hit != 'true' @@ -121,10 +108,16 @@ jobs: echo "install vcpkg" chmod +x ./bootstrap-vcpkg.sh ./bootstrap-vcpkg.sh - ./vcpkg --version - name: Build Deps run: | + echo ${{ github.workspace }}/Qt/${{ env.QT_VERSION }}/macos + echo "Qt6_HOST_Dir=${{ github.workspace }}/Qt/${{ env.QT_VERSION }}/macos" >> $GITHUB_ENV + echo "PATH=${{ env.VCPKG_ROOT }}:$PATH" >> $GITHUB_ENV + + ./vcpkg --version + ls -l ${Qt6_HOST_Dir}/../ + mkdir -p ${{ github.workspace }}/build cd ${{ github.workspace }}/build cmake -B ${{ github.workspace }}/build/${{ matrix.arch }} \ @@ -138,9 +131,7 @@ jobs: -D ANDROID_SDK_ROOT=${ANDROID_HOME} \ -D ANDROID_NDK_VERSION="${{ env.NDK_VERSION }}" \ -D ANDROID_BUILD_TOOLS_VERSION="${ANDROID_BUILD_TOOLS_VERSION}" \ - -D CMAKE_PREFIX_PATH=${Qt6_DIR} \ - -D QT_HOST_PATH=${{ github.workspace }}/Qt/${{ env.QT_VERSION }}/macos \ - -D QT_HOST_PATH_CMAKE_DIR:PATH=${{ github.workspace }}/Qt/${{ env.QT_VERSION }}/macos \ + -D CMAKE_PREFIX_PATH=${Qt6_DIR} -DCMAKE_MAKE_PROGRAM=ninja - name: Upload build logs on deps failure @@ -151,14 +142,6 @@ jobs: path: | ${{ env.VCPKG_ROOT }}/buildtrees/**/*.log - - name: Save vcpkg folder - uses: actions/cache/save@v3 - if: always() && ${{ github.ref != 'refs/heads/master' }} # do not use cache on master; save on error too - id: cache-vcpkg-save - with: - path: ${{ env.VCPKG_ROOT }} - key: ${{ steps.cache-vcpkg-restore.outputs.cache-primary-key }} - - name: Build Test App run: | cd ${{ github.workspace }}/build/${{ matrix.arch }} diff --git a/.github/workflows/ios.yml b/.github/workflows/ios.yml index ef7a32de..f20e9f5f 100644 --- a/.github/workflows/ios.yml +++ b/.github/workflows/ios.yml @@ -25,7 +25,6 @@ jobs: QT_ARCH: "ios" VCPKG_ROOT: "${{ github.workspace }}/vcpkg" VCPKG_BASELINE: "d765306b074717dea8dc1c4723e1b025acb61c2d" # use scripts/update_vcpkg_base.bash to change - CACHE_VERSION: 1 steps: - uses: actions/checkout@v3 @@ -55,8 +54,6 @@ jobs: dir: ${{ github.workspace }} target: ${{ env.QT_ARCH }} arch: ${{ matrix.qt_arch }} - cache: true - cache-key-prefix: ${{ runner.os }}-QtCache-v2-${{ env.QT_VERSION }}-ios - name: Install Qt (desktop) uses: jurplel/install-qt-action@v3 @@ -66,16 +63,7 @@ jobs: modules: 'qtsensors qtconnectivity qt5compat qtmultimedia qtpositioning qtshadertools' dir: ${{ github.workspace }} target: desktop - cache: true - cache-key-prefix: ${{ runner.os }}-QtCache-v2-${{ env.QT_VERSION }}-desktop - - - name: Restore vcpkg folder - id: cache-vcpkg-restore - if: ${{ github.ref != 'refs/heads/master' }} # do not use cache on master - uses: actions/cache/restore@v3 - with: - path: ${{ env.VCPKG_ROOT }} - key: VCPKG-${{ runner.os }}-${{ env.TRIPLET }}-v${{ env.CACHE_VERSION }}-ref-${{ github.ref }} + set-env: false - name: Get vcpkg if: steps.cache-vcpkg-restore.outputs.cache-hit != 'true' @@ -97,6 +85,13 @@ jobs: run: | mkdir -p ${{ github.workspace }}/build cd ${{ github.workspace }}/build + + echo "Qt6_HOST_Dir=${{ github.workspace }}/Qt/${{ env.QT_VERSION }}/macos" >> $GITHUB_ENV + echo "PATH=${{ env.VCPKG_ROOT }}:$PATH" >> $GITHUB_ENV + + ./vcpkg --version + ls -l ${Qt6_HOST_Dir}/../ + cmake -B ${{ github.workspace }}/build \ -S ${{ github.workspace }}/input-sdk \ -DCMAKE_TOOLCHAIN_FILE:PATH="${{ env.VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake" \ @@ -121,14 +116,6 @@ jobs: path: | ${{ env.VCPKG_ROOT }}/buildtrees/**/*.log - - name: Save vcpkg folder - uses: actions/cache/save@v3 - if: always() && ${{ github.ref != 'refs/heads/master' }} # do not use cache on master; save on error too - id: cache-vcpkg-save - with: - path: ${{ env.VCPKG_ROOT }} - key: ${{ steps.cache-vcpkg-restore.outputs.cache-primary-key }} - - name: Build Test App run: | cd ${{ github.workspace }}/build diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 90bca8d7..2d66541e 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -25,7 +25,6 @@ jobs: QT_ARCH: "desktop" VCPKG_ROOT: "${{ github.workspace }}/vcpkg" VCPKG_BASELINE: "d765306b074717dea8dc1c4723e1b025acb61c2d" # use scripts/update_vcpkg_base.bash to change - CACHE_VERSION: 1 steps: - uses: actions/checkout@v3 @@ -48,16 +47,6 @@ jobs: setup-python: 'false' modules: 'qtsensors qtconnectivity qt5compat qtmultimedia qtpositioning qtshadertools' dir: ${{ github.workspace }} - cache: true - cache-key-prefix: ${{ runner.os }}-QtCache-v2-${{ env.QT_VERSION }}-lnx - - - name: Restore vcpkg folder - id: cache-vcpkg-restore - if: ${{ github.ref != 'refs/heads/master' }} # do not use cache on master - uses: actions/cache/restore@v3 - with: - path: ${{ env.VCPKG_ROOT }} - key: VCPKG-${{ runner.os }}-${{ env.TRIPLET }}-v${{ env.CACHE_VERSION }}-ref-${{ github.ref }} - name: Get vcpkg if: steps.cache-vcpkg-restore.outputs.cache-hit != 'true' @@ -74,15 +63,15 @@ jobs: chmod +x ./bootstrap-vcpkg.sh ./bootstrap-vcpkg.sh ./vcpkg --version - - + - name: Build Deps run: | - echo "PATH=${{ env.VCPKG_ROOT }}:$PATH" >> $GITHUB_ENV - which vcpkg - mkdir -p ${{ github.workspace }}/build cd ${{ github.workspace }}/build + + echo "PATH=${{ env.VCPKG_ROOT }}:$PATH" >> $GITHUB_ENV + ./vcpkg --version + cmake -B ${{ github.workspace }}/build \ -S ${{ github.workspace }}/input-sdk \ -DCMAKE_TOOLCHAIN_FILE:PATH="${{ env.VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake" \ @@ -100,14 +89,6 @@ jobs: path: | ${{ env.VCPKG_ROOT }}/buildtrees/**/*.log - - name: Save vcpkg folder - uses: actions/cache/save@v3 - if: always() && ${{ github.ref != 'refs/heads/master' }} # do not use cache on master; save on error too - id: cache-vcpkg-save - with: - path: ${{ env.VCPKG_ROOT }} - key: ${{ steps.cache-vcpkg-restore.outputs.cache-primary-key }} - - name: Build Test App run: | cd ${{ github.workspace }}/build diff --git a/.github/workflows/mac.yml b/.github/workflows/mac.yml index 2e4f84b8..3ca01d1f 100644 --- a/.github/workflows/mac.yml +++ b/.github/workflows/mac.yml @@ -49,22 +49,12 @@ jobs: target: ${{ env.QT_ARCH }} dir: ${{ github.workspace }} modules: 'qtsensors qtconnectivity qt5compat qtmultimedia qtpositioning qtshadertools' - cache: true - cache-key-prefix: ${{ runner.os }}-QtCache-v1-${{ env.QT_VERSION }}-mac - name: Setup compiler uses: maxim-lobanov/setup-xcode@v1 with: xcode-version: ${{ env.XC_VERSION }} - - name: Restore vcpkg folder - id: cache-vcpkg-restore - if: ${{ github.ref != 'refs/heads/master' }} # do not use cache on master - uses: actions/cache/restore@v3 - with: - path: ${{ env.VCPKG_ROOT }} - key: VCPKG-${{ runner.os }}-${{ env.TRIPLET }}-v${{ env.CACHE_VERSION }}-ref-${{ github.ref }} - - name: Get vcpkg if: steps.cache-vcpkg-restore.outputs.cache-hit != 'true' shell: bash @@ -83,11 +73,12 @@ jobs: - name: Build Deps run: | - echo "PATH=${{ env.VCPKG_ROOT }}:$PATH" >> $GITHUB_ENV - which vcpkg - mkdir -p ${{ github.workspace }}/build cd ${{ github.workspace }}/build + + echo "PATH=${{ env.VCPKG_ROOT }}:$PATH" >> $GITHUB_ENV + ./vcpkg --version + cmake -B ${{ github.workspace }}/build \ -S ${{ github.workspace }}/input-sdk \ -DCMAKE_TOOLCHAIN_FILE:PATH="${{ env.VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake" \ @@ -106,14 +97,6 @@ jobs: path: | ${{ env.VCPKG_ROOT }}/buildtrees/**/*.log - - name: Save vcpkg folder - uses: actions/cache/save@v3 - if: always() && ${{ github.ref != 'refs/heads/master' }} # do not use cache on master; save on error too - id: cache-vcpkg-save - with: - path: ${{ env.VCPKG_ROOT }} - key: ${{ steps.cache-vcpkg-restore.outputs.cache-primary-key }} - - name: Build Test App run: | cd ${{ github.workspace }}/build diff --git a/.github/workflows/win.yml b/.github/workflows/win.yml index 233c5e74..6952de5a 100644 --- a/.github/workflows/win.yml +++ b/.github/workflows/win.yml @@ -28,8 +28,7 @@ jobs: QT_ARCH: "win64_msvc2019_64" VCPKG_BASELINE: "2f6176ce98fee807a207dc9e8fec213f111c291b" # use scripts/update_vcpkg_base.bash to change VCPKG_ROOT: "C:/vcpkg-root" # Looks like there is more space on C: than on D: drive (~14GB) - CACHE_VERSION: 1 - + steps: - uses: actions/checkout@v3 with: @@ -51,16 +50,6 @@ jobs: arch: ${{ env.QT_ARCH }} dir: ${{ github.workspace }} modules: 'qtsensors qtconnectivity qt5compat qtmultimedia qtpositioning qtshadertools' - cache: true - cache-key-prefix: ${{ runner.os }}-QtCache-v1-${{ env.QT_VERSION }}-win - - - name: Restore vcpkg folder - id: cache-vcpkg-restore - if: ${{ github.ref != 'refs/heads/master' }} # do not use cache on master - uses: actions/cache/restore@v3 - with: - path: ${ env.VCPKG_ROOT } - key: VCPKG-${{ runner.os }}-${{ env.TRIPLET }}-v${{ env.CACHE_VERSION }}-ref-${{ github.ref }} - name: Get vcpkg if: steps.cache-vcpkg-restore.outputs.cache-hit != 'true' @@ -95,6 +84,7 @@ jobs: if ($LastExitCode -ne 0) { exit $LastExitCode } } $env:PATH="$env:VCPKG_ROOT;$env:PATH" + cd $env:GITHUB_WORKSPACE mkdir ${{ github.workspace }}\build -ea 0 exec { @@ -116,14 +106,6 @@ jobs: path: | ${{ env.VCPKG_ROOT }}/buildtrees/**/*.log - - name: Save vcpkg folder - uses: actions/cache/save@v3 - if: always() && ${{ github.ref != 'refs/heads/master' }} # do not use cache on master; save on error too - id: cache-build-save - with: - path: ${{ env.VCPKG_ROOT }} - key: ${{ steps.cache-vcpkg-restore.outputs.cache-primary-key }} - - name: Build Test App shell: pwsh run: | diff --git a/README.md b/README.md index 764cc55b..8d8840e2 100644 --- a/README.md +++ b/README.md @@ -89,7 +89,7 @@ TODO ``` mkdir -p build/x64 cd build/x64 - export Qt6_DIR=/opt/Qt/6.5.2/macos;export PATH=$(brew --prefix flex):$(brew --prefix bison)/bin:$(brew --prefix gettext)/bin:$PATH + export Qt6_Dir=/opt/Qt/6.5.2/macos;export PATH=$(brew --prefix flex):$(brew --prefix bison)/bin:$(brew --prefix gettext)/bin:$PATH cmake -B . -S ../../input-sdk/ \ -DCMAKE_TOOLCHAIN_FILE=../vcpkg/scripts/buildsystems/vcpkg.cmake \ diff --git a/vcpkg-overlay/ports/qt6/vcpkg-cmake-wrapper.cmake b/vcpkg-overlay/ports/qt6/vcpkg-cmake-wrapper.cmake index 96f72e2a..33e91e86 100644 --- a/vcpkg-overlay/ports/qt6/vcpkg-cmake-wrapper.cmake +++ b/vcpkg-overlay/ports/qt6/vcpkg-cmake-wrapper.cmake @@ -8,11 +8,6 @@ set(QT_MODULES Qt6Concurrent Qt6Core Qt6Core5Compat - Qt6CoreTools # only on desktops - Qt6LinguistTools # only on desktops - Qt6WidgetsTools # only on desktops - Qt6GuiTools # only on desktops - Qt6Designer Qt6Gui Qt6Help Qt6HostInfo @@ -62,18 +57,50 @@ set(QT_MODULES Qt6Xml ) -set(Qt6_DIR $ENV{Qt6_DIR}/lib/cmake) +if(NOT VCPKG_TARGET_IS_IOS) + set(QT_MODULES ${QT_MODULES} Qt6Designer) +endif() + + +set(Qt6_DIR $ENV{Qt6_Dir}/lib/cmake) if(EXISTS ${Qt6_DIR}) MESSAGE("Using Qt6_DIR: ${Qt6_DIR}") else() - MESSAGE(FATAL_ERROR "Qt6 installation not found: ${Qt6_DIR}; Do you have Qt6_DIR environment variable set?") + MESSAGE(FATAL_ERROR "Qt6 installation not found: ${Qt6_DIR}; Do you have Qt6_Dir environment variable set?") endif() foreach(MOD ${QT_MODULES}) set(${MOD}_DIR ${Qt6_DIR}/${MOD}) if(NOT EXISTS ${Qt6_DIR}/${MOD}) - MESSAGE(FATAL_ERROR "Qt6 ${MOD} not found: ${Qt6_DIR}/${MOD}; Do you have Qt6_DIR environment variable set?") + MESSAGE(FATAL_ERROR "Qt6 ${MOD} not found: ${Qt6_DIR}/${MOD}") + endif() +endforeach() + +### HOST +# These modules are not in iOS/Android Qt, but they are needed for Qt +set(QT_HOST_MODULES + Qt6CoreTools + Qt6LinguistTools + Qt6WidgetsTools + Qt6GuiTools +) + +if(VCPKG_TARGET_IS_IOS OR VCPKG_TARGET_IS_ANDROID) + set(Qt6_HOST_DIR $ENV{Qt6_HOST_Dir}/lib/cmake) + if(EXISTS ${Qt6_HOST_DIR}) + MESSAGE("Using Qt6_HOST_DIR: ${Qt6_HOST_DIR}") + else() + MESSAGE(FATAL_ERROR "Qt6 HOST installation not found: ${Qt6_HOST_DIR}; Do you have Qt6_HOST_Dir environment variable set (on android/iOS)?") + endif() +else() + set(Qt6_HOST_DIR ${Qt6_DIR}) +endif() + +foreach(MOD ${QT_HOST_MODULES}) + set(${MOD}_DIR ${Qt6_HOST_DIR}/${MOD}) + if(NOT EXISTS ${Qt6_HOST_DIR}/${MOD}) + MESSAGE(FATAL_ERROR "Qt6 HOST ${MOD} not found: ${Qt6_HOST_DIR}/${MOD}") endif() endforeach() diff --git a/vcpkg-overlay/triplets/arm-android.cmake b/vcpkg-overlay/triplets/arm-android.cmake index 478bb8ea..5197175b 100644 --- a/vcpkg-overlay/triplets/arm-android.cmake +++ b/vcpkg-overlay/triplets/arm-android.cmake @@ -13,4 +13,5 @@ endif() set(VCPKG_CXX_FLAGS "-fstack-protector-strong -lunwind -Wl,--exclude-libs=libunwind.a") set(VCPKG_C_FLAGS "-fstack-protector-strong -lunwind -Wl,--exclude-libs=libunwind.a") -set(VCPKG_ENV_PASSTHROUGH Qt6_DIR) \ No newline at end of file +set(VCPKG_ENV_PASSTHROUGH Qt6_Dir) +set(VCPKG_ENV_PASSTHROUGH Qt6_HOST_Dir) \ No newline at end of file diff --git a/vcpkg-overlay/triplets/arm64-android.cmake b/vcpkg-overlay/triplets/arm64-android.cmake index 938a0730..7eadad03 100644 --- a/vcpkg-overlay/triplets/arm64-android.cmake +++ b/vcpkg-overlay/triplets/arm64-android.cmake @@ -13,5 +13,5 @@ if(DEFINED ENV{ANDROIDAPI}) set(VCPKG_CMAKE_SYSTEM_VERSION $ENV{ANDROIDAPI}) endif() - -set(VCPKG_ENV_PASSTHROUGH Qt6_DIR) \ No newline at end of file +set(VCPKG_ENV_PASSTHROUGH Qt6_Dir) +set(VCPKG_ENV_PASSTHROUGH Qt6_HOST_Dir) \ No newline at end of file diff --git a/vcpkg-overlay/triplets/arm64-ios.cmake b/vcpkg-overlay/triplets/arm64-ios.cmake index c974e671..93266150 100644 --- a/vcpkg-overlay/triplets/arm64-ios.cmake +++ b/vcpkg-overlay/triplets/arm64-ios.cmake @@ -12,4 +12,5 @@ set(VCPKG_BUILD_TYPE release) set(VCPKG_CXX_FLAGS "-fvisibility=hidden") set(VCPKG_C_FLAGS "-fvisibility=hidden") -set(VCPKG_ENV_PASSTHROUGH Qt6_DIR) \ No newline at end of file +set(VCPKG_ENV_PASSTHROUGH Qt6_Dir) +set(VCPKG_ENV_PASSTHROUGH Qt6_HOST_Dir) \ No newline at end of file diff --git a/vcpkg-overlay/triplets/x64-linux.cmake b/vcpkg-overlay/triplets/x64-linux.cmake index ed642a05..2d8c1d3c 100644 --- a/vcpkg-overlay/triplets/x64-linux.cmake +++ b/vcpkg-overlay/triplets/x64-linux.cmake @@ -5,4 +5,4 @@ set(VCPKG_LIBRARY_LINKAGE static) set(VCPKG_CMAKE_SYSTEM_NAME Linux) set(VCPKG_BUILD_TYPE release) -set(VCPKG_ENV_PASSTHROUGH Qt6_DIR) +set(VCPKG_ENV_PASSTHROUGH Qt6_Dir) \ No newline at end of file diff --git a/vcpkg-overlay/triplets/x64-osx.cmake b/vcpkg-overlay/triplets/x64-osx.cmake index fb21baa2..8d50b3ce 100644 --- a/vcpkg-overlay/triplets/x64-osx.cmake +++ b/vcpkg-overlay/triplets/x64-osx.cmake @@ -10,4 +10,4 @@ if(DEFINED ENV{DEPLOYMENT_TARGET}) set(VCPKG_OSX_DEPLOYMENT_TARGET $ENV{DEPLOYMENT_TARGET}) endif() -set(VCPKG_ENV_PASSTHROUGH Qt6_DIR) \ No newline at end of file +set(VCPKG_ENV_PASSTHROUGH Qt6_Dir) \ No newline at end of file diff --git a/vcpkg-overlay/triplets/x64-windows.cmake b/vcpkg-overlay/triplets/x64-windows.cmake index 1ebee625..05d9d4f4 100644 --- a/vcpkg-overlay/triplets/x64-windows.cmake +++ b/vcpkg-overlay/triplets/x64-windows.cmake @@ -3,4 +3,4 @@ set(VCPKG_CRT_LINKAGE dynamic) set(VCPKG_LIBRARY_LINKAGE dynamic) set(VCPKG_BUILD_TYPE release) -set(VCPKG_ENV_PASSTHROUGH Qt6_DIR) \ No newline at end of file +set(VCPKG_ENV_PASSTHROUGH Qt6_Dir) \ No newline at end of file