From 59efc8949b4bbe3f1fe9961fbcf828b927064f8e Mon Sep 17 00:00:00 2001 From: OmniBlade Date: Thu, 3 Aug 2023 16:04:42 +0100 Subject: [PATCH] Fixes imagemagick use for windows icon generation on CI. Also fixes release upload for msvc builds. --- .github/workflows/macos.yml | 8 +++++--- .github/workflows/windows.yml | 12 +++++------- cmake/BuildIcons.cmake | 15 ++++++++++++--- 3 files changed, 22 insertions(+), 13 deletions(-) diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 32f7e6cc..ea5fbda1 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -13,8 +13,6 @@ jobs: submodules: 'true' fetch-depth: 0 ref: ${{ github.event.pull_request.head.sha }} - - - uses: seanmiddleditch/gha-setup-ninja@master - name: Set Git Info id: gitinfo @@ -34,7 +32,11 @@ jobs: with: path: ~/macports key: ${{ env.DEP_CACHE_KEY }} - + + - name: Install ninja + run: | + brew install ninja + - if: ${{ steps.dep-cache.outputs.cache-hit != 'true' }} name: Install dependencies run: | diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 9835b629..2c401a2e 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -60,7 +60,7 @@ jobs: tag_name: "latest" prerelease: true files: | - artifact\* + artifact/* env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -69,7 +69,7 @@ jobs: uses: softprops/action-gh-release@v1 with: files: | - artifact\* + artifact/* env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -109,7 +109,6 @@ jobs: - name: Install Dependencies run: | - choco install imagemagick.app --no-progress --version 7.0.10.56 --side-by-side choco install openalsdk --no-progress Invoke-WebRequest -Uri https://www.libsdl.org/release/SDL2-devel-2.0.12-VC.zip -OutFile $Env:TEMP\SDL2-devel.zip Invoke-WebRequest -Uri https://github.com/ninja-build/ninja/releases/download/v1.10.1/ninja-win.zip -OutFile $Env:TEMP\ninja-win.zip @@ -118,13 +117,12 @@ jobs: Expand-Archive $Env:TEMP\ninja-win.zip -DestinationPath $Env:TEMP\ninja Expand-Archive $Env:TEMP\openal-soft-1.21.0-bin.zip -DestinationPath $Env:TEMP echo "$Env:TEMP\ninja" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append - echo "C:\Program Files\ImageMagick-7.0.10-Q16-HDRI" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append ninja --version Rename-Item $Env:TEMP\openal-soft-1.21.0-bin\bin\${{ steps.vars.outputs.oal_path }}\soft_oal.dll OpenAL32.dll - name: Configure Vanilla Conquer run: | - cmake -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_TOOLS=ON -DBUILD_TESTS=ON -DSDL2=ON "-DSDL2_ROOT_DIR=$($Env:TEMP)\SDL2-2.0.12" -DOPENAL=ON "-DOPENAL_ROOT=C:\Program Files (x86)\OpenAL 1.1 SDK" -DBUILD_REMASTERTD=OFF -DBUILD_REMASTERRA=OFF -DMAP_EDITORTD=ON -DMAP_EDITORRA=ON "-DImageMagick_convert_EXECUTABLE=C:\Program Files\ImageMagick-7.0.10-Q16-HDRI\magick.exe" -DImageMagick_convert_FOUND=TRUE -B build + cmake -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_TOOLS=ON -DBUILD_TESTS=ON -DSDL2=ON "-DSDL2_ROOT_DIR=$($Env:TEMP)\SDL2-2.0.12" -DOPENAL=ON "-DOPENAL_ROOT=C:\Program Files (x86)\OpenAL 1.1 SDK" -DBUILD_REMASTERTD=OFF -DBUILD_REMASTERRA=OFF -DMAP_EDITORTD=ON -DMAP_EDITORRA=ON "-DImageMagick_magick_EXECUTABLE=$($(Get-Command magick.exe).Source)" -DImageMagick_magick_FOUND=TRUE -B build - name: Build Vanilla Conquer run: | @@ -157,7 +155,7 @@ jobs: tag_name: "latest" prerelease: true files: | - artifact\* + artifact/* env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -166,6 +164,6 @@ jobs: uses: softprops/action-gh-release@v1 with: files: | - artifact\* + artifact/* env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/cmake/BuildIcons.cmake b/cmake/BuildIcons.cmake index eb85396a..380a7c4b 100644 --- a/cmake/BuildIcons.cmake +++ b/cmake/BuildIcons.cmake @@ -18,7 +18,16 @@ function(make_icon) message(FATAL_ERROR "INPUT does not exist: ${ARG_INPUT}") endif() - find_package(ImageMagick COMPONENTS convert) + find_package(ImageMagick COMPONENTS magick) + + if(ImageMagick_magick_FOUND) + set(ImageMagick_convert_FOUND TRUE) + set(ImageMagick_convert_EXECUTABLE ${ImageMagick_magick_EXECUTABLE}) + set(ImageMagick_convert_ARGS convert) + else() + find_package(ImageMagick COMPONENTS convert) + endif() + if(NOT ImageMagick_convert_FOUND) message(WARNING "ImageMagick was not found, icons will not be generated.") @@ -41,7 +50,7 @@ function(make_icon) set(_size ${size}) endif() list(APPEND IMAGEMAGICK_CMDS - COMMAND ${ImageMagick_convert_EXECUTABLE} -background none -density "${density}" -resize "${_size}x${_size}" -units "PixelsPerInch" ${ARG_INPUT} "${ICON_DIR}/icon_${size}x${size}${xtwo}.png" + COMMAND ${ImageMagick_convert_EXECUTABLE} ${ImageMagick_convert_ARGS} -background none -density "${density}" -resize "${_size}x${_size}" -units "PixelsPerInch" ${ARG_INPUT} "${ICON_DIR}/icon_${size}x${size}${xtwo}.png" ) endforeach() endforeach() @@ -69,7 +78,7 @@ function(make_icon) add_custom_command( OUTPUT ${ICON_FILE} COMMAND ${ImageMagick_convert_EXECUTABLE} - ARGS -background none ${ARG_INPUT} -define icon:auto-resize="256,64,48,32,16" ${ICON_FILE} + ARGS ${ImageMagick_convert_ARGS} -background none ${ARG_INPUT} -define icon:auto-resize="256,64,48,32,16" ${ICON_FILE} MAIN_DEPENDENCY ${ARG_INPUT} COMMENT "ICO Generation: ${ARG_INPUT_FN}.ico") if(ARG_OUTPUT)