Skip to content

Commit

Permalink
Update Visual Studio package installation and demo setup (ihhub#3267)
Browse files Browse the repository at this point in the history
to keep everything within the same directory plus extra file cleanup
  • Loading branch information
ihhub authored Apr 24, 2021
1 parent df61790 commit 11843ac
Show file tree
Hide file tree
Showing 9 changed files with 124 additions and 117 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,8 @@ fheroes2.pot
# demo directory
script/demo/demo

# Installed packages for Visual Studio
VisualStudio/packages/installed

# Mac magic folders
.DS_Store
6 changes: 3 additions & 3 deletions VisualStudio/SDL1.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
<PropertyGroup />
<ItemDefinitionGroup>
<ClCompile>
<AdditionalIncludeDirectories>$(MSBuildThisFileDirectory)..\..\sdl\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(MSBuildThisFileDirectory)packages\installed\sdl\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<AdditionalLibraryDirectories>$(MSBuildThisFileDirectory)..\..\sdl\lib\$(PlatformTarget);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalLibraryDirectories>$(MSBuildThisFileDirectory)packages\installed\sdl\lib\$(PlatformTarget);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>SDL.lib;SDL_mixer.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PostBuildEvent>
<Command>xcopy /Y "$(MSBuildThisFileDirectory)..\..\sdl\lib\$(PlatformTarget)\*" "$(OutDir)"
<Command>xcopy /Y "$(MSBuildThisFileDirectory)packages\installed\sdl\lib\$(PlatformTarget)\*" "$(OutDir)"
%(Command)</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
Expand Down
6 changes: 3 additions & 3 deletions VisualStudio/SDL2.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
<PropertyGroup />
<ItemDefinitionGroup>
<ClCompile>
<AdditionalIncludeDirectories>$(MSBuildThisFileDirectory)..\..\sdl2\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(MSBuildThisFileDirectory)packages\installed\sdl2\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WITH_TTF;FHEROES2_IMAGE_SUPPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<AdditionalLibraryDirectories>$(MSBuildThisFileDirectory)..\..\sdl2\lib/$(PlatformTarget);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalLibraryDirectories>$(MSBuildThisFileDirectory)packages\installed\sdl2\lib/$(PlatformTarget);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>SDL2.lib;SDL2_mixer.lib;SDL2_ttf.lib;SDL2_image.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PostBuildEvent>
<Command>xcopy /Y "$(MSBuildThisFileDirectory)..\..\sdl2\lib\$(PlatformTarget)\*.dll" "$(OutDir)"
<Command>xcopy /Y "$(MSBuildThisFileDirectory)packages\installed\sdl2\lib\$(PlatformTarget)\*.dll" "$(OutDir)"
%(Command)</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
Expand Down
4 changes: 2 additions & 2 deletions VisualStudio/common.props
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
<ClCompile>
<WarningLevel>Level4</WarningLevel>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>$(MSBuildThisFileDirectory)..\src\engine;$(MSBuildThisFileDirectory)..\src\fheroes2\gui;$(MSBuildThisFileDirectory)..\src\fheroes2\maps;$(MSBuildThisFileDirectory)..\src\fheroes2\kingdom;$(MSBuildThisFileDirectory)..\src\fheroes2\campaign;$(MSBuildThisFileDirectory)..\src\fheroes2\game;$(MSBuildThisFileDirectory)..\src\fheroes2\dialog;$(MSBuildThisFileDirectory)..\src\fheroes2\system;$(MSBuildThisFileDirectory)..\src\fheroes2\spell;$(MSBuildThisFileDirectory)..\src\fheroes2\monster;$(MSBuildThisFileDirectory)..\src\fheroes2\castle;$(MSBuildThisFileDirectory)..\src\fheroes2\agg;$(MSBuildThisFileDirectory)..\src\fheroes2\heroes;$(MSBuildThisFileDirectory)..\src\fheroes2\resource;$(MSBuildThisFileDirectory)..\src\fheroes2\ai;$(MSBuildThisFileDirectory)..\src\fheroes2\army;$(MSBuildThisFileDirectory)..\src\fheroes2\battle;$(MSBuildThisFileDirectory)..\src\fheroes2\pocketpc;$(MSBuildThisFileDirectory)..\src\fheroes2\objects;$(MSBuildThisFileDirectory)..\src\fheroes2\world;$(MSBuildThisFileDirectory)..\src\fheroes2\image;$(MSBuildThisFileDirectory)..\src\thirdparty\libsmacker;$(MSBuildThisFileDirectory)..\..\zlib\include\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(MSBuildThisFileDirectory)..\src\engine;$(MSBuildThisFileDirectory)..\src\fheroes2\gui;$(MSBuildThisFileDirectory)..\src\fheroes2\maps;$(MSBuildThisFileDirectory)..\src\fheroes2\kingdom;$(MSBuildThisFileDirectory)..\src\fheroes2\campaign;$(MSBuildThisFileDirectory)..\src\fheroes2\game;$(MSBuildThisFileDirectory)..\src\fheroes2\dialog;$(MSBuildThisFileDirectory)..\src\fheroes2\system;$(MSBuildThisFileDirectory)..\src\fheroes2\spell;$(MSBuildThisFileDirectory)..\src\fheroes2\monster;$(MSBuildThisFileDirectory)..\src\fheroes2\castle;$(MSBuildThisFileDirectory)..\src\fheroes2\agg;$(MSBuildThisFileDirectory)..\src\fheroes2\heroes;$(MSBuildThisFileDirectory)..\src\fheroes2\resource;$(MSBuildThisFileDirectory)..\src\fheroes2\ai;$(MSBuildThisFileDirectory)..\src\fheroes2\army;$(MSBuildThisFileDirectory)..\src\fheroes2\battle;$(MSBuildThisFileDirectory)..\src\fheroes2\pocketpc;$(MSBuildThisFileDirectory)..\src\fheroes2\objects;$(MSBuildThisFileDirectory)..\src\fheroes2\world;$(MSBuildThisFileDirectory)..\src\fheroes2\image;$(MSBuildThisFileDirectory)..\src\thirdparty\libsmacker;$(MSBuildThisFileDirectory)packages\installed\zlib\include\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;WITH_ZLIB;WITH_MIXER;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<TreatSpecificWarningsAsErrors>4100;4189;4309;4319;4592;4715;4800</TreatSpecificWarningsAsErrors>
</ClCompile>
<ResourceCompile>
<AdditionalIncludeDirectories>$(MSBuildThisFileDirectory)..\src\fheroes2\system;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
<Link>
<AdditionalLibraryDirectories>$(MSBuildThisFileDirectory)..\..\zlib\lib\$(PlatformTarget);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalLibraryDirectories>$(MSBuildThisFileDirectory)packages\installed\zlib\lib\$(PlatformTarget);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>zlibstatic.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PostBuildEvent>
Expand Down
13 changes: 7 additions & 6 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,12 @@ clone_folder: C:\projects\fheroes2

install:
- cd C:\projects\fheroes2\script\windows
- if not exist C:\projects\packages call install_packages.bat
- if not exist C:\projects\fheroes2\VisualStudio\packages\installed call install_packages.bat
- cd C:\projects\fheroes2

init:
- git config --global core.autocrlf true

build:
project: fheroes2-vs2015.vcxproj

Expand All @@ -55,7 +58,8 @@ after_build:
- cmd: 7z a fheroes2_windows_%platform%_%deploy_conf_name%.zip fheroes2.exe SDL*.dll lib*.dll zlib*.dll msvcp*.dll vcruntime*.dll
- cmd: cd C:\projects\fheroes2
- cmd: xcopy /Y /s /Q "doc\README.txt" "."
- cmd: 7z a build\%platform%\%configuration%\fheroes2_windows_%platform%_%deploy_conf_name%.zip script\demo\demo_windows.bat LICENSE fheroes2.key changelog.txt README.txt
- cmd: xcopy /Y /s /Q "script\demo\demo_windows.bat" "."
- cmd: 7z a build\%platform%\%configuration%\fheroes2_windows_%platform%_%deploy_conf_name%.zip demo_windows.bat LICENSE fheroes2.key changelog.txt README.txt

artifacts:
- path: build\$(platform)\$(configuration)\fheroes2_windows_$(platform)_$(deploy_conf_name).zip
Expand All @@ -76,7 +80,4 @@ deploy:
branch: master

cache:
- C:\projects\packages -> appveyor.yml, script\windows\install_packages.bat, script\windows\setup_packages.bat
- C:\projects\sdl -> appveyor.yml, script\windows\install_packages.bat, script\windows\setup_packages.bat
- C:\projects\sdl2 -> appveyor.yml, script\windows\install_packages.bat, script\windows\setup_packages.bat
- C:\projects\zlib -> appveyor.yml, script\windows\install_packages.bat, script\windows\setup_packages.bat
- C:\projects\fheroes2\VisualStudio\packages\installed -> appveyor.yml, script\windows\install_packages.bat, script\windows\setup_packages.bat
8 changes: 4 additions & 4 deletions doc/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ download a free demo version of the game with help of our scripts.
You are required to have at a demo or full version of Heroes of Might and Magic II
game to be able to play it.

If you do not have the original Heroes of Might and Magic II game please open
script/demo directory and run demo_windows.bat for Windows OS, demo_linux.sh for
Linux OS or demo_macos.sh for MacOS. This script will download and install all
needed files.
If you do not have the original Heroes of Might and Magic II game please run
'demo_windows.bat' file on Windows, or open 'script/demo' directory and run
'demo_linux.sh' for Linux OS or 'demo_macos.sh' for MacOS. This script will
download and install all needed files.

If you have a legally purchased game, you need to copy all files which belong to
fheroes2 into a folder with the original game.
Expand Down
19 changes: 14 additions & 5 deletions script/demo/demo_windows.bat
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
@echo off

set fheroes2Path = ""

if not exist "fheroes2.exe" (
Rem this is not fheroes2 related directory. Let's see if it's for developer
if exist "..\..\src" (
set fheroes2Path="..\..\"
)
)

if not exist "demo" mkdir "demo"

echo [1/4] downloading demo version
Expand Down Expand Up @@ -28,10 +37,10 @@ if not "%sevenZipPath%" == "" (

echo [4/4] copying files

if not exist "..\..\..\data" mkdir "..\..\..\data"
if not exist "..\..\..\maps" mkdir "..\..\..\maps"
xcopy /Y /s "DATA" "..\..\..\data"
xcopy /Y /s "MAPS" "..\..\..\maps"
if not exist "%fheroes2Path%..\data" mkdir "%fheroes2Path%..\data"
if not exist "%fheroes2Path%..\maps" mkdir "%fheroes2Path%..\maps"
xcopy /Y /q "DATA" "%fheroes2Path%..\data"
xcopy /Y /q "MAPS" "%fheroes2Path%..\maps"

del demo.zip
del wing32.zip
Expand All @@ -40,7 +49,7 @@ if not "%sevenZipPath%" == "" (
) else (
echo 7z.exe is not found in path.
echo Please unzip demo.zip file manually and copy DATA and MAPS folders into folder with the game.
echo Alternatively, re-run script after installing 7-zip archiver at your local system's folder as- 'C:\Program Files\7-Zip\7z.exe
echo Alternatively, re-run script after installing 7-zip archiver at your local system's folder as 'C:\Program Files\7-Zip'.
)

if not "%APPVEYOR_REPO_PROVIDER%" == "gitHub" (
Expand Down
56 changes: 26 additions & 30 deletions script/windows/install_packages.bat
Original file line number Diff line number Diff line change
@@ -1,29 +1,30 @@
@echo off

if not exist "..\..\..\packages" mkdir "..\..\..\packages"
if not exist "..\..\..\packages\zlib" mkdir "..\..\..\packages\zlib"
if not exist "..\..\..\packages\sdl" mkdir "..\..\..\packages\sdl"
if not exist "..\..\..\packages\sdl_mixer" mkdir "..\..\..\packages\sdl_mixer"
if not exist "..\..\..\packages\sdl_ttf" mkdir "..\..\..\packages\sdl_ttf"
if not exist "..\..\..\packages\sdl_image" mkdir "..\..\..\packages\sdl_image"
set tempPath="..\..\VisualStudio\packages\installed\temp"

if not exist "%tempPath%\zlib" mkdir "%tempPath%\zlib"
if not exist "%tempPath%\sdl" mkdir "%tempPath%\sdl"
if not exist "%tempPath%\sdl_mixer" mkdir "%tempPath%\sdl_mixer"
if not exist "%tempPath%\sdl_ttf" mkdir "%tempPath%\sdl_ttf"
if not exist "%tempPath%\sdl_image" mkdir "%tempPath%\sdl_image"

echo [1/7] Copying packages
xcopy /Y /s /Q "..\..\VisualStudio\packages\zlib1.2.11.zip" "..\..\..\packages\zlib"
xcopy /Y /Q "..\..\VisualStudio\packages\zlib1.2.11.zip" "%tempPath%\zlib\"
echo [2/7] Downloading packages
powershell -Command "(New-Object Net.WebClient).DownloadFile('https://www.libsdl.org/release/SDL-devel-1.2.15-VC.zip', '..\..\..\packages\sdl\sdl.zip')"
powershell -Command "(New-Object Net.WebClient).DownloadFile('https://www.libsdl.org/release/SDL-devel-1.2.15-VC.zip', '%tempPath%\sdl\sdl.zip')"
echo [3/7] Downloading packages
powershell -Command "(New-Object Net.WebClient).DownloadFile('https://www.libsdl.org/release/SDL2-devel-2.0.12-VC.zip', '..\..\..\packages\sdl\sdl2.zip')"
powershell -Command "(New-Object Net.WebClient).DownloadFile('https://www.libsdl.org/release/SDL2-devel-2.0.12-VC.zip', '%tempPath%\sdl\sdl2.zip')"
echo [4/7] Downloading packages
powershell -Command "(New-Object Net.WebClient).DownloadFile('https://www.libsdl.org/projects/SDL_mixer/release/SDL_mixer-devel-1.2.12-VC.zip', '..\..\..\packages\sdl_mixer\sdl_mixer.zip')"
powershell -Command "(New-Object Net.WebClient).DownloadFile('https://www.libsdl.org/projects/SDL_mixer/release/SDL_mixer-devel-1.2.12-VC.zip', '%tempPath%\sdl_mixer\sdl_mixer.zip')"
echo [5/7] Downloading packages
powershell -Command "(New-Object Net.WebClient).DownloadFile('https://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-devel-2.0.4-VC.zip', '..\..\..\packages\sdl_mixer\sdl_mixer2.zip')"
powershell -Command "(New-Object Net.WebClient).DownloadFile('https://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-devel-2.0.4-VC.zip', '%tempPath%\sdl_mixer\sdl_mixer2.zip')"
echo [6/7] Downloading packages
powershell -Command "(New-Object Net.WebClient).DownloadFile('https://www.libsdl.org/projects/SDL_ttf/release/SDL2_ttf-devel-2.0.15-VC.zip', '..\..\..\packages\sdl_ttf\sdl_ttf2.zip')"
powershell -Command "(New-Object Net.WebClient).DownloadFile('https://www.libsdl.org/projects/SDL_ttf/release/SDL2_ttf-devel-2.0.15-VC.zip', '%tempPath%\sdl_ttf\sdl_ttf2.zip')"
echo [7/7] Downloading packages
powershell -Command "(New-Object Net.WebClient).DownloadFile('https://www.libsdl.org/projects/SDL_image/release/SDL2_image-devel-2.0.5-VC.zip', '..\..\..\packages\sdl_image\sdl_image2.zip')"
powershell -Command "(New-Object Net.WebClient).DownloadFile('https://www.libsdl.org/projects/SDL_image/release/SDL2_image-devel-2.0.5-VC.zip', '%tempPath%\sdl_image\sdl_image2.zip')"

xcopy /Y /s /Q "setup_packages.bat" "..\..\..\packages"
cd "..\..\..\packages"
xcopy /Y /s /Q "setup_packages.bat" "..\..\VisualStudio\packages\installed"
cd "%tempPath%"

set sevenZipPath=

Expand All @@ -38,38 +39,33 @@ if %errorlevel% == 0 (

if not "%sevenZipPath%" == "" (
echo [1/7] Unpacking packages
cd zlib
"%sevenZipPath%" x zlib1.2.11.zip -aoa > nul
"%sevenZipPath%" x zlib\zlib1.2.11.zip -aoa -ozlib > nul

echo [2/7] Unpacking packages
cd ..\sdl
"%sevenZipPath%" x sdl.zip -aoa > nul
"%sevenZipPath%" x sdl\sdl.zip -aoa -osdl > nul

echo [3/7] Unpacking packages
cd ..\sdl
"%sevenZipPath%" x sdl2.zip -aoa > nul
"%sevenZipPath%" x sdl\sdl2.zip -aoa -osdl > nul

echo [4/7] Unpacking packages
cd ..\sdl_mixer
"%sevenZipPath%" x sdl_mixer.zip -aoa > nul
"%sevenZipPath%" x sdl_mixer\sdl_mixer.zip -aoa -osdl_mixer > nul

echo [5/7] Unpacking packages
cd ..\sdl_mixer
"%sevenZipPath%" x sdl_mixer2.zip -aoa > nul
"%sevenZipPath%" x sdl_mixer\sdl_mixer2.zip -aoa -osdl_mixer > nul

echo [6/7] Unpacking packages
cd ..\sdl_ttf
"%sevenZipPath%" x sdl_ttf2.zip -aoa > nul
"%sevenZipPath%" x sdl_ttf\sdl_ttf2.zip -aoa -osdl_ttf > nul

echo [7/7] Unpacking packages
cd ..\sdl_image
"%sevenZipPath%" x sdl_image2.zip -aoa > nul
"%sevenZipPath%" x sdl_image\sdl_image2.zip -aoa -osdl_image > nul

cd ..
call "setup_packages.bat"
del "setup_packages.bat"

echo "SUCCESS! Installation is completed"
) else (
echo "Failed to unzip archives because 7-zip is not installed in system. Please unpack all archives in packages internal folders and manually run setup_packages.bat file after"
echo "Failed to unzip archives because 7-zip is not installed in system. Please unpack all archives in packages internal folders and manually run setup_packages.bat file after."
)

if not "%APPVEYOR_REPO_PROVIDER%" == "gitHub" (
Expand Down
Loading

0 comments on commit 11843ac

Please sign in to comment.