Skip to content

Commit

Permalink
Fixes imagemagick use for windows icon generation on CI.
Browse files Browse the repository at this point in the history
Also fixes release upload for msvc builds.
  • Loading branch information
OmniBlade committed Aug 8, 2023
1 parent a36cba3 commit 59efc89
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 13 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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: |
Expand Down
12 changes: 5 additions & 7 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
tag_name: "latest"
prerelease: true
files: |
artifact\*
artifact/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand All @@ -69,7 +69,7 @@ jobs:
uses: softprops/action-gh-release@v1
with:
files: |
artifact\*
artifact/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand Down Expand Up @@ -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
Expand All @@ -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: |
Expand Down Expand Up @@ -157,7 +155,7 @@ jobs:
tag_name: "latest"
prerelease: true
files: |
artifact\*
artifact/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand All @@ -166,6 +164,6 @@ jobs:
uses: softprops/action-gh-release@v1
with:
files: |
artifact\*
artifact/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
15 changes: 12 additions & 3 deletions cmake/BuildIcons.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Expand All @@ -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()
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 59efc89

Please sign in to comment.