zink: Fix MacOS compiling issues
Add a moltenvk-dir build option to supply the MacOS Vulkan SDK MoltenVK location. Force compiler, for zink only, into object-c mode when MoltenVK is used to allow for the MacOS ioSurface and CAMetalLayer types that the headers expose. Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11129>
This commit is contained in:
parent
3102892fb8
commit
a2d6a5f885
|
@ -51,6 +51,7 @@ pre_args = [
|
|||
c_args = []
|
||||
cpp_args = []
|
||||
|
||||
with_moltenvk_dir = get_option('moltenvk-dir')
|
||||
with_vulkan_icd_dir = get_option('vulkan-icd-dir')
|
||||
with_tests = get_option('build-tests')
|
||||
with_aco_tests = get_option('build-aco-tests')
|
||||
|
|
|
@ -223,6 +223,12 @@ option(
|
|||
value : '',
|
||||
description : 'Location relative to prefix to put vulkan icds on install. Default: $datadir/vulkan/icd.d'
|
||||
)
|
||||
option(
|
||||
'moltenvk-dir',
|
||||
type : 'string',
|
||||
value : '',
|
||||
description : 'Location of the MoltenVk SDK. Default: '
|
||||
)
|
||||
option(
|
||||
'vulkan-layers',
|
||||
type : 'array',
|
||||
|
|
|
@ -74,15 +74,24 @@ zink_nir_algebraic_c = custom_target(
|
|||
)
|
||||
|
||||
zink_c_args = []
|
||||
inc_zink_vk = []
|
||||
|
||||
if with_swrast_vk
|
||||
zink_c_args += '-DZINK_WITH_SWRAST_VK'
|
||||
endif
|
||||
|
||||
# MoltenVK options
|
||||
if with_moltenvk_dir != ''
|
||||
inc_zink_vk = [inc_zink_vk, include_directories( join_paths(with_moltenvk_dir, 'include') )]
|
||||
zink_c_args += ['-x','objective-c'] # Put compiler into objective-C mode to allow for MacOS types, like IOSurface and CAMetalLayer
|
||||
zink_c_args += ['-iframework' , 'Foundation']
|
||||
endif
|
||||
|
||||
libzink = static_library(
|
||||
'zink',
|
||||
[files_libzink, zink_device_info, zink_instance, zink_nir_algebraic_c],
|
||||
gnu_symbol_visibility : 'hidden',
|
||||
include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux, inc_vulkan_wsi, inc_vulkan_util],
|
||||
include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux, inc_vulkan_wsi, inc_vulkan_util, inc_zink_vk],
|
||||
dependencies: [dep_vulkan, idep_nir_headers, idep_mesautil],
|
||||
c_args: zink_c_args,
|
||||
)
|
||||
|
|
|
@ -14,6 +14,9 @@
|
|||
#include "util/u_debug.h"
|
||||
#include "util/set.h"
|
||||
|
||||
#ifdef VK_USE_PLATFORM_METAL_EXT
|
||||
#include "QuartzCore/CAMetalLayer.h"
|
||||
#endif
|
||||
#include "wsi_common.h"
|
||||
|
||||
void
|
||||
|
|
|
@ -29,6 +29,9 @@
|
|||
#include "zink_program.h"
|
||||
#include "zink_screen.h"
|
||||
|
||||
#ifdef VK_USE_PLATFORM_METAL_EXT
|
||||
#include "QuartzCore/CAMetalLayer.h"
|
||||
#endif
|
||||
#include "vulkan/wsi/wsi_common.h"
|
||||
|
||||
#include "util/slab.h"
|
||||
|
|
Loading…
Reference in New Issue