meson: Add Haiku platform support v4

Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
This commit is contained in:
Alexander von Gluck IV 2018-02-16 16:56:31 -06:00
parent 7b283544dc
commit 834d221512
11 changed files with 209 additions and 17 deletions

View File

@ -22,6 +22,7 @@ inc_drm_uapi = include_directories('drm-uapi')
inc_vulkan = include_directories('vulkan')
inc_d3d9 = include_directories('D3D9')
inc_gl_internal = include_directories('GL/internal')
inc_haikugl = include_directories('HaikuGL')
if with_gles1
install_headers(
@ -80,6 +81,13 @@ if with_gallium_st_nine
)
endif
if with_platform_haiku
install_headers(
'HaikuGL/GLRenderer.h', 'HaikuGL/GLView.h', 'HaikuGL/OpenGLKit.h',
subdir : 'opengl',
)
endif
# Only install the headers if we are building a stand alone implementation and
# not an ICD enabled implementation
if with_gallium_opencl and not with_opencl_icd

View File

@ -103,7 +103,7 @@ if _drivers == 'auto'
else
error('Unknown architecture. Please pass -Ddri-drivers to set driver options. Patches gladly accepted to fix this.')
endif
elif ['darwin', 'windows', 'cygwin'].contains(host_machine.system())
elif ['darwin', 'windows', 'cygwin', 'haiku'].contains(host_machine.system())
# only swrast would make sense here, but gallium swrast is a much better default
_drivers = ''
else
@ -148,7 +148,7 @@ if _drivers == 'auto'
else
error('Unknown architecture. Please pass -Dgallium-drivers to set driver options. Patches gladly accepted to fix this.')
endif
elif ['darwin', 'windows', 'cygwin'].contains(host_machine.system())
elif ['darwin', 'windows', 'cygwin', 'haiku'].contains(host_machine.system())
_drivers = 'swrast'
else
error('Unknown OS. Please pass -Dgallium-drivers to set driver options. Patches gladly accepted to fix this.')
@ -185,7 +185,7 @@ if _vulkan_drivers == 'auto'
else
error('Unknown architecture. Please pass -Dvulkan-drivers to set driver options. Patches gladly accepted to fix this.')
endif
elif ['darwin', 'windows', 'cygwin'].contains(host_machine.system())
elif ['darwin', 'windows', 'cygwin', 'haiku'].contains(host_machine.system())
# No vulkan driver supports windows or macOS currently
_vulkan_drivers = ''
else
@ -246,6 +246,8 @@ if _platforms == 'auto'
_platforms = 'x11,wayland,drm,surfaceless'
elif ['darwin', 'windows', 'cygwin'].contains(host_machine.system())
_platforms = 'x11,surfaceless'
elif ['haiku'].contains(host_machine.system())
_platforms = 'haiku'
else
error('Unknown OS. Please pass -Dplatforms to set platforms. Patches gladly accepted to fix this.')
endif
@ -256,6 +258,7 @@ if _platforms != ''
with_platform_x11 = _split.contains('x11')
with_platform_wayland = _split.contains('wayland')
with_platform_drm = _split.contains('drm')
with_platform_haiku = _split.contains('haiku')
with_platform_surfaceless = _split.contains('surfaceless')
egl_native_platform = _split[0]
endif
@ -264,6 +267,8 @@ with_glx = get_option('glx')
if with_glx == 'auto'
if with_dri
with_glx = 'dri'
elif with_platform_haiku
with_glx = 'disabled'
elif with_gallium
# Even when building just gallium drivers the user probably wants dri
with_glx = 'dri'
@ -379,7 +384,7 @@ if with_any_vk and (with_platform_x11 and not with_dri3)
error('Vulkan drivers require dri3 for X11 support')
endif
if with_dri or with_gallium
if with_glx == 'disabled' and not with_egl
if with_glx == 'disabled' and not with_egl and not with_platform_haiku
error('building dri or gallium drivers require at least one window system')
endif
endif
@ -640,6 +645,9 @@ if with_platform_android
]
pre_args += '-DHAVE_ANDROID_PLATFORM'
endif
if with_platform_haiku
pre_args += '-DHAVE_HAIKU_PLATFORM'
endif
prog_python2 = find_program('python2')
has_mako = run_command(prog_python2, '-c', 'import mako')

View File

@ -21,9 +21,8 @@
c_args_for_egl = []
link_for_egl = []
deps_for_egl = []
incs_for_egl = [
inc_include, inc_src, inc_loader, inc_gbm, include_directories('main'),
]
incs_for_egl = [inc_include, inc_src, include_directories('main')]
files_egl = files(
'main/eglapi.c',
'main/eglapi.h',
@ -53,9 +52,6 @@ files_egl = files(
'main/eglsync.h',
'main/eglentrypoint.h',
'main/egltypedefs.h',
'drivers/dri2/egl_dri2.c',
'drivers/dri2/egl_dri2.h',
'drivers/dri2/egl_dri2_fallbacks.h',
)
g_egldispatchstubs_c = custom_target(
@ -86,6 +82,18 @@ g_egldispatchstubs_h = custom_target(
capture : true,
)
if with_dri2
files_egl += files(
'drivers/dri2/egl_dri2.c',
'drivers/dri2/egl_dri2.h',
'drivers/dri2/egl_dri2_fallbacks.h',
)
c_args_for_egl += [
'-DDEFAULT_DRIVER_DIR="@0@"'.format(dri_search_path),
'-D_EGL_BUILT_IN_DRIVER_DRI2',
]
endif
if with_platform_x11
files_egl += files('drivers/dri2/platform_x11.c')
if with_dri3
@ -96,8 +104,9 @@ if with_platform_x11
endif
if with_platform_drm
files_egl += files('drivers/dri2/platform_drm.c')
link_for_egl += libgbm
incs_for_egl += include_directories('../gbm/main')
link_for_egl += [libloader, libgbm, libxmlconfig]
incs_for_egl += [inc_loader, inc_gbm, include_directories('../gbm/main')]
deps_for_egl += dep_libdrm
endif
if with_platform_surfaceless
files_egl += files('drivers/dri2/platform_surfaceless.c')
@ -119,6 +128,15 @@ if with_platform_android
deps_for_egl += dep_android
files_egl += files('drivers/dri2/platform_android.c')
endif
if with_platform_haiku
incs_for_egl += inc_haikugl
c_args_for_egl += [
'-D_EGL_BUILT_IN_DRIVER_HAIKU',
]
files_egl += files('drivers/haiku/egl_haiku.cpp')
link_for_egl += libgl
deps_for_egl += cpp.find_library('be')
endif
# TODO: glvnd
@ -146,8 +164,6 @@ libegl = shared_library(
c_args : [
c_vis_args,
c_args_for_egl,
'-DDEFAULT_DRIVER_DIR="@0@"'.format(dri_search_path),
'-D_EGL_BUILT_IN_DRIVER_DRI2',
'-D_EGL_NATIVE_PLATFORM=_EGL_PLATFORM_@0@'.format(egl_native_platform.to_upper()),
],
include_directories : incs_for_egl,

View File

@ -40,6 +40,9 @@ else
libswkmsdri = []
endif
subdir('winsys/sw/wrapper')
if with_platform_haiku
subdir('winsys/sw/hgl')
endif
if with_gallium_swr
if meson.version().version_compare('< 0.44.0')
error('SWR requires meson 0.44.0 or greater.')
@ -153,6 +156,9 @@ endif
if with_gallium_st_nine
subdir('state_trackers/nine')
endif
if with_platform_haiku
subdir('state_trackers/hgl')
endif
if with_gallium_opencl
# TODO: this isn't really clover specific, but ATM clover is the only
# consumer
@ -192,6 +198,9 @@ endif
if with_gallium_xa
subdir('targets/xa')
endif
if with_platform_haiku
subdir('targets/haiku-softpipe')
endif
if with_gallium_st_nine
subdir('targets/d3dadapter9')
endif

View File

@ -0,0 +1,41 @@
# Copyright © 2017 Dylan Baker
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
files_libsthgl = files(
'bitmap_wrapper.cpp',
'bitmap_wrapper.h',
'hgl_context.h',
'hgl.c',
)
libsthgl_c_args = []
if with_gallium_softpipe
libsthgl_c_args += '-DGALLIUM_SOFTPIPE'
endif
libsthgl = static_library(
'sthgl',
files_libsthgl,
include_directories : [
inc_include, inc_haikugl, inc_util, inc_mesa, inc_mapi, inc_src,
inc_gallium, inc_gallium_aux
],
c_args : [c_vis_args, libsthgl_c_args],
)

View File

@ -0,0 +1,40 @@
# Copyright © 2017 Dylan Baker
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
libswpipe = shared_library(
'swpipe',
files('SoftwareRenderer.cpp', 'GalliumContext.cpp'),
include_directories : [
inc_common, inc_util, inc_haikugl, inc_gallium_drivers, inc_gallium_winsys,
include_directories('../../state_trackers/hgl'),
include_directories('/boot/system/develop/headers/private')
],
c_args : [c_vis_args],
cpp_args : [cpp_vis_args],
link_args : [ld_args_bsymbolic, ld_args_gc_sections],
link_with : [
libglapi, libswhgl, libsthgl, libtrace, librbug, libmesa_util, libcompiler,
libmesa_gallium, libglsl, libnir, libgallium, libgl
],
dependencies : [
driver_swrast, cpp.find_library('be'), cpp.find_library('translation'),
cpp.find_library('network'), dep_unwind
]
)

View File

@ -0,0 +1,29 @@
# Copyright © 2017 Dylan Baker
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
libswhgl = static_library(
'swhgl',
files('hgl_sw_winsys.c'),
c_args : c_vis_args,
include_directories : [inc_gallium, inc_include, inc_src, inc_gallium_aux,
include_directories('../../../state_trackers/hgl')
],
build_by_default : false,
)

36
src/hgl/meson.build Normal file
View File

@ -0,0 +1,36 @@
# Copyright © 2017 Intel Corporation
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
libgl = shared_library(
'GL',
files(
'GLView.cpp', 'GLRenderer.cpp', 'GLRendererRoster.cpp', 'GLDispatcher.cpp',
),
link_args : [ld_args_bsymbolic, ld_args_gc_sections],
include_directories : [
inc_src, inc_mapi, inc_mesa, inc_include, inc_glapi, inc_haikugl,
inc_gl_internal, include_directories('/system/develop/headers/private')
],
link_with : [libglapi_static, libglapi],
dependencies : cpp.find_library('be'),
install : true,
)
# TODO: We need some tests here

View File

@ -48,7 +48,7 @@ pkg.generate(
description : 'Mesa OpenGL ES 1.1 CM library',
version : meson.project_version(),
libraries : libglesv1_cm,
libraries_private : '-lm -ldl -lpthread -pthread',
libraries_private : gl_priv_libs,
)
if with_tests

View File

@ -48,7 +48,7 @@ pkg.generate(
description : 'Mesa OpenGL ES 2.0 library',
version : meson.project_version(),
libraries : libgles2,
libraries_private : '-lm -ldl -lpthread -pthread',
libraries_private : gl_priv_libs,
)
if with_tests

View File

@ -64,7 +64,12 @@ if with_dri_i965 or with_intel_vk
endif
subdir('mesa')
subdir('loader')
subdir('glx')
if with_platform_haiku
subdir('hgl')
endif
if with_glx != 'disabled'
subdir('glx')
endif
if with_gbm
subdir('gbm')
else