build: Switch to build KosmicKrisp from source (#4580)

This commit is contained in:
squidbus 2026-06-15 03:28:24 -07:00 committed by GitHub
parent 6a20ebacde
commit 7de583b4c3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 59 additions and 8 deletions

View File

@ -74,7 +74,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [windows-latest, ubuntu-latest, macos-latest] os: [windows-latest, ubuntu-latest, macos-26]
include: include:
- os: windows-latest - os: windows-latest
compiler_cxx: clang-cl compiler_cxx: clang-cl
@ -82,7 +82,7 @@ jobs:
- os: ubuntu-latest - os: ubuntu-latest
compiler_cxx: clang++ compiler_cxx: clang++
compiler_c: clang compiler_c: clang
- os: macos-latest - os: macos-26
compiler_cxx: clang++ compiler_cxx: clang++
compiler_c: clang compiler_c: clang
@ -187,7 +187,7 @@ jobs:
path: ${{github.workspace}}/build/shadPS4.exe path: ${{github.workspace}}/build/shadPS4.exe
macos-sdl: macos-sdl:
runs-on: macos-15 runs-on: macos-26
needs: get-info needs: get-info
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@v6
@ -199,6 +199,11 @@ jobs:
with: with:
xcode-version: latest xcode-version: latest
- name: Install Build Dependencies
run: |
brew install cmake meson pkg-config llvm spirv-tools spirv-llvm-translator libclc
pip3 install --break-system-packages mako packaging pyyaml
- name: Cache CMake Configuration - name: Cache CMake Configuration
uses: actions/cache@v5 uses: actions/cache@v5
env: env:

5
.gitmodules vendored
View File

@ -150,3 +150,8 @@
[submodule "externals/mesa-kosmickrisp"] [submodule "externals/mesa-kosmickrisp"]
path = externals/mesa-kosmickrisp path = externals/mesa-kosmickrisp
url = https://github.com/shadexternals/mesa-kosmickrisp url = https://github.com/shadexternals/mesa-kosmickrisp
shallow = true
[submodule "externals/vulkan-loader"]
path = externals/vulkan-loader
url = https://github.com/KhronosGroup/Vulkan-Loader
shallow = true

View File

@ -33,6 +33,9 @@ if(UNIX AND NOT APPLE)
endif() endif()
endif() endif()
include(CMakeDependentOption)
cmake_dependent_option(ENABLE_SYSTEM_VULKAN "Enable the system Vulkan driver" OFF APPLE OFF)
option(ENABLE_DISCORD_RPC "Enable the Discord RPC integration" ON) option(ENABLE_DISCORD_RPC "Enable the Discord RPC integration" ON)
option(ENABLE_UPDATER "Enables the options to updater" ON) option(ENABLE_UPDATER "Enables the options to updater" ON)
option(ENABLE_TESTS "Build unit tests (requires GTest)" OFF) option(ENABLE_TESTS "Build unit tests (requires GTest)" OFF)
@ -1216,10 +1219,30 @@ if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
endif() endif()
if (APPLE) if (APPLE)
# Bundle Vulkan loader and KosmicKrisp driver with the emulator. if (NOT ENABLE_SYSTEM_VULKAN)
set_property(TARGET shadps4 APPEND PROPERTY BUILD_RPATH "@executable_path") # Bundle Vulkan loader and KosmicKrisp driver with the emulator.
add_subdirectory(externals/mesa-kosmickrisp) set_property(TARGET shadps4 APPEND PROPERTY BUILD_RPATH "@executable_path")
AddCopyKosmicKrisp(shadps4 ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR})
set(LOADER_DEST "${CMAKE_CURRENT_BINARY_DIR}/libvulkan.dylib")
set(DRIVER_DEST "${CMAKE_CURRENT_BINARY_DIR}/libvulkan_kosmickrisp.dylib")
set(ICD_DEST "${CMAKE_CURRENT_BINARY_DIR}/kosmickrisp_mesa_icd.json")
add_custom_command(
OUTPUT ${LOADER_DEST}
DEPENDS ${VULKAN_LOADER_PATH} vulkan
COMMAND ${CMAKE_COMMAND} -E copy ${VULKAN_LOADER_PATH} ${LOADER_DEST})
add_custom_command(
OUTPUT ${DRIVER_DEST}
DEPENDS ${VULKAN_DRIVER_PATH} kosmickrisp
COMMAND ${CMAKE_COMMAND} -E copy ${VULKAN_DRIVER_PATH} ${DRIVER_DEST})
add_custom_command(
OUTPUT ${ICD_DEST}
DEPENDS ${VULKAN_ICD_PATH} kosmickrisp
COMMAND ${CMAKE_COMMAND} -E copy ${VULKAN_ICD_PATH} ${ICD_DEST})
add_custom_target(CopyVulkanDriver DEPENDS ${LOADER_DEST} ${DRIVER_DEST} ${ICD_DEST})
add_dependencies(shadps4 CopyVulkanDriver)
endif()
if (ARCHITECTURE STREQUAL "x86_64") if (ARCHITECTURE STREQUAL "x86_64")
# Reserve system-managed memory space. # Reserve system-managed memory space.

View File

@ -25,6 +25,12 @@ Then, use Homebrew to install the required build tools:
brew install clang-format cmake brew install clang-format cmake
``` ```
Finally, install the dependencies required for building the KosmicKrisp Vulkan driver. You can skip this by setting `-DENABLE_SYSTEM_VULKAN=ON` when configuring, but you are responsible for having a compatible Vulkan setup installed.
```
brew install meson ninja pkg-config llvm spirv-tools spirv-llvm-translator libclc
pip3 install --break-system-packages mako packaging pyyaml
```
### Cloning and compiling: ### Cloning and compiling:
Clone the repository recursively: Clone the repository recursively:

View File

@ -87,6 +87,7 @@ endif()
if (NOT TARGET Vulkan::Headers) if (NOT TARGET Vulkan::Headers)
set(VULKAN_HEADERS_ENABLE_MODULE OFF) set(VULKAN_HEADERS_ENABLE_MODULE OFF)
add_subdirectory(vulkan-headers) add_subdirectory(vulkan-headers)
set(VulkanHeaders_VERSION "1.4.330")
endif() endif()
# VMA # VMA
@ -370,3 +371,13 @@ if (DEFINED SSL_DEPENDENCIES)
else() else()
message(STATUS "cpp-httplib: OpenSSL/LibreSSL not available — libSceHttp HTTPS will fall back to mock at runtime.") message(STATUS "cpp-httplib: OpenSSL/LibreSSL not available — libSceHttp HTTPS will fall back to mock at runtime.")
endif() endif()
# macOS Vulkan driver
if (APPLE AND NOT ENABLE_SYSTEM_VULKAN)
add_subdirectory(vulkan-loader)
set(VULKAN_LOADER_PATH "${CMAKE_CURRENT_BINARY_DIR}/vulkan-loader/loader/libvulkan.dylib" PARENT_SCOPE)
add_subdirectory(mesa-kosmickrisp)
set(VULKAN_DRIVER_PATH "${CMAKE_CURRENT_BINARY_DIR}/mesa-kosmickrisp/outputs/libvulkan_kosmickrisp.dylib" PARENT_SCOPE)
set(VULKAN_ICD_PATH "${CMAKE_CURRENT_BINARY_DIR}/mesa-kosmickrisp/outputs/kosmickrisp_mesa_icd.json" PARENT_SCOPE)
endif()

@ -1 +1 @@
Subproject commit 801e2de8ef2e3e89fd7ee1da52d67a1294ad6135 Subproject commit 73e64c4fc8468a786700ae4cec97aba4a341ff2b

1
externals/vulkan-loader vendored Submodule

@ -0,0 +1 @@
Subproject commit 466498bc64eb77955c3b782f0127520548224de0