Skip to content

Commit

Permalink
Merge pull request #277 from ElectrodeYT/vulkan-libs-1
Browse files Browse the repository at this point in the history
  • Loading branch information
Dennisbonke authored Oct 20, 2023
2 parents ee897cf + d17b857 commit 1d11513
Show file tree
Hide file tree
Showing 4 changed files with 126 additions and 0 deletions.
32 changes: 32 additions & 0 deletions bootstrap.d/dev-util.yml
Original file line number Diff line number Diff line change
Expand Up @@ -220,3 +220,35 @@ packages:
- args: ['make', 'install']
environ:
DESTDIR: '@THIS_COLLECT_DIR@'

- name: vulkan-headers
architecture: '@OPTION:arch@'
metadata:
summary: Vulkan Header files and API registry
description: This package provides the Vulkan header files. This is needed to compile Vulkan applications.
spdx: 'MIT'
website: 'https://github.com/KhronosGroup/Vulkan-Headers'
maintainer: "Alexander Richards <[email protected]>"
categories: ['dev-util']
source:
subdir: 'ports'
git: 'https://github.com/KhronosGroup/Vulkan-Headers.git'
tag: 'v1.3.269'
version: '1.3.269'
tools_required:
- system-gcc
- host-cmake
configure:
- args:
- 'cmake'
- '-GNinja'
- '-DCMAKE_TOOLCHAIN_FILE=@SOURCE_ROOT@/scripts/CMakeToolchain-@OPTION:[email protected]'
- '-DCMAKE_PREFIX=/usr'
- '-DCMAKE_INSTALL_PREFIX=/usr'
- '-DBUILD_TESTS=OFF'
- '@THIS_SOURCE_DIR@/'
build:
- args: ['ninja', 'install']
environ:
DESTDIR: '@THIS_COLLECT_DIR@'
quiet: true
45 changes: 45 additions & 0 deletions bootstrap.d/media-libs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -871,6 +871,51 @@ packages:
DESTDIR: '@THIS_COLLECT_DIR@'
quiet: true

- name: vulkan-loader
architecture: '@OPTION:arch@'
metadata:
summary: Vulkan Installable Client Driver (ICD) Loader
description: This package provides the Vulkan Installable Client Driver (ICD) Loader. This allows the vulkan driver to be chosen at run time, rather than requiring static configuration.
spdx: 'Apache-2.0'
website: 'https://github.com/KhronosGroup/Vulkan-Loader'
maintainer: "Alexander Richards <[email protected]>"
categories: ['media-libs']
source:
subdir: 'ports'
git: 'https://github.com/KhronosGroup/Vulkan-Loader.git'
tag: 'v1.3.268'
version: '1.3.268'
tools_required:
- system-gcc
- host-cmake
pkgs_required:
- mlibc
- libx11
- libxrandr
- wayland
- wayland-protocols
# This is only required for building.
- vulkan-headers
configure:
- args:
- 'cmake'
- '-GNinja'
- '-DCMAKE_TOOLCHAIN_FILE=@SOURCE_ROOT@/scripts/CMakeToolchain-@OPTION:[email protected]'
- '-DCMAKE_INSTALL_PREFIX=/usr'
- '-DBUILD_TESTS=OFF'
- '-DBUILD_WSI_WAYLAND_SUPPORT=ON'
- '-DBUILD_WSI_XCB_SUPPORT=ON'
- '-DBUILD_WSI_XLIB_SUPPORT=ON'
- '-DVULKAN_HEADERS_INSTALL_DIR=@THIS_COLLECT_DIR@/usr'
- '-DENABLE_WERROR=OFF'
- '@THIS_SOURCE_DIR@/'
build:
- args: ['ninja']
- args: ['ninja', 'install']
environ:
DESTDIR: '@THIS_COLLECT_DIR@'
quiet: true

- name: sdl2
architecture: '@OPTION:arch@'
metadata:
Expand Down
48 changes: 48 additions & 0 deletions patches/vulkan-loader/0001-Add-managarm-support.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
From ac7c0610f26473e9fb67b158fe5a627e357d9133 Mon Sep 17 00:00:00 2001
From: Alexander <[email protected]>
Date: Fri, 20 Oct 2023 18:57:29 +0200
Subject: [PATCH] Add managarm support

---
CMakeLists.txt | 2 +-
loader/vk_loader_platform.h | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 16e65a6..d76b471 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -100,7 +100,7 @@ elseif(ANDROID)
message(FATAL_ERROR "Android build not supported!")
elseif(APPLE)
target_compile_definitions(platform_wsi INTERFACE VK_USE_PLATFORM_MACOS_MVK VK_USE_PLATFORM_METAL_EXT)
-elseif(CMAKE_SYSTEM_NAME MATCHES "Linux|BSD|DragonFly|GNU")
+elseif(CMAKE_SYSTEM_NAME MATCHES "Linux|BSD|DragonFly|GNU|managarm")
option(BUILD_WSI_XCB_SUPPORT "Build XCB WSI support" ON)
option(BUILD_WSI_XLIB_SUPPORT "Build Xlib WSI support" ON)
option(BUILD_WSI_WAYLAND_SUPPORT "Build Wayland WSI support" ON)
diff --git a/loader/vk_loader_platform.h b/loader/vk_loader_platform.h
index 3a8cafb..d633fa2 100644
--- a/loader/vk_loader_platform.h
+++ b/loader/vk_loader_platform.h
@@ -42,7 +42,7 @@

// Set of platforms with a common set of functionality which is queried throughout the program
#if defined(__linux__) || defined(__APPLE__) || defined(__Fuchsia__) || defined(__QNX__) || defined(__FreeBSD__) || \
- defined(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFly__) || defined(__GNU__)
+ defined(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFly__) || defined(__GNU__) || defined(__managarm__)
#define COMMON_UNIX_PLATFORMS 1
#else
#define COMMON_UNIX_PLATFORMS 0
@@ -266,7 +266,7 @@ static inline char *loader_platform_dirname(char *path) { return dirname(path);

// loader_platform_executable_path finds application path + name.
// Path cannot be longer than 1024, returns NULL if it is greater than that.
-#if defined(__linux__) || defined(__GNU__)
+#if defined(__linux__) || defined(__GNU__) || defined(__managarm__)
static inline char *loader_platform_executable_path(char *buffer, size_t size) {
ssize_t count = readlink("/proc/self/exe", buffer, size);
if (count == -1) return NULL;
--
2.42.0

1 change: 1 addition & 0 deletions scripts/CMakeToolchain-x86_64-managarm.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

set(CMAKE_SYSTEM_NAME managarm)
set(CMAKE_SYSTEM_PROCESSOR x86_64)

set(CMAKE_FIND_ROOT_PATH $ENV{XBSTRAP_SYSROOT_DIR})

Expand Down

0 comments on commit 1d11513

Please sign in to comment.