summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDylan Baker <[email protected]>2017-09-22 12:55:00 -0700
committerDylan Baker <[email protected]>2017-10-09 13:42:44 -0700
commita47c525f3281a2753180e076c7e9b7772aff8f06 (patch)
treea9a973252197dab9bcfdc0cb0731d2814f09646c /src
parent3218056e0eb375eeda470058d06add1532acd6d4 (diff)
meson: build glx
This gets GLX and the loader building. The resulting GLX and i965 have been tested on piglit and seem to work fine. This patch leaves a lot of todo's in it's wake, GLX is quite complicated, and the build options involved are many, and the goal at the moment is to get dri and gallium drivers building. v2: - fix typo "vaule" -> "value" - put the not on the correct element of the conditional - Put correct description of dri3 option in this patch not the next one (Eric A) - fix non glvnd version (Eric A) - build glx tests - move loader include variables to this patch (Eric A) v3: - set the version correctly for GL_LIB_NAME in libglx v4: - set pkgconfig private fields Signed-off-by: Dylan Baker <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/glx/meson.build207
-rw-r--r--src/glx/tests/meson.build49
-rw-r--r--src/loader/meson.build44
-rw-r--r--src/mapi/glapi/meson.build2
-rw-r--r--src/meson.build5
5 files changed, 304 insertions, 3 deletions
diff --git a/src/glx/meson.build b/src/glx/meson.build
new file mode 100644
index 00000000000..70718df4d35
--- /dev/null
+++ b/src/glx/meson.build
@@ -0,0 +1,207 @@
+# 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.
+
+# TODO:
+#subdir('windows')
+
+files_libglx = files(
+ 'clientattrib.c',
+ 'clientinfo.c',
+ 'compsize.c',
+ 'create_context.c',
+ 'eval.c',
+ 'glxclient.h',
+ 'glxcmds.c',
+ 'glxconfig.c',
+ 'glxconfig.h',
+ 'glxcurrent.c',
+ 'glx_error.c',
+ 'glx_error.h',
+ 'glxext.c',
+ 'glxextensions.c',
+ 'glxextensions.h',
+ 'glxhash.c',
+ 'glxhash.h',
+ 'glx_pbuffer.c',
+ 'glx_query.c',
+ 'indirect_glx.c',
+ 'indirect_init.h',
+ 'indirect_texture_compression.c',
+ 'indirect_transpose_matrix.c',
+ 'indirect_vertex_array.c',
+ 'indirect_vertex_array.h',
+ 'indirect_vertex_array_priv.h',
+ 'indirect_vertex_program.c',
+ 'indirect_window_pos.c',
+ 'packrender.h',
+ 'packsingle.h',
+ 'pixel.c',
+ 'pixelstore.c',
+ 'query_renderer.c',
+ 'render2.c',
+ 'renderpix.c',
+ 'single2.c',
+ 'singlepix.c',
+ 'vertarr.c',
+)
+
+extra_libs_libglx = []
+
+if with_dri
+ files_libglx += files(
+ 'dri_common.c',
+ 'dri_common.h',
+ 'dri_common_query_renderer.c',
+ 'dri_common_interop.c',
+ 'xfont.c',
+ 'drisw_glx.c',
+ 'drisw_priv.h',
+ )
+endif
+
+# dri2
+if with_dri and with_dri_platform == 'drm' and dep_libdrm.found()
+ files_libglx += files(
+ 'dri2.c',
+ 'dri2_glx.c',
+ 'dri2.h',
+ 'dri2_priv.h',
+ 'dri_glx.c',
+ 'dri_sarea.h',
+ 'XF86dri.c',
+ 'xf86dri.h',
+ 'xf86dristr.h',
+ )
+endif
+
+if with_dri3
+ files_libglx += files('dri3_glx.c', 'dri3_priv.h')
+endif
+
+if with_appledri
+ files_libglx += files('applegl_glx.c')
+elif with_windowsdri
+ files_libglx += files('driwindows_glx.c')
+ # TODO
+ #extra_libs_libglx += [
+ #libwindowsdri,
+ #libwindowsglx,
+ #]
+endif
+
+dri_driver_dir = join_paths(get_option('prefix'), get_option('libdir'), 'dri')
+if not with_glvnd
+ gl_lib_name = 'GL'
+ gl_lib_version = '1.2.0'
+else
+ gl_lib_name = 'GLX_mesa'
+ gl_lib_version = '0'
+ files_libglx += files(
+ 'g_glxglvnddispatchfuncs.c',
+ 'g_glxglvnddispatchindices.h',
+ 'glxglvnd.c',
+ 'glxglvnd.h',
+ 'glxglvnddispatchfuncs.h',
+ )
+endif
+
+gl_lib_cargs = [
+ '-D_REENTRANT', '-DDEFAULT_DRIVER_DIR="@0@"'.format(dri_driver_dir),
+]
+
+if dep_xf86vm != [] and dep_xf86vm.found()
+ gl_lib_cargs += '-DHAVE_XF86VIDMODE'
+endif
+
+libglx = static_library(
+ 'glx',
+ [files_libglx, glx_generated],
+ include_directories : [
+ inc_common, inc_glapi, inc_loader,
+ include_directories('../../include/GL/internal'),
+ ],
+ c_args : [c_vis_args, gl_lib_cargs,
+ '-DGL_LIB_NAME="lib@[email protected].@1@"'.format(gl_lib_name, gl_lib_version.split('.')[0])],
+ link_with : [libloader, libloader_dri3_helper, libmesa_util, libxmlconfig],
+ dependencies : [dep_libdrm, dep_dri2proto, dep_glproto, dep_x11, dep_glvnd],
+ build_by_default : false,
+)
+
+# workaround for bug #2180
+dummy_c = custom_target(
+ 'dummy_c',
+ output : 'dummy.c',
+ command : [prog_touch, '@OUTPUT@'],
+)
+
+if with_glx == 'dri'
+ libgl = shared_library(
+ gl_lib_name,
+ dummy_c, # workaround for bug #2180
+ include_directories : [
+ inc_common, inc_glapi, inc_loader,
+ include_directories('../../include/GL/internal'),
+ ],
+ link_with : [libglapi_static, libglapi],
+ link_whole : libglx,
+ link_args : [ld_args_bsymbolic, ld_args_gc_sections],
+ dependencies : [dep_libdrm, dep_dl, dep_m, dep_thread, dep_x11,
+ dep_xcb_dri2, dep_xcb_dri3],
+ version : gl_lib_version,
+ install : true,
+ )
+
+ gl_priv_reqs = [
+ 'x11', 'xext', 'xdamage >= 1.1', 'xfixes', 'x11-xcb', 'xcb',
+ 'xcb-glx >= 1.8.1', 'libdrm >= 2.4.75',
+ ]
+ if dep_xf86vm.found()
+ gl_priv_reqs += 'xf86vm'
+ endif
+ if with_dri_platform == 'drm'
+ gl_priv_reqs += 'xcb-dri2 >= 1.8'
+ endif
+
+ gl_priv_libs = []
+ if dep_thread.found()
+ gl_priv_libs += ['-lpthread', '-pthread']
+ endif
+ if dep_m.found()
+ gl_priv_libs += '-lm'
+ endif
+ if dep_dl.found()
+ gl_priv_libs += '-ldl'
+ endif
+
+ pkg.generate(
+ name : 'gl',
+ filebase : 'gl',
+ description : 'Mesa OpenGL Library',
+ version : meson.project_version(),
+ libraries : libgl,
+ libraries_private : gl_priv_libs,
+ requires_private : gl_priv_reqs,
+ variables : ['glx_tls=yes'],
+ )
+endif
+
+if with_tests
+ subdir('tests')
+endif
diff --git a/src/glx/tests/meson.build b/src/glx/tests/meson.build
new file mode 100644
index 00000000000..d81b76906da
--- /dev/null
+++ b/src/glx/tests/meson.build
@@ -0,0 +1,49 @@
+# 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.
+
+if with_shared_glapi
+ files_glx_test = files(
+ 'clientinfo_unittest.cpp',
+ 'create_context_unittest.cpp',
+ 'enum_sizes.cpp',
+ 'fake_glx_screen.cpp',
+ 'fake_glx_screen.h',
+ 'indirect_api.cpp',
+ 'mock_xdisplay.h',
+ 'query_renderer_unittest.cpp',
+ )
+ if with_dri2
+ files_glx_test += files('query_renderer_implementation_unittest.cpp')
+ endif
+
+ glx_test = executable(
+ 'glx-test',
+ [files_glx_test, glx_indirect_size_h],
+ link_with : [libglx, libglapi],
+ include_directories : [
+ include_directories('..', '../../../include/GL/internal'),
+ inc_src, inc_include, inc_mesa, inc_mapi,
+ ],
+ dependencies : [dep_libdrm, dep_thread, idep_gtest]
+ )
+
+ test('glx-test', glx_test)
+ test('glx-dispatch-index-check', find_program('dispatch-index-check'))
+endif
diff --git a/src/loader/meson.build b/src/loader/meson.build
new file mode 100644
index 00000000000..425620372aa
--- /dev/null
+++ b/src/loader/meson.build
@@ -0,0 +1,44 @@
+# 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.
+
+inc_loader = include_directories('.')
+
+if with_platform_x11 and with_dri3
+ libloader_dri3_helper = static_library(
+ 'loader_dri3_helper',
+ ['loader_dri3_helper.c', 'loader_dri3_helper.h'],
+ c_args : c_vis_args,
+ include_directories : inc_include,
+ dependencies : [dep_xcb_dri3, dep_libdrm],
+ build_by_default : false,
+ )
+else
+ libloader_dri3_helper = []
+endif
+
+libloader = static_library(
+ 'loader',
+ ['loader.c', 'loader.h', 'pci_id_driver_map.c', 'pci_id_driver_map.h',
+ xmlpool_options_h],
+ c_args : [c_vis_args, '-DUSE_DRICONF'],
+ include_directories : [inc_include, inc_src, inc_util],
+ dependencies : dep_libdrm,
+ build_by_default : false,
+)
diff --git a/src/mapi/glapi/meson.build b/src/mapi/glapi/meson.build
index d09cf94e36f..d3e070d0d1a 100644
--- a/src/mapi/glapi/meson.build
+++ b/src/mapi/glapi/meson.build
@@ -18,6 +18,8 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
+inc_glapi = include_directories('.')
+
static_glapi_files = []
static_glapi_args = []
diff --git a/src/meson.build b/src/meson.build
index 8e0860bb5a5..f49ad9e0e7e 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -44,7 +44,6 @@ subdir('util')
subdir('mapi/glapi/gen')
subdir('mapi')
# TODO: opengl
-# TODO: glx
# TODO: osmesa
subdir('compiler')
subdir('egl/wayland/wayland-drm')
@@ -53,8 +52,8 @@ subdir('amd')
subdir('intel')
# TODO: vc4
subdir('mesa')
+subdir('loader')
+subdir('glx')
# TODO: dri_glx
-# TODO: gbm
# TODO: egl
-# TODO: radv
# TODO: gallium