Add meson build
authorTomi Valkeinen <tomi.valkeinen@ti.com>
Sat, 5 Sep 2020 07:54:18 +0000 (10:54 +0300)
committerTomi Valkeinen <tomi.valkeinen@ti.com>
Mon, 14 Sep 2020 08:40:34 +0000 (11:40 +0300)
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
.gitignore
kms++/meson.build [new file with mode: 0644]
kms++util/meson.build [new file with mode: 0644]
kmscube/meson.build [new file with mode: 0644]
meson.build [new file with mode: 0644]
meson_options.txt [new file with mode: 0644]
py/meson.build [new file with mode: 0644]
py/pykms/meson.build [new file with mode: 0644]
utils/meson.build [new file with mode: 0644]

index 7efae50..d198eef 100644 (file)
@@ -5,3 +5,4 @@ build
 *.txt.user
 *.patch
 py/__pycache__
+meson.build.user
diff --git a/kms++/meson.build b/kms++/meson.build
new file mode 100644 (file)
index 0000000..fee1b54
--- /dev/null
@@ -0,0 +1,87 @@
+libkmsxx_sources = files([
+    'src/atomicreq.cpp',
+    'src/blob.cpp',
+    'src/card.cpp',
+    'src/connector.cpp',
+    'src/crtc.cpp',
+    'src/dmabufframebuffer.cpp',
+    'src/drmobject.cpp',
+    'src/drmpropobject.cpp',
+    'src/dumbframebuffer.cpp',
+    'src/encoder.cpp',
+    'src/extframebuffer.cpp',
+    'src/framebuffer.cpp',
+    'src/helpers.cpp',
+    'src/mode_cvt.cpp',
+    'src/modedb_cea.cpp',
+    'src/modedb.cpp',
+    'src/modedb_dmt.cpp',
+    'src/pixelformats.cpp',
+    'src/plane.cpp',
+    'src/property.cpp',
+    'src/videomode.cpp',
+])
+
+public_headers = [
+    'inc/kms++/dmabufframebuffer.h',
+    'inc/kms++/atomicreq.h',
+    'inc/kms++/property.h',
+    'inc/kms++/plane.h',
+    'inc/kms++/kms++.h',
+    'inc/kms++/connector.h',
+    'inc/kms++/card.h',
+    'inc/kms++/modedb.h',
+    'inc/kms++/pagefliphandler.h',
+    'inc/kms++/encoder.h',
+    'inc/kms++/decls.h',
+    'inc/kms++/videomode.h',
+    'inc/kms++/drmobject.h',
+    'inc/kms++/pixelformats.h',
+    'inc/kms++/crtc.h',
+    'inc/kms++/framebuffer.h',
+    'inc/kms++/extframebuffer.h',
+    'inc/kms++/pipeline.h',
+    'inc/kms++/drmpropobject.h',
+    'inc/kms++/mode_cvt.h',
+    'inc/kms++/blob.h',
+    'inc/kms++/dumbframebuffer.h',
+]
+
+public_headers_omap = [
+    'inc/kms++/omap/omapframebuffer.h',
+    'inc/kms++/omap/omapkms++.h',
+    'inc/kms++/omap/omapcard.h',
+]
+
+private_includes = include_directories('src', 'inc')
+public_includes = include_directories('inc')
+
+libdrm_dep = dependency('libdrm')
+
+if libdrmomap_dep.found()
+    libkmsxx_sources += files([
+        'src/omap/omapcard.cpp',
+        'src/omap/omapframebuffer.cpp',
+    ])
+endif
+
+libkmsxx_deps = [ libdrm_dep, libfmt_dep, libdrmomap_dep ]
+
+libkmsxx = library('kms++',
+                   libkmsxx_sources,
+                   install : true,
+                   include_directories : private_includes,
+                   dependencies : libkmsxx_deps)
+
+
+libkmsxx_dep = declare_dependency(include_directories : public_includes,
+                                  link_with : libkmsxx)
+
+install_headers(public_headers, subdir : 'kms++')
+
+if libdrmomap_dep.found()
+    install_headers(public_headers_omap, subdir : 'kms++/omap')
+endif
+
+pkg = import('pkgconfig')
+pkg.generate(libkmsxx)
diff --git a/kms++util/meson.build b/kms++util/meson.build
new file mode 100644 (file)
index 0000000..f9e76ae
--- /dev/null
@@ -0,0 +1,43 @@
+libkmsxxutil_sources = files([
+    'src/colorbar.cpp',
+    'src/color.cpp',
+    'src/cpuframebuffer.cpp',
+    'src/drawing.cpp',
+    'src/extcpuframebuffer.cpp',
+    'src/opts.cpp',
+    'src/resourcemanager.cpp',
+    'src/strhelpers.cpp',
+    'src/testpat.cpp',
+    'src/videodevice.cpp',
+])
+
+public_headers = [
+    'inc/kms++util/color.h',
+    'inc/kms++util/kms++util.h',
+    'inc/kms++util/stopwatch.h',
+    'inc/kms++util/cpuframebuffer.h',
+    'inc/kms++util/strhelpers.h',
+    'inc/kms++util/opts.h',
+    'inc/kms++util/extcpuframebuffer.h',
+    'inc/kms++util/resourcemanager.h',
+    'inc/kms++util/videodevice.h',
+]
+
+private_includes = include_directories('src', 'inc')
+public_includes = include_directories('inc')
+
+libkmsxxutil_deps = [ libkmsxx_dep, libfmt_dep ]
+
+libkmsxxutil = library('kms++util',
+                       libkmsxxutil_sources,
+                       install : true,
+                       include_directories : private_includes,
+                       dependencies : libkmsxxutil_deps)
+
+libkmsxxutil_dep = declare_dependency(include_directories : public_includes,
+                                      link_with : libkmsxxutil)
+
+install_headers(public_headers, subdir : 'kms++util')
+
+pkg = import('pkgconfig')
+pkg.generate(libkmsxxutil)
diff --git a/kmscube/meson.build b/kmscube/meson.build
new file mode 100644 (file)
index 0000000..68765f2
--- /dev/null
@@ -0,0 +1,24 @@
+kmscube_sources = files([
+    'cube.cpp',
+    'cube-egl.cpp',
+    'cube-gbm.cpp',
+    'cube-gles2.cpp',
+    'cube-null.cpp',
+    'cube-wl.cpp',
+    'cube-x11.cpp',
+    'esTransform.cpp',
+])
+
+kmscube_deps = [
+    libdrm_dep, libkmsxx_dep, libkmsxxutil_dep, libfmt_dep,
+    dependency('x11'),
+    dependency('xcb'),
+    dependency('x11-xcb'),
+    dependency('gbm'),
+    dependency('wayland-client'),
+    dependency('wayland-egl'),
+    dependency('glesv2'),
+    dependency('egl'),
+]
+
+executable('kmscube', kmscube_sources, dependencies : kmscube_deps)
diff --git a/meson.build b/meson.build
new file mode 100644 (file)
index 0000000..bc5b8bf
--- /dev/null
@@ -0,0 +1,42 @@
+project('kms++', 'cpp',
+    default_options : [
+        'cpp_std=c++17',
+    ],
+)
+
+cpp = meson.get_compiler('cpp')
+cpp_arguments = []
+
+if (cpp.get_id() == 'gcc' and
+    host_machine.cpu_family() == 'arm' and
+    cpp.has_argument('-Wno-psabi'))
+    cpp_arguments += [
+        '-Wno-psabi',
+    ]
+endif
+
+if cpp.has_argument('-Wno-c99-designator')
+    cpp_arguments += [
+        '-Wno-c99-designator',
+    ]
+endif
+
+add_project_arguments(cpp_arguments, language : 'cpp')
+
+libfmt_includes = include_directories('ext/fmt/include')
+libfmt_dep = declare_dependency(include_directories : libfmt_includes,
+                                compile_args : '-DFMT_HEADER_ONLY')
+
+pybind11_includes = include_directories('ext/pybind11/include')
+pybind11_dep = declare_dependency(include_directories : pybind11_includes)
+
+libdrmomap_dep = dependency('libdrm_omap', required : get_option('omap'))
+
+subdir('kms++')
+subdir('kms++util')
+subdir('utils')
+subdir('py')
+
+if get_option('kmscube')
+    subdir('kmscube')
+endif
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644 (file)
index 0000000..037d41c
--- /dev/null
@@ -0,0 +1,3 @@
+option('kmscube', type : 'boolean', value : false)
+option('pykms', type : 'feature', value : 'auto')
+option('omap', type : 'feature', value : 'auto')
diff --git a/py/meson.build b/py/meson.build
new file mode 100644 (file)
index 0000000..3130bf2
--- /dev/null
@@ -0,0 +1 @@
+subdir('pykms')
diff --git a/py/pykms/meson.build b/py/pykms/meson.build
new file mode 100644 (file)
index 0000000..c0860d3
--- /dev/null
@@ -0,0 +1,38 @@
+py3_dep = dependency('python3', required : get_option('pykms'))
+
+if py3_dep.found() == false
+    subdir_done()
+endif
+
+pykms_sources = files([
+    'pykmsbase.cpp',
+    'pykms.cpp',
+    'pykmsutil.cpp',
+    'pyvid.cpp',
+])
+
+if libdrmomap_dep.found()
+    pykms_sources += files([
+        'pykmsomap.cpp',
+    ])
+endif
+
+pykms_deps = [
+    libkmsxx_dep,
+    libkmsxxutil_dep,
+    py3_dep,
+    pybind11_dep,
+]
+
+destdir = get_option('libdir') / 'python' + py3_dep.version() / 'site-packages/pykms'
+
+pykms = shared_module('pykms',
+                      pykms_sources,
+                      install : true,
+                      install_dir : destdir,
+                      name_prefix : '',
+                      dependencies : pykms_deps)
+
+# Copy __init__.py to build dir so that we can run without installing
+configure_file(input: '__init__.py', output: '__init__.py', copy: true,
+               install : true, install_dir : destdir)
diff --git a/utils/meson.build b/utils/meson.build
new file mode 100644 (file)
index 0000000..10f49f2
--- /dev/null
@@ -0,0 +1,17 @@
+common_deps = [ libkmsxx_dep, libkmsxxutil_dep, libfmt_dep ]
+
+libevdev_dep = dependency('libevdev', required : false)
+
+executable('kmstest', 'kmstest.cpp', dependencies : [ common_deps ], install : true)
+executable('kmsview', 'kmsview.cpp', dependencies : [ common_deps ], install : false)
+executable('kmsprint', 'kmsprint.cpp', dependencies : [ common_deps ], install : true)
+executable('fbtest', 'fbtest.cpp', dependencies : [ common_deps ], install : true)
+executable('kmscapture', 'kmscapture.cpp', dependencies : [ common_deps ], install : false)
+executable('kmsblank', 'kmsblank.cpp', dependencies : [ common_deps ], install : true)
+
+if libevdev_dep.found()
+    executable('kmstouch', 'kmstouch.cpp', dependencies : [ common_deps, libevdev_dep ], install : false)
+endif
+
+executable('wbcap', 'wbcap.cpp', dependencies : [ common_deps ], install : false)
+executable('wbm2m', 'wbm2m.cpp', dependencies : [ common_deps ], install : false)