Merge pull request #591 from stenzek/ci-libretro-cmake

CI: Use cmake for Windows libretro builds
This commit is contained in:
Connor McLaughlin 2020-07-07 20:27:55 +10:00 committed by GitHub
commit 83b409c32a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 57 additions and 22 deletions

View file

@ -30,20 +30,7 @@ jobs:
del /Q bin\x64\*.iobj del /Q bin\x64\*.iobj
del /Q bin\x64\*.ipdb del /Q bin\x64\*.ipdb
del /Q bin\x64\common-tests* del /Q bin\x64\common-tests*
- name: Create libretro core archive
shell: cmd
run: |
rename bin\x64\duckstation-libretro-* duckstation_libretro.dll
del /Q bin\x64\duckstation-libretro-* del /Q bin\x64\duckstation-libretro-*
"C:\Program Files\7-Zip\7z.exe" a -r duckstation_libretro.dll.zip ./bin/x64/duckstation_libretro.dll
del /Q bin\x64\duckstation_libretro.dll
- name: Upload release artifact
uses: actions/upload-artifact@v1
with:
name: "windows-x64"
path: "duckstation_libretro.dll.zip"
- name: Create release archive - name: Create release archive
shell: cmd shell: cmd
@ -57,6 +44,35 @@ jobs:
path: "duckstation-windows-x64-release.7z" path: "duckstation-windows-x64-release.7z"
windows-libretro-build:
runs-on: windows-2019
steps:
- uses: actions/checkout@v2.3.1
with:
fetch-depth: 0
- name: Compile release build
shell: cmd
run: |
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
mkdir build
cd build
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_LIBRETRO_CORE=ON -DCMAKE_C_COMPILER:FILEPATH="%VCToolsInstallDir%\bin\HostX64\x64\cl.exe" -DCMAKE_CXX_COMPILER:FILEPATH="%VCToolsInstallDir%\bin\HostX64\x64\cl.exe" ..
ninja
- name: Create libretro core archive
shell: cmd
run: |
cd build
"C:\Program Files\7-Zip\7z.exe" a -r duckstation_libretro.dll.zip ./duckstation_libretro.dll
- name: Upload release artifact
uses: actions/upload-artifact@v1
with:
name: "windows-libretro-x64"
path: "build/duckstation_libretro.dll.zip"
linux-build: linux-build:
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
steps: steps:
@ -139,7 +155,7 @@ jobs:
create-release: create-release:
needs: [windows-build, linux-build, linux-libretro-build] needs: [windows-build, windows-libretro-build, linux-build, linux-libretro-build]
runs-on: "ubuntu-latest" runs-on: "ubuntu-latest"
if: github.ref == 'refs/heads/master' if: github.ref == 'refs/heads/master'
steps: steps:
@ -148,6 +164,11 @@ jobs:
with: with:
name: "windows-x64" name: "windows-x64"
- name: Download Windows libretro x64 Artifact
uses: actions/download-artifact@v1
with:
name: "windows-libretro-x64"
- name: Download SDL AppImage Artifact - name: Download SDL AppImage Artifact
uses: actions/download-artifact@v1 uses: actions/download-artifact@v1
with: with:
@ -181,7 +202,7 @@ jobs:
title: "Latest Development Build" title: "Latest Development Build"
files: | files: |
windows-x64/duckstation-windows-x64-release.7z windows-x64/duckstation-windows-x64-release.7z
windows-x64/duckstation_libretro.dll.zip windows-libretro-x64/duckstation_libretro.dll.zip
linux-x64-appimage-sdl/duckstation-sdl-x64.AppImage linux-x64-appimage-sdl/duckstation-sdl-x64.AppImage
linux-x64-appimage-sdl-zsync/duckstation-sdl-x64.AppImage.zsync linux-x64-appimage-sdl-zsync/duckstation-sdl-x64.AppImage.zsync
linux-x64-appimage-qt/duckstation-qt-x64.AppImage linux-x64-appimage-qt/duckstation-qt-x64.AppImage

View file

@ -50,7 +50,7 @@ if(BUILD_LIBRETRO_CORE)
if(USE_X11) if(USE_X11)
set(USE_X11 OFF) set(USE_X11 OFF)
endif() endif()
if(USE_EGL) if(BUILD_LIBRETRO_CORE AND USE_EGL)
set(USE_EGL OFF) set(USE_EGL OFF)
endif() endif()
@ -187,6 +187,6 @@ enable_testing()
add_subdirectory(dep) add_subdirectory(dep)
add_subdirectory(src) add_subdirectory(src)
if(ANDROID) if(ANDROID AND NOT BUILD_LIBRETRO_CORE)
add_subdirectory(android/app/src/cpp) add_subdirectory(android/app/src/cpp)
endif() endif()

View file

@ -204,11 +204,18 @@ Prebuilt binaries for Windows and 64-bit Linux can be found on the releases page
- 64-bit Windows: https://github.com/stenzek/duckstation/releases/download/latest/duckstation_libretro.dll.zip - 64-bit Windows: https://github.com/stenzek/duckstation/releases/download/latest/duckstation_libretro.dll.zip
- 64-bit Linux: https://github.com/stenzek/duckstation/releases/download/latest/duckstation_libretro.so.zip - 64-bit Linux: https://github.com/stenzek/duckstation/releases/download/latest/duckstation_libretro.so.zip
To use, extract the `dll` or `so` into your RetroArch or other libretro frontend's `cores` directory, load the DuckStation core, and pick any bin/cue/chd-format image as content.
To build on Windows, simply compile in the same manner as the normal frontend build. A libretro DLL will be built automatically and placed in the output directory. This will be based on the configuration you selected, you can load it directly into RetroArch, or rename it to `duckstation_libretro.dll`. To build on Windows, simply compile in the same manner as the normal frontend build. A libretro DLL will be built automatically and placed in the output directory. This will be based on the configuration you selected, you can load it directly into RetroArch, or rename it to `duckstation_libretro.dll`.
To build on Linux, follow the same instructions as for a normal build, but for cmake use `cmake -DBUILD_LIBRETRO_CORE=ON ..`. The shared library can be found in `bin/duckstation_libretro.so`. Alternatively, you can build via cmake using the following commands from a `x64 Native Tools Command Prompt for VS 2019`:
- mkdir build
- cd build
- cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_LIBRETRO_CORE=ON ..
Currently there is no core info file for DuckStation, so if you want to use it with RetroArch, you must manually load the core, and then content via the File menu. Hopefully we can change this in the future. You should then have a file named `duckstation_libretro.dll` which can be loaded as a core.
To build on Linux, follow the same instructions as for a normal build, but for cmake use `cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_LIBRETRO_CORE=ON ..`. The shared library will be named `duckstation_libretro.so` in the current directory.
## Tests ## Tests
- Passes amidog's CPU and GTE tests in both interpreter and recompiler modes, partial passing of CPX tests - Passes amidog's CPU and GTE tests in both interpreter and recompiler modes, partial passing of CPX tests

View file

@ -141,7 +141,7 @@ if(USE_EGL)
gl/context_egl_x11.h gl/context_egl_x11.h
) )
endif() endif()
if(ANDROID) if(ANDROID AND USE_EGL)
target_sources(common PRIVATE target_sources(common PRIVATE
gl/context_egl_android.cpp gl/context_egl_android.cpp
gl/context_egl_android.h gl/context_egl_android.h

View file

@ -75,8 +75,10 @@ std::unique_ptr<GL::Context> Context::Create(const WindowInfo& wi, const Version
#elif defined(__APPLE__) #elif defined(__APPLE__)
context = ContextAGL::Create(wi, versions_to_try, num_versions_to_try); context = ContextAGL::Create(wi, versions_to_try, num_versions_to_try);
#elif defined(ANDROID) #elif defined(ANDROID)
#ifdef USE_EGL
context = ContextEGLAndroid::Create(wi, versions_to_try, num_versions_to_try); context = ContextEGLAndroid::Create(wi, versions_to_try, num_versions_to_try);
#else #endif
#elif defined(USE_X11)
if (wi.type == WindowInfo::Type::X11) if (wi.type == WindowInfo::Type::X11)
{ {
#ifdef USE_EGL #ifdef USE_EGL

View file

@ -28,4 +28,9 @@ set_target_properties(duckstation_libretro PROPERTIES PREFIX "")
# drop in the build directory # drop in the build directory
set_target_properties(duckstation_libretro PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}") set_target_properties(duckstation_libretro PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")
set_target_properties(duckstation_libretro PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")
# for android, suffix _android
if(ANDROID)
set_target_properties(duckstation_libretro PROPERTIES OUTPUT_NAME "duckstation_libretro_android")
endif()