Build ES for Win32 #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build ES for Win32 | |
on: | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: | |
# https://github.com/actions/runner-images/blob/main/images/win/Windows2022-Readme.md | |
windows-2022 | |
env: | |
# Build parameters for CMake | |
BUILD_TYPE: Release | |
Platform: Win32 | |
defaults: | |
run: | |
shell: cmd | |
steps: | |
# Create directories for build (used by CMake) and nuget | |
- name: Set up directories | |
working-directory: ${{runner.workspace}} | |
run: mkdir build nuget | |
# Check-out repository under $GITHUB_WORKSPACE | |
# https://github.com/actions/checkout | |
- name: Check-out repository | |
uses: actions/checkout@v3 | |
with: | |
submodules: true | |
# Discover location of MSBuild tool and to PATH environment variables | |
# https://github.com/microsoft/setup-msbuild | |
- name: Locate MSBuild | |
uses: microsoft/setup-msbuild@v1.3.1 | |
# Use NuGet to download the latest libVLC. | |
- name: Download libVLC | |
working-directory: ${{runner.workspace}}/nuget | |
run: nuget install -ExcludeVersion VideoLAN.LibVLC.Windows | |
# Use vcpkg to download and build the latest cURL | |
- name: Build cURL static library | |
run: vcpkg install curl:x86-windows-static-md | |
# Use vcpkg to download and build the latest FreeImage | |
- name: Build FreeImage static library | |
run: vcpkg install freeimage:x86-windows-static-md | |
# Use vcpkg to download and build the latest FreeType2 | |
- name: Build FreeType2 static library | |
run: vcpkg install freetype:x86-windows-static-md | |
# Use vcpkg to download and build the latest SDL2 | |
- name: Build SDL2 static library | |
run: vcpkg install sdl2:x86-windows-static-md | |
# Use vcpkg to download and build the latest RapidJSON | |
- name: Build RapidJSON static library | |
run: vcpkg install rapidjson:x86-windows-static-md | |
# Setup environment variables for subsequent steps | |
# Note: Forward slashes are used for CMake compatibility | |
- name: Set up environment | |
run: | | |
set VCPKG=%VCPKG_INSTALLATION_ROOT%/installed/x86-windows-static-md | |
set "VCPKG=%VCPKG:\=/%" | |
set NUGET=${{runner.workspace}}/nuget | |
set "NUGET=%NUGET:\=/%" | |
set VLC_HOME=%NUGET%/VideoLAN.LibVLC.Windows/build/x86 | |
echo VCPKG=%VCPKG%>> %GITHUB_ENV% | |
echo NUGET=%NUGET%>> %GITHUB_ENV% | |
echo FREETYPE_DIR=%VCPKG%>> %GITHUB_ENV% | |
echo FREEIMAGE_HOME=%VCPKG%>> %GITHUB_ENV% | |
echo VLC_HOME=%VLC_HOME%>> %GITHUB_ENV% | |
echo RAPIDJSON_INCLUDE_DIRS=%VCPKG%/include>> %GITHUB_ENV% | |
echo CURL_INCLUDE_DIR=%VCPKG%/include>> %GITHUB_ENV% | |
echo SDL2_INCLUDE_DIR=%VCPKG%/include/SDL2>> %GITHUB_ENV% | |
echo VLC_INCLUDE_DIR=%VLC_HOME%/include>> %GITHUB_ENV% | |
echo CURL_LIBRARY=%VCPKG%/lib/*.lib>> %GITHUB_ENV% | |
echo SDL2_LIBRARY=%VCPKG%/lib/manual-link/SDL2main.lib>> %GITHUB_ENV% | |
echo VLC_LIBRARIES=%VLC_HOME%/libvlc*.lib>> %GITHUB_ENV% | |
echo VLC_VERSION=3.0.11>> %GITHUB_ENV% | |
# Use CMake to create Visual Studio project in build folder | |
- name: Create Visual Studio project | |
working-directory: ${{runner.workspace}} | |
run: cmake ${{github.workspace}} | |
-B build | |
-A %Platform% | |
-DRAPIDJSON_INCLUDE_DIRS=%RAPIDJSON_INCLUDE_DIRS% | |
-DCURL_INCLUDE_DIR=%CURL_INCLUDE_DIR% | |
-DSDL2_INCLUDE_DIR=%SDL2_INCLUDE_DIR% | |
-DVLC_INCLUDE_DIR=%VLC_INCLUDE_DIR% | |
-DCURL_LIBRARY=%CURL_LIBRARY% | |
-DSDL2_LIBRARY=%SDL2_LIBRARY% | |
-DVLC_LIBRARIES=%VLC_LIBRARIES% | |
-DVLC_VERSION=%VLC_VERSION% | |
-DCMAKE_EXE_LINKER_FLAGS=/SAFESEH:NO | |
# Use CMake to build project | |
- name: Build EmulationStation | |
working-directory: ${{runner.workspace}} | |
run: cmake --build build --config %BUILD_TYPE% | |
# Copy all other dependencies into Release folder | |
# Note: Forward slashes are replaced with back slashes for this step | |
- name: Collect dependencies | |
working-directory: ${{github.workspace}}/Release | |
run: | | |
set "VLC_ROOT=%VLC_HOME:/=\%" | |
mkdir .emulationstation | |
xcopy ..\resources .\resources /h /i /c /k /e /r /y | |
copy %VLC_ROOT%\*.dll . | |
xcopy %VLC_ROOT%\plugins .\plugins /h /i /c /k /e /r /y | |
# Create systems configuration file | |
- name: Create systems configuration file | |
working-directory: ${{github.workspace}}/Release/.emulationstation | |
run: | | |
echo ^<!-- This is the EmulationStation Systems configuration file.> es_systems.cfg | |
echo All systems must be contained within the ^<systemList^> tag.--^>>> es_systems.cfg | |
echo:>> es_systems.cfg | |
echo ^<systemList^>>> es_systems.cfg | |
echo:>> es_systems.cfg | |
echo ^</systemList^>>> es_systems.cfg | |
# Uploads artifacts from workflow | |
# https://github.com/actions/upload-artifact | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: EmulationStation | |
path: | | |
${{github.workspace}}\Release\*.exe | |
${{github.workspace}}\Release\*.dll | |
${{github.workspace}}\Release\resources\ | |
${{github.workspace}}\Release\plugins\ | |
${{github.workspace}}\Release\.emulationstation\ |