From b348bbd1ab1f94f8cb3fbd2f352d707dba92fd37 Mon Sep 17 00:00:00 2001 From: Bob Wilton Date: Mon, 7 Aug 2023 22:32:39 -0400 Subject: [PATCH] Added WIN32 build workflow using Github Actions --- .github/workflows/win32.yml | 141 ++++++++++++++++++++++++++++++++++++ 1 file changed, 141 insertions(+) create mode 100644 .github/workflows/win32.yml diff --git a/.github/workflows/win32.yml b/.github/workflows/win32.yml new file mode 100644 index 00000000..f5f1d11f --- /dev/null +++ b/.github/workflows/win32.yml @@ -0,0 +1,141 @@ +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 ^