Skip to content

Commit

Permalink
Download dlls for github actions #847
Browse files Browse the repository at this point in the history
Fix missing optional dlls
  • Loading branch information
cxong committed Mar 24, 2024
1 parent f11a3ab commit 7857576
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 17 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,11 @@ jobs:
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest -C ${{env.BUILD_TYPE}} -VV -S

- name: Download DLLs on tags (Windows)
if: startsWith(github.ref, 'refs/tags/') && matrix.os == 'windows-latest'
run: |
build/windows/get-sdl2-dlls.bat dll
- name: Make package on tags
if: startsWith(github.ref, 'refs/tags/')
run: |
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/cmake.yml.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,11 @@ jobs:
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest -C ${{env.BUILD_TYPE}} -VV -S

- name: Download DLLs on tags (Windows)
if: startsWith(github.ref, 'refs/tags/') && matrix.os == 'windows-latest'
run: |
build/windows/get-sdl2-dlls.bat dll 64

- name: Make package on tags
if: startsWith(github.ref, 'refs/tags/')
run: |
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ environment:
# https://www.appveyor.com/docs/windows-images-software/#python
PYTHON: "C:\\Python37"
SDL2_VERSION: 2.26.4
SDL2_IMAGE_VERSION: 2.6.3
SDL2_IMAGE_VERSION: 2.8.1
SDL2_MIXER_VERSION: 2.6.3
SDLDIR: C:\projects\cdogs-sdl
VERSION: 2.0.0
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ environment:
# https://www.appveyor.com/docs/windows-images-software/#python
PYTHON: "C:\\Python37"
SDL2_VERSION: 2.26.4
SDL2_IMAGE_VERSION: 2.6.3
SDL2_IMAGE_VERSION: 2.8.1
SDL2_MIXER_VERSION: 2.6.3
SDLDIR: C:\projects\cdogs-sdl
VERSION: @VERSION@
Expand Down
25 changes: 15 additions & 10 deletions build/windows/get-sdl2-dlls.bat
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,26 @@ set SDL2_VERSION=2.26.4
set SDL2_IMAGE_VERSION=2.8.1
set SDL2_MIXER_VERSION=2.6.3


set DESTDIR=%1
set BITS=%2
set DOWNLOAD_COMMAND=%~3

rem PLEASE NO SPACES IN SDL2_* VARIABLES

set SDL2_URL=http://www.libsdl.org/release/SDL2-%SDL2_VERSION%-win32-x86.zip
set SDL2_ARCHIVE=SDL2-%SDL2_VERSION%-win32-x86.zip
set SDL2_ARCHIVE=SDL2-%SDL2_VERSION%-win32-x%BITS%.zip
set SDL2_URL=https://www.libsdl.org/release/%SDL2_ARCHIVE%

set SDL2_IMAGE_URL=http://www.libsdl.org/projects/SDL_image/release/SDL2_image-%SDL2_IMAGE_VERSION%-win32-x86.zip
set SDL2_IMAGE_ARCHIVE=SDL2_image-%SDL2_IMAGE_VERSION%-win32-x86.zip
set SDL2_IMAGE_ARCHIVE=SDL2_image-%SDL2_IMAGE_VERSION%-win32-x%BITS%.zip
set SDL2_IMAGE_URL=https://www.libsdl.org/projects/SDL_image/release/%SDL2_IMAGE_ARCHIVE%

set SDL2_MIXER_URL=https://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-%SDL2_MIXER_VERSION%-win32-x86.zip
set SDL2_MIXER_ARCHIVE=SDL2_mixer-%SDL2_MIXER_VERSION%-win32-x86.zip
set SDL2_MIXER_ARCHIVE=SDL2_mixer-%SDL2_MIXER_VERSION%-win32-x%BITS%.zip
set SDL2_MIXER_URL=https://www.libsdl.org/projects/SDL_mixer/release/%SDL2_MIXER_ARCHIVE%

rem ========================================================


set DESTDIR=%1
set DOWNLOAD_COMMAND=%~2
if "!DESTDIR!" == "" (
echo Usage %0 destination_dir [download_command]
echo "Usage %0 destination_dir (32|64) [download_command]"
echo Assume you have 7z in your PATH
exit /b 1
)
Expand All @@ -46,6 +48,9 @@ call :downloadIfNeeded !SDL2_MIXER_URL!
%EXTRACT_COMMAND% !SDL2_IMAGE_ARCHIVE!
%EXTRACT_COMMAND% !SDL2_MIXER_ARCHIVE!

rem Copy optional DLLs within the optional folders
copy .\optional\*.dll .

exit /b
rem ========================================================

Expand Down
2 changes: 1 addition & 1 deletion src/cdogs.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ int main(int argc, char *argv[])
err = EXIT_FAILURE;
goto bail;
}
NetClientInit(&gNetClient, ConfigGetInt(&gConfig, "ListenPort"));
NetClientInit(&gNetClient, (uint16_t)ConfigGetInt(&gConfig, "ListenPort"));
#endif

LoadingScreenDraw(&gLoadingScreen, "Initializing sound device...", 0.25f);
Expand Down
9 changes: 5 additions & 4 deletions src/prep.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
This file incorporates work covered by the following copyright and
permission notice:
Copyright (c) 2013-2018, 2020-2023 Cong Xu
Copyright (c) 2013-2018, 2020-2024 Cong Xu
All rights reserved.
Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -729,7 +729,8 @@ static GameLoopResult GameOptionsUpdate(GameLoopData *data, LoopRunner *l)
// If enabled, start net server
if (!gCampaign.IsClient && ConfigGetBool(&gConfig, "StartServer"))
{
NetServerOpen(&gNetServer, ConfigGetInt(&gConfig, "ListenPort"));
NetServerOpen(
&gNetServer, (uint16_t)ConfigGetInt(&gConfig, "ListenPort"));
}
LoopRunnerPush(
l, ScreenMissionBriefing(&gCampaign.Setting, &gMission));
Expand Down Expand Up @@ -797,7 +798,7 @@ static GameLoopResult CheckGameStart(void *data, LoopRunner *l)
}
LoopRunnerPush(
l, ScreenLoading(
"Starting game...", true,
RunGame(&gCampaign, &gMission, &gMap), true));
"Starting game...", true, RunGame(&gCampaign, &gMission, &gMap),
true));
return UPDATE_RESULT_OK;
}

0 comments on commit 7857576

Please sign in to comment.