diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2016-08-12 21:21:45 +0530 |
---|---|---|
committer | Tim-Philipp Müller <tim@centricular.com> | 2016-08-20 11:35:54 +0100 |
commit | 42af2d66d8e4aa73c38be07c8460397adf21ce30 (patch) | |
tree | 59b54f11f5aacc7ca331b913a6e2c30260865873 /gst-libs/gst/interfaces | |
parent | 7e2b68fe2f22b4f12d876aa9385f594244a631b8 (diff) |
Add support for Meson as alternative/parallel build system
https://github.com/mesonbuild/meson
With contributions from:
Tim-Philipp Müller <tim@centricular.com>
Matej Knopp <matej.knopp@gmail.com>
Jussi Pakkanen <jpakkane@gmail.com> (original port)
Highlights of the features provided are:
* Faster builds on Linux (~40-50% faster)
* The ability to build with MSVC on Windows
* Generate Visual Studio project files
* Generate XCode project files
* Much faster builds on Windows (on-par with Linux)
* Seriously fast configure and building on embedded
... and many more. For more details see:
http://blog.nirbheek.in/2016/05/gstreamer-and-meson-new-hope.html
http://blog.nirbheek.in/2016/07/building-and-developing-gstreamer-using.html
Building with Meson should work on both Linux and Windows, but may
need a few more tweaks on other operating systems.
Diffstat (limited to 'gst-libs/gst/interfaces')
-rwxr-xr-x | gst-libs/gst/interfaces/build_mkenum.py | 55 | ||||
-rw-r--r-- | gst-libs/gst/interfaces/meson.build | 33 |
2 files changed, 88 insertions, 0 deletions
diff --git a/gst-libs/gst/interfaces/build_mkenum.py b/gst-libs/gst/interfaces/build_mkenum.py new file mode 100755 index 000000000..cbbf06a56 --- /dev/null +++ b/gst-libs/gst/interfaces/build_mkenum.py @@ -0,0 +1,55 @@ +#!/usr/bin/env python3 + +# This is in its own file rather than inside meson.build +# because a) mixing the two is ugly and b) trying to +# make special characters such as \n go through all +# backends is a fool's errand. + +import sys, os, shutil, subprocess + +h_array = ['--fhead', + "#ifndef __GST_PHOTO_ENUM_TYPES_H__\n#define __GST_PHOTO_ENUM_TYPES_H__\n\n#include <glib-object.h>\n\nG_BEGIN_DECLS\n", + '--fprod', + "\n/* enumerations from \"@filename@\" */\n", + '--vhead', + "GType @enum_name@_get_type (void);\n#define GST_TYPE_@ENUMSHORT@ (@enum_name@_get_type())\n", + '--ftail', + "G_END_DECLS\n\n#endif /* __GST_PHOTO_ENUM_TYPES_H__ */"] + +c_array = [ + '--fhead', + "#include \"photography-enumtypes.h\"\n#include\"photography.h\"\n#define C_ENUM(v) ((gint) v)\n#define C_FLAGS(v) ((guint) v)\n", + '--fprod', + "\n/* enumerations from \"@filename@\" */", + '--vhead', + "GType\n@enum_name@_get_type (void)\n{\n static gsize id = 0;\n static const G@Type@Value values[] = {", + '--vprod', + " { C_@TYPE@(@VALUENAME@), \"@VALUENAME@\", \"@valuenick@\" },", + '--vtail', + " { 0, NULL, NULL }\n };\n\n if (g_once_init_enter (&id)) {\n GType tmp = g_@type@_register_static (\"@EnumName@\", values);\n g_once_init_leave (&id, tmp);\n }\n\n return (GType) id;\n}" + ] + +cmd = [] +argn = 1 +# Find the full command needed to run glib-mkenums +# On UNIX-like, this is just the full path to glib-mkenums +# On Windows, this is the full path to interpreter + full path to glib-mkenums +for arg in sys.argv[1:]: + cmd.append(arg) + argn += 1 + if arg.endswith('glib-mkenums'): + break +ofilename = sys.argv[argn] +headers = sys.argv[argn + 1:] + +if ofilename.endswith('.h'): + arg_array = h_array +else: + arg_array = c_array + +cmd_array = cmd + arg_array + headers +pc = subprocess.Popen(cmd_array, stdout=subprocess.PIPE) +(stdo, _) = pc.communicate() +if pc.returncode != 0: + sys.exit(pc.returncode) +open(ofilename, 'wb').write(stdo) diff --git a/gst-libs/gst/interfaces/meson.build b/gst-libs/gst/interfaces/meson.build new file mode 100644 index 000000000..2349349be --- /dev/null +++ b/gst-libs/gst/interfaces/meson.build @@ -0,0 +1,33 @@ +photography_sources = ['photography.c'] +photo_headers = ['photography.h'] +install_headers(photo_headers, subdir : 'gstreamer-1.0/gst/interfaces') + +mkenums = find_program('build_mkenum.py') + +photoenum_h = custom_target('photoenum_h', + output : 'photography-enumtypes.h', + input : photo_headers, + install : true, + install_dir : 'include/gstreamer-1.0/gst/interfaces', + command : [mkenums, glib_mkenums, '@OUTPUT@', '@INPUT@']) + +photoenum_c = custom_target('photoenum_c', + output : 'photography-enumtypes.c', + input : photo_headers, + command : [mkenums, glib_mkenums, '@OUTPUT@', '@INPUT@']) + +gstphotography = library('gstphotography-' + api_version, + photography_sources, photoenum_h, photoenum_c, + c_args : gst_plugins_bad_args + ['-DGST_USE_UNSTABLE_API'], + include_directories : [configinc, libsinc], + version : libversion, + soversion : soversion, + install : true, + dependencies : [gst_dep], + vs_module_defs: vs_module_defs_dir + 'libgstphotography.def', +) + +gstphotography_dep = declare_dependency(link_with : gstphotography, + include_directories : [libsinc], + dependencies : [gst_dep], + sources : [photoenum_h]) |