diff --git a/.github/workflows/build-nightly.yaml b/.github/workflows/build-nightly.yaml index 0a5731a2953..43102a1e25b 100644 --- a/.github/workflows/build-nightly.yaml +++ b/.github/workflows/build-nightly.yaml @@ -1,10 +1,10 @@ name: Build Nightly package -on: - push: - tags: - - 'nightly_*' - +#on: + #push: + #tags: + #- 'nightly_*' +on: [pull_request] env: QT_VERSION: 5.12.12 @@ -23,6 +23,24 @@ jobs: runs-on: ${{ matrix.os }} container: ghcr.io/scp-fs2open/linux_build:sha-71099c9 steps: + - name: Install Qt Dependencies + run: | + sudo apt-get update + sudo apt-get install -y \ + libegl1-mesa \ + libgl1-mesa-glx \ + libglib2.0-0 \ + libfontconfig1 \ + libdbus-1-3 \ + libx11-xcb1 \ + libxcb-icccm4 \ + libxcb-image0 \ + libxcb-keysyms1 \ + libxcb-randr0 \ + libxcb-render-util0 \ + libxcb-xinerama0 \ + libxcb-xkb1 \ + libxkbcommon-x11-0 - uses: actions/checkout@v1 name: Checkout with: @@ -31,14 +49,16 @@ jobs: env: CONFIGURATION: ${{ matrix.configuration }} COMPILER: gcc-9 - ENABLE_QTFRED: OFF + ENABLE_QTFRED: ON + Qt5_DIR: /qt/${{ env.QT_VERSION }}/gcc_64/lib/cmake/Qt5 + QTHELP_DIR: /qt/${{ env.QT_VERSION }}/gcc_64/libexec/qhelpgenerator run: $GITHUB_WORKSPACE/ci/linux/configure_cmake.sh - name: Compile working-directory: ./build env: CONFIGURATION: ${{ matrix.configuration }} run: | - LD_LIBRARY_PATH=$Qt5_DIR/lib:$LD_LIBRARY_PATH ninja -k 20 all + LD_LIBRARY_PATH=$Qt5_DIR/lib:$LD_LIBRARY_PATH ninja -k 20 all - name: Run Tests working-directory: ./build env: @@ -48,7 +68,10 @@ jobs: - name: Generate AppImage working-directory: ./build env: + ARCH: ${{ matrix.arch }} + QMAKE: /qt/${{ env.QT_VERSION }}/gcc_64/bin/qmake CONFIGURATION: ${{ matrix.configuration }} + ENABLE_QTFRED: ON run: $GITHUB_WORKSPACE/ci/linux/generate_appimage.sh $GITHUB_WORKSPACE/build/install - name: Upload build result uses: actions/upload-artifact@v4 @@ -110,30 +133,30 @@ jobs: name: Checkout with: submodules: true - # - name: Cache Qt - # id: cache-qt-win - # uses: actions/cache@v1 - # with: - # path: ${{ github.workspace }}/../Qt - # key: ${{ runner.os }}-${{ matrix.arch }}-QtCache-${{ env.QT_VERSION }} - # - name: Install Qt (32 bit) - # uses: jurplel/install-qt-action@v2 - # if: ${{ matrix.arch == 'Win32' }} - # with: - # version: ${{ env.QT_VERSION }} - # dir: ${{ github.workspace }}/.. - # arch: win32_msvc2017 - # cached: ${{ steps.cache-qt-win.outputs.cache-hit }} - # aqtversion: ==0.8 - # - name: Install Qt (64 bit) - # uses: jurplel/install-qt-action@v2 - # if: ${{ matrix.arch == 'x64' }} - # with: - # version: ${{ env.QT_VERSION }} - # dir: ${{ github.workspace }}/.. - # arch: win64_msvc2017_64 - # cached: ${{ steps.cache-qt-win.outputs.cache-hit }} - # aqtversion: ==0.8 + - name: Cache Qt + id: cache-qt-win + uses: actions/cache@v4 + with: + path: ${{ github.workspace }}/../Qt + key: ${{ runner.os }}-${{ matrix.arch }}-QtCache-${{ env.QT_VERSION }} + - name: Install Qt (32 bit) + uses: jurplel/install-qt-action@v4 + if: ${{ matrix.arch == 'Win32' }} + with: + version: ${{ env.QT_VERSION }} + dir: ${{ github.workspace }}/.. + arch: win32_msvc2017 + cached: ${{ steps.cache-qt-win.outputs.cache-hit }} + #aqtversion: ==0.8 + - name: Install Qt (64 bit) + uses: jurplel/install-qt-action@v4 + if: ${{ matrix.arch == 'x64' }} + with: + version: ${{ env.QT_VERSION }} + dir: ${{ github.workspace }}/.. + arch: win64_msvc2017_64 + cached: ${{ steps.cache-qt-win.outputs.cache-hit }} + #aqtversion: ==0.8 - name: Prepare Vulkan SDK uses: humbletim/setup-vulkan-sdk@v1.2.1 with: @@ -153,13 +176,13 @@ jobs: if [ "$ARCHITECTURE" = "Win32" ]; then cmake -DCMAKE_INSTALL_PREFIX="$(pwd)/install" -DFSO_USE_SPEECH="ON" \ -DFSO_USE_VOICEREC="ON" -DFORCED_SIMD_INSTRUCTIONS="$SIMD" \ - -DFSO_BUILD_QTFRED=OFF -DFSO_BUILD_TESTS=ON \ + -DFSO_BUILD_QTFRED=ON -DFSO_BUILD_TESTS=ON \ -DFSO_INSTALL_DEBUG_FILES="ON" -DFSO_BUILD_WITH_VULKAN="OFF" -A "$ARCHITECTURE" \ -G "Visual Studio 17 2022" -T "v143" -DCMAKE_BUILD_TYPE=$CONFIGURATION .. else cmake -DCMAKE_INSTALL_PREFIX="$(pwd)/install" -DFSO_USE_SPEECH="ON" \ -DFSO_USE_VOICEREC="ON" -DFORCED_SIMD_INSTRUCTIONS="$SIMD" \ - -DFSO_BUILD_QTFRED=OFF -DFSO_BUILD_TESTS=ON \ + -DFSO_BUILD_QTFRED=ON -DFSO_BUILD_TESTS=ON \ -DFSO_INSTALL_DEBUG_FILES="ON" -A "$ARCHITECTURE" \ -G "Visual Studio 17 2022" -T "v143" -DCMAKE_BUILD_TYPE=$CONFIGURATION .. fi @@ -234,21 +257,24 @@ jobs: name: Mac runs-on: macos-latest steps: - # - name: Cache Qt - # id: cache-qt-mac - # uses: actions/cache@v1 - # with: - # path: ${{ github.workspace }}/../Qt - # key: ${{ runner.os }}-QtCache-${{ env.QT_VERSION }} - # - name: Install Qt - # uses: jurplel/install-qt-action@v2 - # with: - # version: ${{ env.QT_VERSION }} - # dir: ${{ github.workspace }}/.. - # cached: ${{ steps.cache-qt-mac.outputs.cache-hit }} - # setup-python: 'false' - # aqtversion: ==1.1.3 - # py7zrversion: '==0.19.*' + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.x' + - name: Cache Qt + id: cache-qt-mac + uses: actions/cache@v4 + with: + path: ${{ github.workspace }}/../Qt + key: ${{ runner.os }}-QtCache-${{ env.QT_VERSION }} + - name: Install Qt + uses: jurplel/install-qt-action@v4 + with: + version: ${{ env.QT_VERSION }} + dir: ${{ github.workspace }}/.. + setup-python: 'false' + #aqtversion: ==1.1.3 + py7zrversion: '==0.19.*' - uses: actions/checkout@v1 name: Checkout with: @@ -272,11 +298,11 @@ jobs: COMPILER: ${{ matrix.compiler }} ARCHITECTURE: ${{ matrix.arch }} JOB_CMAKE_OPTIONS: ${{ matrix.cmake_options }} - ENABLE_QTFRED: OFF + ENABLE_QTFRED: ON run: $GITHUB_WORKSPACE/ci/linux/configure_cmake.sh - name: Compile working-directory: ./build - run: LD_LIBRARY_PATH=$Qt5_DIR/lib:$LD_LIBRARY_PATH ninja all + run: LD_LIBRARY_PATH=$QT_ROOT_DIR/lib:$LD_LIBRARY_PATH ninja all - name: Run Tests working-directory: ./build env: diff --git a/.github/workflows/build-test.yaml b/.github/workflows/build-test.yaml index 99f7fc1144c..ed78bfb9e2e 100644 --- a/.github/workflows/build-test.yaml +++ b/.github/workflows/build-test.yaml @@ -31,7 +31,7 @@ jobs: env: CONFIGURATION: ${{ matrix.configuration }} COMPILER: gcc-9 - ENABLE_QTFRED: OFF + ENABLE_QTFRED: ON run: $GITHUB_WORKSPACE/ci/linux/configure_cmake.sh - name: Compile working-directory: ./build @@ -48,6 +48,7 @@ jobs: - name: Generate AppImage working-directory: ./build env: + QTDIR: Qt5_DIR CONFIGURATION: ${{ matrix.configuration }} run: $GITHUB_WORKSPACE/ci/linux/generate_appimage.sh $GITHUB_WORKSPACE/build/install - name: Upload build result @@ -108,30 +109,30 @@ jobs: [[ "${{ github.ref }}" =~ ^refs\/heads\/test\/(.*)$ ]] # Override the revision string so that the builds are named correctly echo "set(FSO_VERSION_REVISION_STR ${BASH_REMATCH[1]})" > "version_override.cmake" - # - name: Cache Qt - # id: cache-qt-win - # uses: actions/cache@v1 - # with: - # path: ${{ github.workspace }}/../Qt - # key: ${{ runner.os }}-${{ matrix.arch }}-QtCache-${{ env.QT_VERSION }} - # - name: Install Qt (32 bit) - # uses: jurplel/install-qt-action@v2 - # if: ${{ matrix.arch == 'Win32' }} - # with: - # version: ${{ env.QT_VERSION }} - # dir: ${{ github.workspace }}/.. - # arch: win32_msvc2017 - # cached: ${{ steps.cache-qt-win.outputs.cache-hit }} - # aqtversion: ==0.8 - # - name: Install Qt (64 bit) - # uses: jurplel/install-qt-action@v2 - # if: ${{ matrix.arch == 'x64' }} - # with: - # version: ${{ env.QT_VERSION }} - # dir: ${{ github.workspace }}/.. - # arch: win64_msvc2017_64 - # cached: ${{ steps.cache-qt-win.outputs.cache-hit }} - # aqtversion: ==0.8 + - name: Cache Qt + id: cache-qt-win + uses: actions/cache@v1 + with: + path: ${{ github.workspace }}/../Qt + key: ${{ runner.os }}-${{ matrix.arch }}-QtCache-${{ env.QT_VERSION }} + - name: Install Qt (32 bit) + uses: jurplel/install-qt-action@v2 + if: ${{ matrix.arch == 'Win32' }} + with: + version: ${{ env.QT_VERSION }} + dir: ${{ github.workspace }}/.. + arch: win32_msvc2017 + cached: ${{ steps.cache-qt-win.outputs.cache-hit }} + aqtversion: ==0.8 + - name: Install Qt (64 bit) + uses: jurplel/install-qt-action@v2 + if: ${{ matrix.arch == 'x64' }} + with: + version: ${{ env.QT_VERSION }} + dir: ${{ github.workspace }}/.. + arch: win64_msvc2017_64 + cached: ${{ steps.cache-qt-win.outputs.cache-hit }} + aqtversion: ==0.8 - name: Prepare Vulkan SDK uses: humbletim/setup-vulkan-sdk@v1.2.1 with: @@ -151,13 +152,13 @@ jobs: if [ "$ARCHITECTURE" = "Win32" ]; then cmake -DCMAKE_INSTALL_PREFIX="$(pwd)/install" -DFSO_USE_SPEECH="ON" \ -DFSO_USE_VOICEREC="ON" -DFORCED_SIMD_INSTRUCTIONS="$SIMD" \ - -DFSO_BUILD_QTFRED=OFF -DFSO_BUILD_TESTS=ON \ + -DFSO_BUILD_QTFRED=ON -DFSO_BUILD_TESTS=ON \ -DFSO_INSTALL_DEBUG_FILES="ON" -DFSO_BUILD_WITH_VULKAN="OFF" -A "$ARCHITECTURE" \ -G "Visual Studio 17 2022" -T "v143" -DCMAKE_BUILD_TYPE=$CONFIGURATION .. else cmake -DCMAKE_INSTALL_PREFIX="$(pwd)/install" -DFSO_USE_SPEECH="ON" \ -DFSO_USE_VOICEREC="ON" -DFORCED_SIMD_INSTRUCTIONS="$SIMD" \ - -DFSO_BUILD_QTFRED=OFF -DFSO_BUILD_TESTS=ON \ + -DFSO_BUILD_QTFRED=ON -DFSO_BUILD_TESTS=ON \ -DFSO_INSTALL_DEBUG_FILES="ON" -A "$ARCHITECTURE" \ -G "Visual Studio 17 2022" -T "v143" -DCMAKE_BUILD_TYPE=$CONFIGURATION .. fi @@ -233,21 +234,21 @@ jobs: name: Mac runs-on: macos-latest steps: - # - name: Cache Qt - # id: cache-qt-mac - # uses: actions/cache@v1 - # with: - # path: ${{ github.workspace }}/../Qt - # key: ${{ runner.os }}-QtCache-${{ env.QT_VERSION }} - # - name: Install Qt - # uses: jurplel/install-qt-action@v2 - # with: - # version: ${{ env.QT_VERSION }} - # dir: ${{ github.workspace }}/.. - # cached: ${{ steps.cache-qt-mac.outputs.cache-hit }} - # setup-python: 'false' - # aqtversion: ==1.1.3 - # py7zrversion: '==0.19.*' + - name: Cache Qt + id: cache-qt-mac + uses: actions/cache@v1 + with: + path: ${{ github.workspace }}/../Qt + key: ${{ runner.os }}-QtCache-${{ env.QT_VERSION }} + - name: Install Qt + uses: jurplel/install-qt-action@v2 + with: + version: ${{ env.QT_VERSION }} + dir: ${{ github.workspace }}/.. + cached: ${{ steps.cache-qt-mac.outputs.cache-hit }} + setup-python: 'false' + aqtversion: ==1.1.3 + py7zrversion: '==0.19.*' - uses: actions/checkout@v1 name: Checkout with: @@ -270,7 +271,7 @@ jobs: CONFIGURATION: ${{ matrix.configuration }} COMPILER: ${{ matrix.compiler }} ARCHITECTURE: ${{ matrix.arch }} - ENABLE_QTFRED: OFF + ENABLE_QTFRED: ON run: $GITHUB_WORKSPACE/ci/linux/configure_cmake.sh - name: Compile working-directory: ./build diff --git a/ci/linux/configure_cmake.sh b/ci/linux/configure_cmake.sh index bb0decb22be..1884264c079 100755 --- a/ci/linux/configure_cmake.sh +++ b/ci/linux/configure_cmake.sh @@ -12,16 +12,24 @@ if [ "$COMPILER" = "clang-16" ]; then export CC=clang-16 export CXX=clang++-16 fi +if [ "$RUNNER_ARCH" = "ARM" ] || [ "$RUNNER_ARCH" = "ARM64" ]; then + PLATFORM_CMAKE_OPTIONS="$PLATFORM_CMAKE_OPTIONS -DFSO_BUILD_QTFRED=OFF" +else + PLATFORM_CMAKE_OPTIONS="$PLATFORM_CMAKE_OPTIONS -DFSO_BUILD_QTFRED=${ENABLE_QTFRED:-OFF}" +fi +if [ "$ENABLE_QTFRED" = "ON" ]; then + CMAKE_OPTIONS="$CMAKE_OPTIONS -DQHELPGENERATOR_EXECUTABLE=${QTHELP_DIR}" +fi LD_LIBRARY_PATH=$Qt5_DIR/lib:$LD_LIBRARY_PATH if [ "$RUNNER_OS" = "macOS" ]; then CXXFLAGS="-mtune=generic -pipe -Wno-unknown-pragmas" CFLAGS="-mtune=generic -pipe -Wno-unknown-pragmas" # TODO: Vulkan support is disabled on MacOS due to issues with the test suite not linking correctly - PLATFORM_CMAKE_OPTIONS="-DFSO_BUILD_WITH_VULKAN=OFF" + PLATFORM_CMAKE_OPTIONS="$PLATFORM_CMAKE_OPTIONS -DFSO_BUILD_WITH_VULKAN=OFF" export CMAKE_OSX_ARCHITECTURES="$ARCHITECTURE" else - PLATFORM_CMAKE_OPTIONS="-DFSO_BUILD_APPIMAGE=ON -DFORCED_SIMD_INSTRUCTIONS=SSE2 -DUSE_STATIC_LIBCXX=ON" + PLATFORM_CMAKE_OPTIONS="$PLATFORM_CMAKE_OPTIONS -DFSO_BUILD_APPIMAGE=ON -DFORCED_SIMD_INSTRUCTIONS=SSE2 -DUSE_STATIC_LIBCXX=ON" fi CMAKE_OPTIONS="$JOB_CMAKE_OPTIONS" @@ -51,5 +59,5 @@ fi cmake -G Ninja -DFSO_FATAL_WARNINGS=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=ON $CMAKE_OPTIONS $PLATFORM_CMAKE_OPTIONS \ -DCMAKE_INSTALL_PREFIX="$(pwd)/install" -DCMAKE_BUILD_TYPE=$CONFIGURATION \ - -DFFMPEG_USE_PRECOMPILED=ON -DFSO_BUILD_TESTS=ON -DFSO_BUILD_INCLUDED_LIBS=ON -DFSO_BUILD_QTFRED=${ENABLE_QTFRED:-OFF} \ + -DFFMPEG_USE_PRECOMPILED=ON -DFSO_BUILD_TESTS=ON -DFSO_BUILD_INCLUDED_LIBS=ON \ -DSHADERS_ENABLE_COMPILATION=ON -DCMAKE_JOB_POOLS=link=1 -DCMAKE_JOB_POOL_LINK=link .. diff --git a/ci/linux/generate_appimage.sh b/ci/linux/generate_appimage.sh index 11bc7300a7e..692196b41b9 100755 --- a/ci/linux/generate_appimage.sh +++ b/ci/linux/generate_appimage.sh @@ -1,7 +1,34 @@ #!/usr/bin/env bash - +export LD_LIBRARY_PATH=$(pwd)/bin/lib:$LD_LIBRARY_PATH INSTALL_FOLDER=$1 +# safety check +if [ ! -d bin -o ! -f cmake_install.cmake ]; then + echo "ERROR! This script must be run from within the build root!" + exit 1 +fi + +if [ ! -x "$(which wget)" ]; then + echo "ERROR! Required utility is not available: wget" + exit 1 +fi + +# install newest appimagetool if it's not already available +if [ ! -x ./bin/linuxdeployqt ]; then + APPIMAGE_TOOL_URL="https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-$(uname -m).AppImage" + PLUGIN_TOOL_URL="https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-$(uname -m).AppImage" + + wget -O ./bin/linuxdeploy "$APPIMAGE_TOOL_URL" || { echo "ERROR! Failed to get linuxdeployqt!" && exit 1; } + wget -O ./bin/linuxdeploy-plugin-qt "$PLUGIN_TOOL_URL" || { echo "ERROR! Failed to get linuxdeployqt!" && exit 1; } + chmod +x ./bin/linuxdeploy + chmod +x ./bin/linuxdeploy-plugin-qt + + +fi +# This shouldn't be needed with newer runtimes, but they still generate an +# error if fusermount is missing even though it works. So to skip error msg +# and have max compatibility with runtimes and containers we'll use it. +export APPIMAGE_EXTRACT_AND_RUN=1 # Install Freespace2 targets cmake -DCMAKE_INSTALL_PREFIX=$INSTALL_FOLDER/Freespace2 -DCOMPONENT=Unspecified -P cmake_install.cmake cmake -DCMAKE_INSTALL_PREFIX=$INSTALL_FOLDER/Freespace2 -DCOMPONENT=Freespace2 -P cmake_install.cmake @@ -12,14 +39,26 @@ appimagetool -n "$INSTALL_FOLDER/Freespace2" "$INSTALL_FOLDER/$FILENAME" chmod +x "$INSTALL_FOLDER/$FILENAME" # Maybe install qtFRED targets -if [ -f qtfred/cmake_install.cmake ]; then - cmake -DCMAKE_INSTALL_PREFIX=$INSTALL_FOLDER/qtFRED -DCOMPONENT=Unspecified -P cmake_install.cmake - cmake -DCMAKE_INSTALL_PREFIX=$INSTALL_FOLDER/qtFRED -DCOMPONENT=qtFRED -P cmake_install.cmake - - # We need to be a bit creative for determining the AppImage name since we don't want to hard-code the name - FILENAME="$(find $INSTALL_FOLDER/qtFRED/bin -iname 'qtfred_*' -type f -printf "%f\n").AppImage" - appimagetool -n "$INSTALL_FOLDER/qtFRED" "$INSTALL_FOLDER/$FILENAME" - chmod +x "$INSTALL_FOLDER/$FILENAME" +if [[ "$RUNNER_ARCH" != "ARM" && "$RUNNER_ARCH" != "ARM64" ]]; then + if [ "$ENABLE_QTFRED" = "ON" ]; then + cmake -DCMAKE_INSTALL_PREFIX=$INSTALL_FOLDER/qtFRED -DCOMPONENT=Unspecified -P cmake_install.cmake + cmake -DCMAKE_INSTALL_PREFIX=$INSTALL_FOLDER/qtFRED -DCOMPONENT=qtFRED -P cmake_install.cmake + # We need to be a bit creative for determining the AppImage name since we don't want to hard-code the name + export QT_QPA_PLATFORM=offscreen + TARGET_DIR="$INSTALL_FOLDER/qtFRED/bin" + DESKTOP_PATH=$(find "$INSTALL_FOLDER/qtFRED" -name "*.desktop" -type f -print -quit) + BINARY_PATH=$(find "$TARGET_DIR" -type f -name "qtfred_*" -not -name "*help*" -print -quit) + CLEANFILENAME=$(basename "$BINARY_PATH") + FILENAME="${CLEANFILENAME}.AppImage" + if [ -z "$BINARY_PATH" ] || [ ! -f "$BINARY_PATH" ]; then + echo "ERROR: linuxdeployqt target not found at $BINARY_PATH" + exit 1 + fi + #FILENAME="$(find $INSTALL_FOLDER/qtFRED/bin -iname 'qtfred_*' ! -iname '*help*' -type f -printf "%f\n").AppImage" + ./bin/linuxdeploy --appdir "$INSTALL_FOLDER/qtFRED" --plugin qt --executable "$BINARY_PATHY" + appimagetool -n "$INSTALL_FOLDER/qtFRED" "$INSTALL_FOLDER/$FILENAME" + chmod +x "$INSTALL_FOLDER/$FILENAME" + fi fi ls -al $INSTALL_FOLDER