Merge 7bd44c28c0f2a983a97f8cd0dc36f27950bc4ae9 into dd81a23dfca5b434b7199153ab08c06cf611b3c7

This commit is contained in:
Paulchen-Panther 2025-02-24 17:20:06 +00:00 committed by GitHub
commit ea187b48fa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 64 additions and 120 deletions

View File

@ -1,57 +0,0 @@
#!/bin/bash
# set environment variables if not exists
[ -z "${BUILD_TYPE}" ] && BUILD_TYPE="Debug"
[ -z "${TARGET_ARCH}" ] && TARGET_ARCH="linux/amd64"
[ -z "${PLATFORM}" ] && PLATFORM="x11"
# Determine cmake build type; tag builds are Release, else Debug (-dev appends to platform)
if [[ $GITHUB_REF == *"refs/tags"* ]]; then
BUILD_TYPE=Release
else
PLATFORM=${PLATFORM}-dev
fi
echo "Compile Hyperion on '${RUNNER_OS}' with build type '${BUILD_TYPE}' and platform '${PLATFORM}'"
# Build the package on MacOS, Windows or Linux
if [[ "$RUNNER_OS" == 'macOS' ]]; then
mkdir build || exit 1
cmake -B build -G Ninja -DPLATFORM=${PLATFORM} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DCMAKE_INSTALL_PREFIX:PATH=/usr/local || exit 2
cmake --build build --target package --parallel $(sysctl -n hw.ncpu) || exit 3
cd ${GITHUB_WORKSPACE} && source /${GITHUB_WORKSPACE}/test/testrunner.sh || exit 4
exit 0;
exit 1 || { echo "---> Hyperion compilation failed! Abort"; exit 5; }
elif [[ $RUNNER_OS == "Windows" ]]; then
echo "Number of Cores $NUMBER_OF_PROCESSORS"
mkdir build || exit 1
cd build
cmake -G "Visual Studio 17 2022" -A x64 -DPLATFORM=${PLATFORM} -DCMAKE_BUILD_TYPE="Release" ../ || exit 2
cmake --build . --target package --config "Release" -- -nologo -v:m -maxcpucount || exit 3
exit 0;
exit 1 || { echo "---> Hyperion compilation failed! Abort"; exit 5; }
elif [[ "$RUNNER_OS" == 'Linux' ]]; then
echo "Docker arguments used: DOCKER_IMAGE=${DOCKER_IMAGE}, DOCKER_TAG=${DOCKER_TAG}, TARGET_ARCH=${TARGET_ARCH}"
# verification bypass of external dependencies
# set GitHub Container Registry url
REGISTRY_URL="ghcr.io/hyperion-project/${DOCKER_IMAGE}"
# take ownership of deploy dir
mkdir ${GITHUB_WORKSPACE}/deploy
# run docker
docker run --rm --platform=${TARGET_ARCH} \
-v "${GITHUB_WORKSPACE}/deploy:/deploy" \
-v "${GITHUB_WORKSPACE}:/source:rw" \
$REGISTRY_URL:$DOCKER_TAG \
/bin/bash -c "mkdir -p /source/build && cd /source/build &&
cmake -G Ninja -DPLATFORM=${PLATFORM} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} .. || exit 2 &&
cmake --build . --target package -- -j $(nproc) || exit 3 || : &&
cp /source/build/bin/h* /deploy/ 2>/dev/null || : &&
cp /source/build/Hyperion-* /deploy/ 2>/dev/null || : &&
cd /source && source /source/test/testrunner.sh || exit 5 &&
exit 0;
exit 1 " || { echo "---> Hyperion compilation failed! Abort"; exit 5; }
# overwrite file owner to current user
sudo chown -fR $(stat -c "%U:%G" ${GITHUB_WORKSPACE}/deploy) ${GITHUB_WORKSPACE}/deploy
fi

View File

@ -25,9 +25,6 @@ on:
default: false
required: false
env:
ghcr: hyperion-project
jobs:
######################
@ -36,7 +33,7 @@ jobs:
Linux:
name: 🐧 ${{ matrix.os.description }}
runs-on: ubuntu-22.04
runs-on: ${{ matrix.os.architecture[0] == 'amd64' && 'ubuntu-24.04' || 'ubuntu-24.04-arm' }}
strategy:
fail-fast: false
matrix:
@ -49,6 +46,7 @@ jobs:
{ distribution: debian, codename: bullseye, description: Debian Bullseye (Raspberry Pi 2), architecture: [ armv7, linux/arm/v7 ], platform: rpi },
{ distribution: debian, codename: bullseye, description: Debian Bullseye (Raspberry Pi 3/4/5 & Zero 2), architecture: [ arm64, linux/arm64 ], platform: rpi }
]
target_lookup: [{ 'arm64': 'arm64', 'armv6': 'armv6l', 'armv7': 'armv7l' }]
isQt5:
- ${{ inputs.qt_version == '5' }}
exclude:
@ -63,24 +61,29 @@ jobs:
with:
submodules: recursive
- name: 🔧 Prepare
- name: 🔧 Append PR number to version (PR only)
if: ${{ inputs.event_name == 'pull_request' }}
shell: bash
run: |
echo '::group::Append PR number to version (PR only)'
if [[ "${{ inputs.event_name }}" = "pull_request" ]]; then
tr -d '\n' < .version > temp && mv temp .version
echo -n "+PR${{ inputs.pull_request_number }}" >> .version
fi
echo '::endgroup::'
run: tr -d '\n' < .version > temp && mv temp .version && echo -n "+PR${{ inputs.pull_request_number }}" >> .version
- name: 👷 Build
shell: bash
run: ./.github/scripts/build.sh
run: |
mkdir deploy
docker run --rm --platform=${{ matrix.os.architecture[1] }} ${{ env.ENTRYPOINT }} \
-v "${{ github.workspace }}/deploy:/deploy" \
-v "${{ github.workspace }}:/source:rw" \
-w "/source" \
ghcr.io/hyperion-project/${{ env.DOCKER_IMAGE }}:${{ env.DOCKER_TAG }} \
/bin/bash -c "cmake --preset linux-${{ env.BUILD_TYPE }} -DPLATFORM=${{ matrix.os.platform }} ${{ env.CPACK_SYSTEM_PROCESSOR }} &&
cmake --build --preset linux-${{ env.BUILD_TYPE }} --target package --parallel $(nproc) &&
cp /source/build/Hyperion-* /deploy/ 2>/dev/null"
env:
DOCKER_IMAGE: ${{ matrix.os.distribution }}
DOCKER_TAG: ${{ matrix.os.codename }}${{ inputs.qt_version == '6' && '-qt6' || '' }}
PLATFORM: ${{ matrix.os.platform }}
TARGET_ARCH: ${{ matrix.os.architecture[1] }}
BUILD_TYPE: ${{ inputs.event_name == 'pull_request' && 'debug' || 'release' }}
ENTRYPOINT: ${{ matrix.os.architecture[0] != 'amd64' && '--entrypoint /usr/bin/env' || '' }}
CPACK_SYSTEM_PROCESSOR: ${{ matrix.os.architecture[0] != 'amd64' && format('-DCPACK_SYSTEM_PROCESSOR={0}', matrix.target_lookup[format('{0}', matrix.os.architecture[0])]) || '' }}
- name: 📦 Upload
if: ${{ inputs.publish || inputs.event_name == 'pull_request' }}
@ -96,40 +99,38 @@ jobs:
######################
macOS:
name: 🍏 macOS x64
runs-on: macos-latest
name: 🍏 macOS ${{ matrix.architecture }}
runs-on: ${{ matrix.architecture == 'arm64' && 'macos-14' || 'macos-13' }}
strategy:
fail-fast: false
matrix:
architecture: [ arm64, x64 ]
steps:
- name: ⬇ Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: 🔧 Prepare
- name: 🔧 Append Pull Request number to version (PR only)
if: ${{ inputs.event_name == 'pull_request' }}
shell: bash
run: |
echo '::group::Append PR number to version (PR only)'
if [[ "${{ inputs.event_name }}" = "pull_request" ]]; then
tr -d '\n' < .version > temp && mv temp .version
echo -n "+PR${{ inputs.pull_request_number }}" >> .version
fi
echo '::endgroup::'
run: tr -d '\n' < .version > temp && mv temp .version && echo -n "+PR${{ inputs.pull_request_number }}" >> .version
echo '::group::Update/Install dependencies'
brew untap --force homebrew/core homebrew/cask
brew update || true
brew install qt@${{ inputs.qt_version }} vulkan-headers ninja libftdi || true
echo '::endgroup::'
- name: Temporarily downgrade CMake to 3.28.3 # Please remove if GitHub has updated Cmake (greater than 3.30.0)
uses: jwlawson/actions-setup-cmake@v2
- name: 📥 Install dependencies
uses: tecolicom/actions-use-homebrew-tools@v1
with:
cmake-version: '3.28.3'
tools: qt@${{ inputs.qt_version }} vulkan-headers ninja libftdi
key: ${{ runner.os }}-${{ matrix.architecture }}-homebrew-packages-${{ inputs.qt_version }}
- name: 👷 Build
shell: bash
run: ./.github/scripts/build.sh
run: |
cmake --preset macos-${{ env.BUILD_TYPE }}
cmake --build --preset macos-${{ env.BUILD_TYPE }} --parallel $(sysctl -n hw.ncpu)
cd build; cpack
env:
PLATFORM: osx
BUILD_TYPE: ${{ inputs.event_name == 'pull_request' && 'debug' || 'release' }}
- name: 📦 Upload
if: ${{ inputs.publish || inputs.event_name == 'pull_request' }}
@ -138,7 +139,7 @@ jobs:
name: ${{ inputs.event_name == 'pull_request' && env.NAME || format('artifact-{0}', env.NAME) }}
path: 'build/Hyperion-*'
env:
NAME: ${{ inputs.qt_version == '6' && 'macOS_x64_qt6' || 'macOS_x64' }}
NAME: ${{ inputs.qt_version == '6' && format('macOS_{0}_qt6', matrix.architecture) || format('macOS_{0}', matrix.architecture) }}
######################
###### Windows #######
@ -149,36 +150,36 @@ jobs:
runs-on: windows-2022
env:
VCINSTALLDIR: 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC'
LIBJPEG_TURBO_VERSION: 3.0.1
steps:
- name: ⬇ Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: 🔧 Prepare PR
- name: 🔧 Append Pull Request number to version (PR only)
if: ${{ inputs.event_name == 'pull_request' }}
shell: bash
run: |
echo '::group::Append PR number to version'
tr -d '\n' < .version > temp && mv temp .version
echo -n "+PR${{ inputs.pull_request_number }}" >> .version
echo '::endgroup::'
run: tr -d '\n' < .version > temp && mv temp .version && echo -n "+PR${{ inputs.pull_request_number }}" >> .version
- name: 💾 Cache/Restore
uses: actions/cache@v4
- name: 📥 Download and 💾 Cache DirectX SDK
uses: ethanjli/cached-download-action@v0.1.2
with:
path: C:\Users\runneradmin\AppData\Local\Temp\chocolatey
key: ${{ runner.os }}${{ '-chocolatey' }}
url: https://download.microsoft.com/download/A/E/7/AE743F1F-632B-4809-87A9-AA1BB3458E31/DXSDK_Jun10.exe
destination: .\installer\dxsdk-jun10.exe
cache-key: dxsdk-jun10
- name: 📥 Install DirectX SDK, OpenSSL, libjpeg-turbo
shell: powershell
- name: 📥 Download and 💾 Cache libjpeg-turbo
uses: ethanjli/cached-download-action@v0.1.2
with:
url: https://sourceforge.net/projects/libjpeg-turbo/files/${{ env.LIBJPEG_TURBO_VERSION }}/libjpeg-turbo-${{ env.LIBJPEG_TURBO_VERSION }}-vc64.exe
destination: .\installer\libjpeg-turbo.exe
cache-key: libjpeg-turbo
- name: 📥 Install DirectX SDK & libjpeg-turbo
run: |
choco install --no-progress directx-sdk -y
choco install --no-progress ${{env.OPENSSL}} -y
Invoke-WebRequest https://netcologne.dl.sourceforge.net/project/libjpeg-turbo/3.0.1/libjpeg-turbo-3.0.1-vc64.exe -OutFile libjpeg-turbo.exe -UserAgent NativeHost
.\libjpeg-turbo /S
env:
OPENSSL: ${{ inputs.qt_version == '6' && 'openssl' || 'openssl --version=1.1.1.2100' }}
cmd.exe /c start /wait .\installer\libjpeg-turbo.exe /S
cmd.exe /c start /wait .\installer\dxsdk-jun10.exe /U /F
- name: Install Vulkan SDK
if: ${{ inputs.qt_version == '6' }}
@ -201,16 +202,11 @@ jobs:
shell: cmd
run: call "${{env.VCINSTALLDIR}}\Auxiliary\Build\vcvars64.bat"
- name: Temporarily downgrade CMake to 3.28.3 # Please remove if GitHub has updated Cmake (greater than 3.30.0)
uses: jwlawson/actions-setup-cmake@v2
with:
cmake-version: '3.28.3'
- name: 👷 Build
shell: bash
run: ./.github/scripts/build.sh
env:
PLATFORM: windows
run: |
cmake --preset windows-release
cmake --build --preset windows-release --target package -- -nologo -v:m -maxcpucount
- name: 📦 Upload
if: ${{ inputs.publish || inputs.event_name == 'pull_request' }}

View File

@ -23,6 +23,11 @@ IF(DEB_BUILDER_FOUND)
SET ( CPACK_GENERATOR ${CPACK_GENERATOR} "DEB")
ENDIF()
# Parameter CPACK_SYSTEM_PROCESSOR overwrites CMAKE_SYSTEM_PROCESSOR
if(CPACK_SYSTEM_PROCESSOR)
set(CMAKE_SYSTEM_PROCESSOR ${CPACK_SYSTEM_PROCESSOR})
endif()
# Overwrite CMAKE_SYSTEM_NAME for mac (visual)
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
if(${CMAKE_HOST_APPLE})